logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

ost::MapTable - A map table allows for entities to be mapped (hash index) onto it.

Author

       Generated automatically by Doxygen for GNU CommonC++ from the source code.

GNU CommonC++                                    Sun Dec 27 2020                                ost::MapTable(3)

Constructor & Destructor Documentation

ost::MapTable::MapTable(unsignedsize)
       Create a map table with a specified number of slots.

       Parametersnumber of slots.

   virtualost::MapTable::~MapTable()[virtual]
       Destroy the table, calls cleanup.

Detailed Description

       A map table allows for entities to be mapped (hash index) onto it.

       Unlike with Assoc, 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.

       Author
           David Sugar dyfet@gnutelephony.org

       Table to hold hash indexed objects.

Member Data Documentation

unsignedost::MapTable::count[protected]MapObject**ost::MapTable::map[protected]unsignedost::MapTable::range[protected]

Member Function Documentation

voidost::MapTable::addFree(MapObject*obj)
       Add an object to the managed free list. Some MapObject's may override delete operator to detach and do
       this.

       Parametersobject to add.

   voidost::MapTable::addObject(MapObject&obj)
       Map an object to our table. If it is in another table already, it is removed there first.

       Parametersobject to map.

   voidost::MapTable::cleanup(void)[protected]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.

   virtualunsignedost::MapTable::getIndex(constchar*id)[virtual]
       Get index value from id string. This function can be changed as needed to provide better collision
       avoidence for specific tables.

       Parametersid 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(constchar*id)
       Lookup an object by id key. It is returned as void * for easy re-cast.

       Parameterskey to find.

       Returns
           pointer to found object or NULL.

   unsignedost::MapTable::getRange(void)[inline]
       Return range of this table.

       Returns
           table range.

   unsignedost::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.

       Parametersobject being mapped.

   virtualMapTable&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.

       Parametersobject entity to remove.

Name

       ost::MapTable - A map table allows for entities to be mapped (hash index) onto it.

Synopsis

       #include <object.h>

       Inherits ost::Mutex.

   PublicMemberFunctionsMapTable (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 string.
       unsigned getRange (void)
           Return range of this table.
       unsigned getSize (void)
           Return the number of object stored in this table.
       void * getObject (const char *id)
           Lookup an object by id key.
       void addObject (MapObject &obj)
           Map an object to our table.
       void * getFirst ()
           Get the first element into table, it is returned as void * for easy re-cast.
       void * getLast ()
           Get the last element into table, it is returned as void * for easy re-cast.
       void * getEnd ()
           Get table's end, useful for cycle control; it is returned as void * for easy re-cast.
       void * getFree (void)
           Get next object from managed free list.
       void addFree (MapObject *obj)
           Add an object to the managed free list.
       MapTable & operator+= (MapObject &obj)
           An operator to map an object to the table.
       virtual MapTable & operator-= (MapObject &obj)
           This operator is virtual in case it must also add the object to a managed free list.

   ProtectedMemberFunctions
       void cleanup (void)

   ProtectedAttributes
       unsigned range
       unsigned countMapObject ** mapFriends
       class MapObject
       class MapIndexAdditionalInheritedMembers

See Also