45 #ifndef COMMONCPP_OBJECT_H_
46 #define COMMONCPP_OBJECT_H_
48 #ifndef COMMONCPP_CONFIG_H_
49 #include <commoncpp/config.h>
92 virtual void *getObject(
void) = 0;
117 virtual void enterLock(
void);
123 virtual void leaveLock(
void);
150 inline void *operator*()
const
151 {
return getObject();};
153 inline void *operator->()
const
154 {
return getObject();};
156 void *getObject(
void)
const;
158 bool operator!()
const;
174 {nextObject = NULL;};
206 {
return nextObject;};
233 {nextObject = prevObject = NULL;};
237 virtual void enterLock(
void);
239 virtual void leaveLock(
void);
293 {
return nextObject;};
301 {
return prevObject;};
311 virtual void insert(
LinkedDouble& obj, InsertMode position = modeAtLast);
316 virtual void detach(
void);
365 virtual unsigned getIndex(
const char *
id);
390 void *getObject(
const char *
id);
505 {
return (
void*)thisObject; }
527 {
return this->operator++(); }
535 {
return thisObject == theIndex.thisObject; };
537 bool operator!=(
const MapIndex& theIndex)
const
538 {
return !(*
this == theIndex); };
547 {
return thisObject == theObject; };
549 bool operator!=(
const MapObject* theObject)
const
550 {
return !(*
this == theObject); };
567 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.