29 #ifndef _UCOMMON_OBJECT_H_
30 #define _UCOMMON_OBJECT_H_
32 #ifndef _UCOMMON_CPR_H_
36 #ifndef _UCOMMON_GENERICS_H_
40 #ifndef _UCOMMON_PROTOCOLS_H_
58 volatile unsigned count;
79 virtual void dealloc(
void);
170 bool operator!()
const;
176 operator bool()
const;
250 virtual ~SparseObjects();
257 unsigned count(
void);
285 inline T *
get(
unsigned offset)
286 {
return static_cast<T*
>(SparseObjects::get(offset));}
295 {
return get(offset);};
297 inline const T* at(
unsigned offset)
298 {
return static_cast<const T&
>(SparseObjects::get(offset));}
301 __LOCAL ObjectProtocol *create(
void)
314 template <
typename T,
class O = CountedObject>
322 inline void set(
const T&
object)
361 inline T& operator()()
384 template <
class T,
class P = auto_
object>
404 {
return static_cast<T*
>(P::object);};
411 {
return *(
static_cast<T*
>(P::object));};
418 {
return static_cast<T*
>(P::object);};
424 inline T*
get(void)
const
425 {
return static_cast<T*
>(P::object);};
432 {P::operator++();
return get();};
439 {P::operator--();
return get();};
451 inline operator bool()
452 {
return P::object != NULL;};
458 {
return P::object == NULL;};
480 {
return object->
copy();}
T & operator()() const
Reference object we are pointing to through function reference.
T * operator++()
Iterate our pointer if we reference an array on the heap.
void operator--()
Iterate our pointer if we reference an array on the heap.
Abstract interfaces and support.
void retain(ObjectProtocol *object)
Convenience function to access object retention.
T & operator*()
Pointer reference to embedded data value.
A common base class for all managed objects.
Generic smart pointer class.
Generic templates for C++.
ObjectProtocol * copy(void)
Retain (increase retention of) object when copying.
A general purpose smart pointer helper class.
sarray(unsigned size)
Generate a sparse typed array of specified size.
virtual void retain(void)=0
Method to retain (or increase retention) of an object.
unsigned copied(void)
Return the number of active references (retentions) to our object.
void release(SharedAccess &object)
Convenience function to unlock shared object through it's protocol.
virtual void release(void)=0
Method to release (or decrease retention) of an object.
Generate a typed sparse managed object array.
Template for embedding a data structure into a reference counted object.
void operator()(T &data)
Set data value by expression reference.
object_value(T &existing)
Construct composite value object and assign from existing data value.
object_value()
Construct composite value object.
void set(const T &object)
Assign our value from a typed data object.
bool is_copied(void)
Test if the object has copied references.
object_pointer()
Create a pointer with no reference.
T * operator*() const
Reference object we are pointing to through pointer indirection.
object_pointer(T *object)
Create a pointer with a reference to a heap object.
A base class for reference counted objects.
Typed smart pointer class.
bool is_retained(void)
Test if the object has been referenced (retained) by anyone yet.
T & operator[](unsigned offset)
Array operation to access member object.
T &() max(T &o1, T &o2)
Convenience function to return max of two objects.
T * operator->() const
Reference member of object we are pointing to.
bool operator!()
See if pointer is not set.
A sparse array of managed objects.
void operator=(const T &data)
Assign embedded data value.
void operator=(T *typed)
Perform assignment operator to existing object.
ObjectProtocol * copy(ObjectProtocol *object)
Convenience function to access object copy.
void reset(void)
Force reset of count.