Go to the documentation of this file.
30 #ifndef _UCOMMON_OBJECT_H_
31 #define _UCOMMON_OBJECT_H_
33 #ifndef _UCOMMON_CPR_H_
37 #ifndef _UCOMMON_GENERICS_H_
41 #ifndef _UCOMMON_PROTOCOLS_H_
59 volatile unsigned count;
189 operator bool()
const;
267 __DELETE_DEFAULTS(
sarray);
282 inline T *
get(
unsigned offset) {
293 return reference_cast<T>(
get(offset));
296 inline T& at(
unsigned offset) {
300 inline const T* operator()(
unsigned offset)
const {
304 inline void operator()(
unsigned offset, T value) {
310 __LOCAL ObjectProtocol *create(
void) __FINAL {
349 return protocol_cast<T*>(
object);
357 return reference_cast<T>(
object);
365 return protocol_cast<T*>(
object);
372 inline T*
get(
void)
const {
373 return protocol_cast<T*>(
object);
393 inline operator bool()
const {
394 return object != NULL;
401 return object == NULL;
T * operator->() const
Reference member of object we are pointing to.
Generic smart pointer class.
virtual ObjectProtocol * create(void)=0
Object factory for creating members of the spare array when they are initially requested.
unsigned copied(void) const
Return the number of active references (retentions) to our object.
virtual ~SparseObjects()
Destroy sparse array and delete all generated objects.
bool is_retained(void) const
Test if the object has been referenced (retained) by anyone yet.
Abstract interfaces and support.
T &() max(T &o1, T &o2)
Convenience function to return max of two objects.
void retain(void)
Increase reference count when retained.
unsigned count(void)
Get count of array elements.
bool operator!() const
Test if the pointer is not set.
object_pointer(T *object)
Create a pointer with a reference to a heap object.
virtual void dealloc(void)
Dealloc object no longer referenced.
Generic templates for C++.
sarray(unsigned size)
Generate a sparse typed array of specified size.
object_pointer()
Create a pointer with no reference.
~AutoObject()
Delete auto pointer.
A general purpose smart pointer helper class.
T * get(unsigned offset)
Get typed member of array.
CountedObject()
Construct a counted object, mark initially as unreferenced.
Common namespace for all ucommon objects.
T * operator*() const
Reference object we are pointing to through pointer indirection.
T & operator()() const
Reference object we are pointing to through function reference.
T copy(const T &src)
Convenience function to copy objects.
void set(ObjectProtocol *object)
Set our pointer to a specific object.
ObjectProtocol * get(unsigned offset)
Get (reference) an object at a specified offset in the array.
void reset(void)
Force reset of count.
object_pointer & operator=(T *typed)
Perform assignment operator to existing object.
AutoObject(ObjectProtocol *object)
Construct an auto-pointer referencing an existing object.
SparseObjects(unsigned size)
Create a sparse array of known size.
Generate a typed sparse managed object array.
A base class for reference counted objects.
bool is_copied(void) const
Test if the object has copied references.
Typed smart pointer class.
void release(void)
Manually release the pointer.
CountedObject(const ObjectProtocol &ref)
Construct a copy of a counted object.
A sparse array of managed objects.
void release(void)
Decrease reference count when released.
void purge(void)
Purge the array by deleting all created objects.
AutoObject(const AutoObject &pointer)
Construct an auto-pointer as a copy of another pointer.
bool operator!() const
See if pointer is not set.
A common base class for all managed objects.
T * get(void) const
Get pointer to object.
T & operator[](unsigned offset)
Array operation to access member object.