|
ngscopeclient v0.2.1
|
A strict one-to-one mapping from objects of type T1 to type T2 (which must be different types). More...
#include <Bijection.h>
Public Types | |
| typedef std::map< T1, T2, Compare1 > | forwardType |
| Type of the forward map. | |
| typedef std::map< T2, T1, Compare2 > | 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. | |
| void | emplace (T1 a, T2 b) |
| Adds a new entry to the bijection. | |
| const T1 & | operator[] (T2 key) |
| Looks up an object in the reverse direction. | |
| const T2 & | operator[] (T1 key) |
| Looks up an object in the forward direction. | |
| bool | HasEntry (T1 key) |
| Determines if an object is present in the forward mapping. | |
| bool | HasEntry (T2 key) |
| Determines if an object is present in the reverse mapping. | |
| virtual void | clear () |
| Erase all entries in the bijection. | |
| void | erase (T1 key) |
| Erase an entry given a forward key. | |
| void | erase (T2 key) |
| Erase an entry given a reverse key. | |
| void | replace (T2 oldval, T2 newval) |
| Replaces one value with another, keeping the keys identical. | |
| size_t | size () |
| Return the number of entries in the bijection. | |
Protected Attributes | |
| forwardType | m_forwardMap |
| Map of object-to-object in the forward direction. | |
| reverseType | m_reverseMap |
| Map of object-to-object in the reverse direction. | |
A strict one-to-one mapping from objects of type T1 to type T2 (which must be different types).
Internally implemented as two synchronized std::map instances
|
inline |
Adds a new entry to the bijection.
Neither a nor b is allowed to be in the map when this function is called.
| a | First object |
| b | Second object |
|
inline |
Erase an entry given a forward key.
| key | The object to remove |
|
inline |
Erase an entry given a reverse key.
| key | The object to remove |
|
inline |
Determines if an object is present in the forward mapping.
| key | The object being looked up |
|
inline |
Determines if an object is present in the reverse mapping.
| key | The object being looked up |
|
inline |
Looks up an object in the forward direction.
| key | The object being looked up |
|
inline |
Looks up an object in the reverse direction.
| key | The object being looked up |