.TH "ost::MapTable" 3 "Sun Dec 27 2020" "GNU CommonC++" \" -*- nroff -*- .ad l .nh .SH NAME ost::MapTable \- A map table allows for entities to be mapped (hash index) onto it\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBost::Mutex\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBMapTable\fP (unsigned size)" .br .RI "Create a map table with a specified number of slots\&. " .ti -1c .RI "virtual \fB~MapTable\fP ()" .br .RI "Destroy the table, calls cleanup\&. " .ti -1c .RI "virtual unsigned \fBgetIndex\fP (const char *id)" .br .RI "Get index value from id string\&. " .ti -1c .RI "unsigned \fBgetRange\fP (void)" .br .RI "Return range of this table\&. " .ti -1c .RI "unsigned \fBgetSize\fP (void)" .br .RI "Return the number of object stored in this table\&. " .ti -1c .RI "void * \fBgetObject\fP (const char *id)" .br .RI "Lookup an object by id key\&. " .ti -1c .RI "void \fBaddObject\fP (\fBMapObject\fP &obj)" .br .RI "Map an object to our table\&. " .ti -1c .RI "void * \fBgetFirst\fP ()" .br .RI "Get the first element into table, it is returned as void * for easy re-cast\&. " .ti -1c .RI "void * \fBgetLast\fP ()" .br .RI "Get the last element into table, it is returned as void * for easy re-cast\&. " .ti -1c .RI "void * \fBgetEnd\fP ()" .br .RI "Get table's end, useful for cycle control; it is returned as void * for easy re-cast\&. " .ti -1c .RI "void * \fBgetFree\fP (void)" .br .RI "Get next object from managed free list\&. " .ti -1c .RI "void \fBaddFree\fP (\fBMapObject\fP *obj)" .br .RI "Add an object to the managed free list\&. " .ti -1c .RI "\fBMapTable\fP & \fBoperator+=\fP (\fBMapObject\fP &obj)" .br .RI "An operator to map an object to the table\&. " .ti -1c .RI "virtual \fBMapTable\fP & \fBoperator\-=\fP (\fBMapObject\fP &obj)" .br .RI "This operator is virtual in case it must also add the object to a managed free list\&. " .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "void \fBcleanup\fP (void)" .br .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "unsigned \fBrange\fP" .br .ti -1c .RI "unsigned \fBcount\fP" .br .ti -1c .RI "\fBMapObject\fP ** \fBmap\fP" .br .in -1c .SS "Friends" .in +1c .ti -1c .RI "class \fBMapObject\fP" .br .ti -1c .RI "class \fBMapIndex\fP" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP A map table allows for entities to be mapped (hash index) onto it\&. Unlike with \fBAssoc\fP, This form of map table also allows objects to be removed from the table\&. This table also includes a mutex lock for thread safety\&. A free list is also optionally maintained for reusable maps\&. .PP \fBAuthor\fP .RS 4 David Sugar dyfet@gnutelephony.org .RE .PP Table to hold hash indexed objects\&. .SH "Constructor & Destructor Documentation" .PP .SS "ost::MapTable::MapTable (unsigned size)" .PP Create a map table with a specified number of slots\&. .PP \fBParameters\fP .RS 4 \fInumber\fP of slots\&. .RE .PP .SS "virtual ost::MapTable::~MapTable ()\fC [virtual]\fP" .PP Destroy the table, calls cleanup\&. .SH "Member Function Documentation" .PP .SS "void ost::MapTable::addFree (\fBMapObject\fP * obj)" .PP Add an object to the managed free list\&. Some \fBMapObject\fP's may override delete operator to detach and do this\&. .PP \fBParameters\fP .RS 4 \fIobject\fP to add\&. .RE .PP .SS "void ost::MapTable::addObject (\fBMapObject\fP & obj)" .PP Map an object to our table\&. If it is in another table already, it is removed there first\&. .PP \fBParameters\fP .RS 4 \fIobject\fP to map\&. .RE .PP .SS "void ost::MapTable::cleanup (void)\fC [protected]\fP" .SS "void* ost::MapTable::getEnd ()\fC [inline]\fP" .PP Get table's end, useful for cycle control; it is returned as void * for easy re-cast\&. .PP \fBReturns\fP .RS 4 pointer to found object or NULL\&. .RE .PP .SS "void* ost::MapTable::getFirst ()" .PP Get the first element into table, it is returned as void * for easy re-cast\&. .PP \fBReturns\fP .RS 4 pointer to found object or NULL\&. .RE .PP .SS "void* ost::MapTable::getFree (void)" .PP Get next object from managed free list\&. This returns as a void so it can be recast into the actual type being used in derived \fBMapObject\fP's\&. A derived version of \fBMapTable\fP may well offer an explicit type version of this\&. Some derived \fBMapObject\fP's may override new to use managed list\&. .PP \fBReturns\fP .RS 4 next object on free list\&. .RE .PP .SS "virtual unsigned ost::MapTable::getIndex (const char * id)\fC [virtual]\fP" .PP Get index value from id string\&. This function can be changed as needed to provide better collision avoidence for specific tables\&. .PP \fBParameters\fP .RS 4 \fIid\fP string .RE .PP \fBReturns\fP .RS 4 index slot in table\&. .RE .PP .SS "void* ost::MapTable::getLast ()" .PP Get the last element into table, it is returned as void * for easy re-cast\&. .PP \fBReturns\fP .RS 4 pointer to found object or NULL\&. .RE .PP .SS "void* ost::MapTable::getObject (const char * id)" .PP Lookup an object by id key\&. It is returned as void * for easy re-cast\&. .PP \fBParameters\fP .RS 4 \fIkey\fP to find\&. .RE .PP \fBReturns\fP .RS 4 pointer to found object or NULL\&. .RE .PP .SS "unsigned ost::MapTable::getRange (void)\fC [inline]\fP" .PP Return range of this table\&. .PP \fBReturns\fP .RS 4 table range\&. .RE .PP .SS "unsigned ost::MapTable::getSize (void)\fC [inline]\fP" .PP Return the number of object stored in this table\&. .PP \fBReturns\fP .RS 4 table size\&. .RE .PP .SS "\fBMapTable\fP& ost::MapTable::operator+= (\fBMapObject\fP & obj)" .PP An operator to map an object to the table\&. .PP \fBReturns\fP .RS 4 table being used\&. .RE .PP \fBParameters\fP .RS 4 \fIobject\fP being mapped\&. .RE .PP .SS "virtual \fBMapTable\fP& ost::MapTable::operator\-= (\fBMapObject\fP & obj)\fC [virtual]\fP" .PP This operator is virtual in case it must also add the object to a managed free list\&. .PP \fBReturns\fP .RS 4 current table\&. .RE .PP \fBParameters\fP .RS 4 \fIobject\fP entity to remove\&. .RE .PP .SH "Friends And Related Function Documentation" .PP .SS "friend class \fBMapIndex\fP\fC [friend]\fP" .SS "friend class \fBMapObject\fP\fC [friend]\fP" .SH "Member Data Documentation" .PP .SS "unsigned ost::MapTable::count\fC [protected]\fP" .SS "\fBMapObject\fP** ost::MapTable::map\fC [protected]\fP" .SS "unsigned ost::MapTable::range\fC [protected]\fP" .SH "Author" .PP Generated automatically by Doxygen for GNU CommonC++ from the source code\&.