Go to the documentation of this file.
45 #ifndef CCXX_OBJECT_H_
46 #define CCXX_OBJECT_H_
48 #ifndef CCXX_MISSING_H_
52 #ifdef CCXX_NAMESPACES
153 {
return getObject();};
156 {
return getObject();};
176 {nextObject = NULL;};
208 {
return nextObject;};
235 {nextObject = prevObject = NULL;};
295 {
return nextObject;};
303 {
return prevObject;};
507 {
return (
void*)thisObject; }
529 {
return this->operator++(); }
537 {
return thisObject == theIndex.thisObject; };
540 {
return !(*
this == theIndex); };
549 {
return thisObject == theObject; };
552 {
return !(*
this == theObject); };
587 #ifdef CCXX_NAMESPACES
MapIndex(const MapIndex &theIndex)
Creates a copy of a given map index.
Definition: object.h:497
MapIndex & operator=(MapObject *theObject)
Assignment operator to avoid implicit cast.
MapObject(const char *id)
Save id, mark as not using any table.
virtual void detach(void)
Remove object from chain.
unsigned count
Definition: object.h:341
void detach(void)
Remove the object from it's current table.
MapObject * nextObject
Definition: object.h:568
void * operator*() const
Dereference operator: the pointed object it is returned as void * for easy re-cast.
Definition: object.h:506
LinkedDouble * getNext(void)
Get next object, for convenience.
Definition: object.h:294
virtual LinkedDouble * getFirst(void)
Get first linked object in list.
virtual void leaveLock(void)
Patch point for a mutex in derived class.
virtual LinkedSingle * getFirst(void)
Get first linked object in list.
void addObject(MapObject &obj)
Map an object to our table.
unsigned range
Definition: object.h:340
void detach(void)
Detach current object, for example, when changing pointer.
InsertMode
Requested in overloaded insert() method to indicate how to insert data into list.
Definition: object.h:254
The Mutex class is used to protect a section of code so that at any given time only a single thread c...
Definition: thread.h:187
virtual MapTable & operator-=(MapObject &obj)
This operator is virtual in case it must also add the object to a managed free list.
virtual LinkedDouble * getInsert(void)
Virtual to get the insert point to use when adding new members.
MapIndex operator++(int)
Postfix increment operator, to be used in loops and such.
Definition: object.h:528
virtual LinkedSingle * getLast(void)
Gets the last object in the list.
const char * idObject
Definition: object.h:569
void * getObject(void) const
virtual void insert(LinkedSingle &obj)
Insert object into chain.
bool operator==(const MapIndex &theIndex) const
Comparison operator, between two MapIndex's.
Definition: object.h:536
LinkedDouble()
Definition: object.h:234
MapIndex & operator++()
Prefix increment operator, to be used in loops and such.
LinkedSingle()
Definition: object.h:175
bool operator!=(const MapObject *theObject) const
Definition: object.h:551
MapIndex(MapObject *theObject)
Creates a map index pointing to a specific map object.
Definition: object.h:489
LinkedDouble * prevObject
Definition: object.h:232
Pointer to reference counted objects.
Definition: object.h:106
RefObject()
The constructor simply initializes the count.
Definition: object.h:76
Self managed single linked list object chain.
Definition: object.h:171
void addFree(MapObject *obj)
Add an object to the managed free list.
virtual ~MapTable()
Destroy the table, calls cleanup.
The MapObject is a base class which can be used to make a derived class operate on a MapTable.
Definition: object.h:564
virtual LinkedDouble * firstObject()
The MapIndex allows linear access into a MapTable, that otherwise could have its elements being retri...
Definition: object.h:473
unsigned refCount
Definition: object.h:71
#define __EXPORT
Definition: config.h:979
virtual void * getObject(void)=0
The actual object being managed can be returned by this method as a void and then recast to the actua...
MapTable & operator+=(MapObject &obj)
An operator to map an object to the table.
void * getEnd()
Get table's end, useful for cycle control; it is returned as void * for easy re-cast.
Definition: object.h:423
virtual void insert(LinkedDouble &obj, InsertMode position=modeAtLast)
Insert object into chain at given position, as indicated by InsertMode; If no position is given,...
MapTable(unsigned size)
Create a map table with a specified number of slots.
virtual unsigned getIndex(const char *id)
Get index value from id string.
virtual void enterLock(void)
virtual void enterLock(void)
Patch point for mutex in derived class.
unsigned getRange(void)
Return range of this table.
Definition: object.h:374
bool operator!=(const MapIndex &theIndex) const
Definition: object.h:539
@ modeAtFirst
insert at first position in list pointed by current object
Definition: object.h:255
void * getLast()
Get the last element into table, it is returned as void * for easy re-cast.
LinkedSingle & operator+=(LinkedSingle &obj)
LinkedDouble & operator--()
substitute functions which may be missing in target platform libc.
MapTable * table
Definition: object.h:570
A map table allows for entities to be mapped (hash index) onto it.
Definition: object.h:336
void * operator*() const
Definition: object.h:152
MapObject ** map
Definition: object.h:342
void * getObject(const char *id)
Lookup an object by id key.
void * operator->() const
Definition: object.h:155
MapIndex()
Creates an empty map index (pointing to nothing).
Definition: object.h:481
LinkedDouble & operator+=(LinkedDouble &obj)
bool operator==(const MapObject *theObject) const
Comparison operator, between the MapIndex and a MapObject, useful to avoid casts for sake of clearnes...
Definition: object.h:548
virtual LinkedDouble * getLast(void)
Gets the last object in the list.
void * getFree(void)
Get next object from managed free list.
virtual ~RefObject()
The destructor is called when the reference count returns to zero.
RefPointer(RefObject *obj)
Create a pointer attached to a reference counted object.
LinkedSingle * nextObject
Definition: object.h:173
virtual void leaveLock(void)
unsigned getSize(void)
Return the number of object stored in this table.
Definition: object.h:382
void * getFirst()
Get the first element into table, it is returned as void * for easy re-cast.
@ modeBefore
insert in list before current object
Definition: object.h:257
LinkedDouble * getPrev(void)
Get prev object in the list.
Definition: object.h:302
RefPointer & operator=(const RefObject &ref)
A reference countable object.
Definition: object.h:67
RefObject * ref
Definition: object.h:108
RefPointer(const RefPointer &ptr)
A copy constructor.
virtual LinkedDouble * lastObject()
RefPointer()
Create an unattached pointer.
Definition: object.h:131
LinkedSingle * getNext(void)
Get next object, for convenience.
Definition: object.h:207
Self managed double linked list object chain.
Definition: object.h:230
@ modeAtLast
insert at last position in list pointed by current object
Definition: object.h:256