ost::MapTable(3)

πŸ“¦ version 1.8.1, in ubuntu jammy

🌸 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 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

πŸŽ€ Protected Member Functions πŸŽ€

  • void cleanup(void)

🌈 Protected Attributes 🌈

  • unsigned range
  • unsigned count
  • MapObject ** map

🫢 Friends 🫢

  • class MapObject
  • class 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.

  • 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