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);
175 bool operator!()
const;
181 operator bool()
const;
255 virtual ~SparseObjects();
262 unsigned count(
void);
290 inline T *
get(
unsigned offset) {
301 return reference_cast<T>(
get(offset));
304 inline const T* at(
unsigned offset)
const {
309 __LOCAL ObjectProtocol *create(
void) {
323 template <
typename T,
class O = CountedObject>
331 inline void set(
const T&
object) {
371 inline operator T&() {
375 inline T& operator()() {
400 template <
class T,
class P = auto_
object>
420 return static_cast<T*
>(P::object);
428 return reference_cast<T>(P::object);
436 return static_cast<T*
>(P::object);
443 inline T*
get(void)
const {
444 return static_cast<T*
>(P::object);
470 P::operator=(polypointer_cast<ObjectProtocol*>(typed));
476 inline operator bool()
const {
477 return P::object != NULL;
484 return P::object == NULL;
511 return object->
copy();
void reset(void)
Force reset of count.
T * operator*() const
Reference object we are pointing to through pointer indirection.
void operator()(T &data)
Set data value by expression reference.
void release(SharedAccess &object)
Convenience function to unlock shared object through it's protocol.
A general purpose smart pointer helper class.
unsigned copied(void) const
Return the number of active references (retentions) to our object.
A base class for reference counted objects.
Typed smart pointer class.
T & operator()() const
Reference object we are pointing to through function reference.
bool is_retained(void) const
Test if the object has been referenced (retained) by anyone yet.
void set(const T &object)
Assign our value from a typed data object.
ObjectProtocol * copy(ObjectProtocol *object)
Convenience function to access object copy.
T * operator->() const
Reference member of object we are pointing to.
bool is_copied(void) const
Test if the object has copied references.
A common base class for all managed objects.
void operator=(T *typed)
Perform assignment operator to existing object.
object_value(T &existing)
Construct composite value object and assign from existing data value.
T & operator*()
Pointer reference to embedded data value.
bool operator!() const
See if pointer is not set.
T * operator++()
Iterate our pointer if we reference an array on the heap.
Generic smart pointer class.
T value
Embedded data value.
Common namespace for all ucommon objects.
A sparse array of managed objects.
object_value()
Construct composite value object.
ObjectProtocol * copy(void)
Retain (increase retention of) object when copying.
object_pointer()
Create a pointer with no reference.
void retain(ObjectProtocol *object)
Convenience function to access object retention.
Generate a typed sparse managed object array.
void operator--()
Iterate our pointer if we reference an array on the heap.
object_pointer(T *object)
Create a pointer with a reference to a heap object.
ObjectProtocol * get(unsigned offset)
Get (reference) an object at a specified offset in the array.
Template for embedding a data structure into a reference counted object.
T & operator[](unsigned offset)
Array operation to access member object.
void operator=(const T &data)
Assign embedded data value.
T &() max(T &o1, T &o2)
Convenience function to return max of two objects.
sarray(unsigned size)
Generate a sparse typed array of specified size.
Abstract interfaces and support.
Generic templates for C++.