ngscopeclient 0.1-dev+51fbda87c
Public Member Functions | Protected Attributes | List of all members

Bidirectional table mapping integer IDs in scopesession files to object pointers. More...

#include <IDTable.h>

Inheritance diagram for IDTable:
Inheritance graph
[legend]
Collaboration diagram for IDTable:
Collaboration graph
[legend]

Public Member Functions

uintptr_t emplace (void *p)
 Store a new object in the table. More...
 
void emplace (uintptr_t id, void *p)
 Store a new object in the table using a specific ID. More...
 
bool HasID (void *p)
 Checks if we have an object at a specific pointer. More...
 
bool HasID (uintptr_t id)
 Checks if we have an object with a specific ID. More...
 
void ReserveID (uintptr_t id)
 Marks an ID as unavailable for use, without assigning an pointer to it.
 
void clear ()
 Deletes all entries from the table.
 
- Public Member Functions inherited from Bijection< uintptr_t, void * >
forwardType::const_iterator begin ()
 Get an iterator to the start of the forward map.
 
forwardType::const_iterator end ()
 Get an iterator to the end of the forward map.
 
void emplace (uintptr_t a, void * b)
 Adds a new entry to the bijection. More...
 
const uintptr_t & operator[] (void * key)
 Looks up an object in the reverse direction. More...
 
const void * & operator[] (uintptr_t key)
 Looks up an object in the forward direction. More...
 
bool HasEntry (uintptr_t key)
 Determines if an object is present in the forward mapping. More...
 
bool HasEntry (void * key)
 Determines if an object is present in the reverse mapping. More...
 
void clear ()
 Erase all entries in the bijection.
 
void erase (uintptr_t key)
 Erase an entry given a forward key. More...
 
void erase (void * key)
 Erase an entry given a reverse key. More...
 
void replace (void * oldval, void * newval)
 Replaces one value with another, keeping the keys identical.
 
size_t size ()
 Return the number of entries in the bijection.
 

Protected Attributes

uintptr_t m_nextID
 Index of the next ID to be assigned.
 
- Protected Attributes inherited from Bijection< uintptr_t, void * >
forwardType m_forwardMap
 Map of object-to-object in the forward direction.
 
reverseType m_reverseMap
 Map of object-to-object in the reverse direction.
 

Additional Inherited Members

- Public Types inherited from Bijection< uintptr_t, void * >
typedef std::map< uintptr_t, void *, std::less< uintptr_t > > forwardType
 Type of the forward map.
 
typedef std::map< void *, uintptr_t, std::less< void * > > reverseType
 Type of the reverse map.
 

Detailed Description

Bidirectional table mapping integer IDs in scopesession files to object pointers.

No type information is stored, the caller is responsible for knowing what type of object is being stored in the table.

TODO: can we store RTTI info along with the objects to sanity check that we're using the right kind of object

Member Function Documentation

◆ emplace() [1/2]

void IDTable::emplace ( uintptr_t  id,
void *  p 
)
inline

Store a new object in the table using a specific ID.

Parameters
idID to assign to the object
pPointer to the object

◆ emplace() [2/2]

uintptr_t IDTable::emplace ( void *  p)
inline

Store a new object in the table.

Parameters
pPointer to the object
Returns
The ID of the object

◆ HasID() [1/2]

bool IDTable::HasID ( uintptr_t  id)
inline

Checks if we have an object with a specific ID.

Parameters
idID of the object

◆ HasID() [2/2]

bool IDTable::HasID ( void *  p)
inline

Checks if we have an object at a specific pointer.

Parameters
pPointer to the object

The documentation for this class was generated from the following file: