ost::MapTable(3)
πΈ ost::MapTable(3) πΈ
okay bestie, gather round, because we're about to talk about ost::MapTable β and yes, this is a page from the Library Functions Manual, section 3, so it's a library function, not a command. iykyk π
β¨ NAME β¨
ost::MapTable β a map table allows for entities to be mapped (hash index) onto it. that's it. that's the whole vibe. π
π¦ SYNOPSIS π¦
#include <object.h>
Inherits ost::Mutex. yes ma'am, thread-safe by inheritance, we love to see it π
π Public Member Functions π
MapTable(unsigned size)β create a map table with a specified number of slots β¨virtual ~MapTable()β destroy the table, calls cleanup πvirtual unsigned getIndex(const char *id)β get index value from id stringunsigned getRange(void)β return range of this tableunsigned getSize(void)β return the number of object stored in this tablevoid *getObject(const char *id)β lookup an object by id keyvoid addObject(MapObject &obj)β map an object to our tablevoid *getFirst()β get the first element into table, it is returned asvoid *for easy re-castvoid *getLast()β get the last element into table, it is returned asvoid *for easy re-castvoid *getEnd()β get table's end, useful for cycle control; it is returned asvoid *for easy re-castvoid *getFree(void)β get next object from managed free listvoid addFree(MapObject *obj)β add an object to the managed free listMapTable &operator+=(MapObject &obj)β an operator to map an object to the tablevirtual MapTable &operator-=(MapObject &obj)β this operator is virtual in case it must also add the object to a managed free list
π Protected Member Functions π
void cleanup(void)
π Protected Attributes π
unsigned rangeunsigned countMapObject ** map
π«Ά Friends π«Ά
class MapObjectclass MapIndex
β Additional Inherited Members β
π DETAILED DESCRIPTION π
A map table allows for entities to be mapped (hash index) onto it. lowkey iconic, ngl.
Unlike with Assoc, this form of map table also allows objects to be removed from the table. it also includes a mutex lock for thread safety (main character energy fr fr). a free list is also optionally maintained for reusable maps π
π Author π
David Sugar dyfet@gnutelephony.org
Table to hold hash indexed objects. periodt. π
π§ CONSTRUCTOR & DESTRUCTOR DOCUMENTATION π§
πΈ ost::MapTable::MapTable(unsigned size) πΈ
Create a map table with a specified number of slots β¨
Parameters
- number of slots.
π virtual ost::MapTable::~MapTable() [virtual] π
Destroy the table, calls cleanup. rip to the table, it did its best π
π₯ MEMBER FUNCTION DOCUMENTATION π₯
π void ost::MapTable::addFree(MapObject * obj) π
Add an object to the managed free list. Some MapObject's may override delete operator to detach and do this. sneaky but valid π
Parameters
- object to add.
π¦ void ost::MapTable::addObject(MapObject & obj) π¦
Map an object to our table. If it is in another table already, it is removed there first. no double-dipping bestie π«
Parameters
- object to map.
β¨ void ost::MapTable::cleanup(void) [protected] β¨
(no description, she's mysterious, she's private-ish, we respect that π)
π void* ost::MapTable::getEnd() [inline] π
Get table's end, useful for cycle control; it is returned as void * for easy re-cast.
Returns
- pointer to found object or
NULL.
π void* ost::MapTable::getFirst() π
Get the first element into table, it is returned as void * for easy re-cast.
Returns
- pointer to found object or
NULL.
π void* ost::MapTable::getFree(void) π
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 MapObject's. A derived version of MapTable may well offer an explicit type version of this. Some derived MapObject's may override new to use managed list.
Returns
- next object on free list.
β virtual unsigned ost::MapTable::getIndex(const char * id) [virtual] β
Get index value from id string. This function can be changed as needed to provide better collision avoidence for specific tables. (yes, "avoidence" β we are quoting the source, we do not fix the source, that's the rule π )
Parameters
- id string
Returns
- index slot in table.
π void* ost::MapTable::getLast() π
Get the last element into table, it is returned as void * for easy re-cast.
Returns
- pointer to found object or
NULL.
πΈ void* ost::MapTable::getObject(const char * id) πΈ
Lookup an object by id key. It is returned as void * for easy re-cast.
Parameters
- key to find.
Returns
- pointer to found object or
NULL.
π unsigned ost::MapTable::getRange(void) [inline] π
Return range of this table.
Returns
- table range.
π unsigned ost::MapTable::getSize(void) [inline] π
Return the number of object stored in this table.
Returns
- table size.
π§ MapTable& ost::MapTable::operator+=(MapObject & obj) π§
An operator to map an object to the table.
Returns
- table being used.
Parameters
- object being mapped.
π
virtual MapTable& ost::MapTable::operator-=(MapObject & obj) [virtual] π
This operator is virtual in case it must also add the object to a managed free list.
Returns
- current table.
Parameters
- object entity to remove.
π«Ά FRIENDS AND RELATED FUNCTION DOCUMENTATION π«Ά
friend class MapIndex[friend]friend class MapObject[friend]
π MEMBER DATA DOCUMENTATION π
unsigned ost::MapTable::count[protected]MapObject** ost::MapTable::map[protected]unsigned ost::MapTable::range[protected]
π AUTHOR π
Generated automatically by Doxygen for GNU CommonC++ from the source code.
and that's the whole page bestie!! π this lil doc drop came from GNU CommonC++ and was dated Sun Dec 27 2020 β shoutout to the manpage, she ate and left no crumbs ππ
π¦ where this page comes from
- ubuntu jammy: libcommoncpp2-doc 1.8.1-10
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms