44 #ifndef COMMONCPP_OBJECT_H_
45 #define COMMONCPP_OBJECT_H_
47 #ifndef COMMONCPP_CONFIG_H_
48 #include <commoncpp/config.h>
91 virtual void *getObject(
void) = 0;
116 virtual void enterLock(
void);
122 virtual void leaveLock(
void);
149 inline void *operator*()
const
150 {
return getObject();};
152 inline void *operator->()
const
153 {
return getObject();};
155 void *getObject(
void)
const;
157 bool operator!()
const;
173 {nextObject = NULL;};
205 {
return nextObject;};
232 {nextObject = prevObject = NULL;};
236 virtual void enterLock(
void);
238 virtual void leaveLock(
void);
292 {
return nextObject;};
300 {
return prevObject;};
310 virtual void insert(
LinkedDouble& obj, InsertMode position = modeAtLast);
315 virtual void detach(
void);
364 virtual unsigned getIndex(
const char *
id);
389 void *getObject(
const char *
id);
504 {
return (
void*)thisObject; }
526 {
return this->operator++(); }
534 {
return thisObject == theIndex.thisObject; };
536 bool operator!=(
const MapIndex& theIndex)
const
537 {
return !(*
this == theIndex); };
546 {
return thisObject == theObject; };
548 bool operator!=(
const MapObject* theObject)
const
549 {
return !(*
this == theObject); };
566 const char *idObject;
insert at last position in list pointed by current object
The MapIndex allows linear access into a MapTable, that otherwise could have its elements being retri...
MapIndex()
Creates an empty map index (pointing to nothing).
A map table allows for entities to be mapped (hash index) onto it.
void * getEnd()
Get table's end, useful for cycle control; it is returned as void * for easy re-cast.
InsertMode
Requested in overloaded insert() method to indicate how to insert data into list. ...
unsigned getRange(void)
Return range of this table.
A reference countable object.
MapIndex(MapObject *theObject)
Creates a map index pointing to a specific map object.
unsigned getSize(void)
Return the number of object stored in this table.
bool operator==(const MapIndex &theIndex) const
Comparison operator, between two MapIndex's.
bool operator==(const MapObject *theObject) const
Comparison operator, between the MapIndex and a MapObject, useful to avoid casts for sake of clearnes...
LinkedSingle * getNext(void)
Get next object, for convenience.
LinkedDouble * getNext(void)
Get next object, for convenience.
void * operator*() const
Dereference operator: the pointed object it is returned as void * for easy re-cast.
LinkedDouble * getPrev(void)
Get prev object in the list.
Self managed single linked list object chain.
insert in list before current object
RefObject()
The constructor simply initializes the count.
The MapObject is a base class which can be used to make a derived class operate on a MapTable...
RefPointer()
Create an unattached pointer.
Self managed double linked list object chain.
MapIndex(const MapIndex &theIndex)
Creates a copy of a given map index.
insert at first position in list pointed by current object
MapIndex operator++(int)
Postfix increment operator, to be used in loops and such.
Pointer to reference counted objects.