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;
80 virtual void dealloc(
void);
118 void retain(
void) __OVERRIDE;
124 void release(
void) __OVERRIDE;
183 bool operator!()
const;
189 operator bool()
const;
244 virtual ~SparseObjects();
251 unsigned count(
void);
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) {
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;
A common base class for all managed objects.
bool is_retained(void) const
Test if the object has been referenced (retained) by anyone yet.
T & operator()() const
Reference object we are pointing to through function reference.
object_pointer()
Create a pointer with no reference.
void set(ObjectProtocol *object)
Set our pointer to a specific object.
T copy(const T &src)
Convenience function to copy objects.
T & operator[](unsigned offset)
Array operation to access member object.
A general purpose smart pointer helper class.
T * operator*() const
Reference object we are pointing to through pointer indirection.
T &() max(T &o1, T &o2)
Convenience function to return max of two objects.
ObjectProtocol * get(unsigned offset)
Get (reference) an object at a specified offset in the array.
object_pointer & operator=(T *typed)
Perform assignment operator to existing object.
bool is_copied(void) const
Test if the object has copied references.
sarray(unsigned size)
Generate a sparse typed array of specified size.
A sparse array of managed objects.
unsigned copied(void) const
Return the number of active references (retentions) to our object.
T * operator->() const
Reference member of object we are pointing to.
Common namespace for all ucommon objects.
bool operator!() const
See if pointer is not set.
Abstract interfaces and support.
Typed smart pointer class.
object_pointer(T *object)
Create a pointer with a reference to a heap object.
A base class for reference counted objects.
Generic templates for C++.
void reset(void)
Force reset of count.
Generic smart pointer class.
Generate a typed sparse managed object array.