|
ngscopeclient v0.2
|
Bidirectional table mapping integer IDs in scopesession files to object pointers. More...
#include <IDTable.h>
Public Types | |
| typedef std::map< uintptr_t, SerializableObject *, std::less< uintptr_t > > | forwardType |
| Type of the forward map. | |
| typedef std::map< SerializableObject *, uintptr_t, std::less< SerializableObject * > > | reverseType |
| Type of the reverse map. | |
Public Member Functions | |
| 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. | |
| uintptr_t | emplace (SerializableObject *p) |
| Store a new object in the table. | |
| void | emplace (uintptr_t id, SerializableObject *p) |
| Store a new object in the table using a specific ID. | |
| bool | HasID (SerializableObject *p) |
| Checks if we have an object at a specific pointer. | |
| bool | HasID (uintptr_t id) |
| Checks if we have an object with a specific ID. | |
| void | ReserveID (uintptr_t id) |
| Marks an ID as unavailable for use, without assigning an pointer to it. | |
| template<class T > | |
| T * | Lookup (uintptr_t id) |
| Type-safe object lookup. | |
| uintptr_t | operator[] (SerializableObject *key) |
| Forward lookup. | |
| void | clear () |
| Deletes all entries from the table. | |
| void | erase (uintptr_t key) |
| Erase an entry given a forward key. | |
| void | erase (SerializableObject *key) |
| Erase an entry given a reverse key. | |
| void | replace (SerializableObject *oldval, SerializableObject *newval) |
| Replaces one value with another, keeping the keys identical. | |
| size_t | size () const |
| Return the number of entries in the bijection. | |
Protected Attributes | |
| uintptr_t | m_nextID |
| Index of the next ID to be assigned. | |
| forwardType | m_forwardMap |
| Map of object-to-object in the forward direction. | |
| reverseType | m_reverseMap |
| Map of object-to-object in the reverse direction. | |
Bidirectional table mapping integer IDs in scopesession files to object pointers.
Pointers must be SerializableObject derived to ensure type safety
|
inline |
Store a new object in the table.
| p | Pointer to the object |
|
inline |
Store a new object in the table using a specific ID.
| id | ID to assign to the object |
| p | Pointer to the object |
|
inline |
Erase an entry given a reverse key.
| key | The object to remove |
Erase an entry given a forward key.
| key | The object to remove |
|
inline |
Checks if we have an object at a specific pointer.
| p | Pointer to the object |
Checks if we have an object with a specific ID.
| id | ID of the object |