|
Open Model Railroad Network (OpenMRN)
|
This is an abstraction of BSD sys/tree.h that is meant to mimic the semantics of std::map without having to link in libstdc++. More...
#include <LinearMap.hxx>
Classes | |
| struct | Element |
| Entry element in mapping. More... | |
| class | Iterator |
| This mimics an std::Iterator. More... | |
| struct | Pair |
| list entry. More... | |
Public Member Functions | |
| LinearMap () | |
| Default Constructor which with no mapping entry limit. | |
| LinearMap (size_t entries) | |
| Constructor that limits the number of mappings to a static pool. | |
| ~LinearMap () | |
| Destructor. | |
| void | clear () |
| Removes all elements. | |
| size_t | erase (Key key) |
| Remove a node from the tree. | |
| void | erase (Iterator it) |
| Remove a node from the tree. | |
| Value & | operator[] (const Key &key) |
| Find the index associated with the key and create it does not exist. | |
| size_t | size () |
| Number of elements currently in the map. | |
| size_t | max_size () |
| Maximum theoretical number of elements in the map. | |
| Iterator | find (const Key &key) |
| Find an element matching the given key. | |
| Iterator | end () |
| Get an Iterator index pointing one past the last element in mapping. | |
| Iterator | begin () |
| Get an Iterator index pointing to the first element in the mapping. | |
Private Member Functions | |
| DISALLOW_COPY_AND_ASSIGN (LinearMap) | |
Private Attributes | |
| size_t | entries |
| total number of entries for this instance | |
| size_t | used |
| total number of entries in use for this instance | |
| Element * | list |
| list of entries | |
This is an abstraction of BSD sys/tree.h that is meant to mimic the semantics of std::map without having to link in libstdc++.
Definition at line 45 of file LinearMap.hxx.
|
inline |
Default Constructor which with no mapping entry limit.
Definition at line 50 of file LinearMap.hxx.
|
inline |
Constructor that limits the number of mappings to a static pool.
| entries | number of nodes to statically create and track |
Definition at line 62 of file LinearMap.hxx.
Destructor.
Definition at line 71 of file LinearMap.hxx.
Get an Iterator index pointing to the first element in the mapping.
Definition at line 293 of file LinearMap.hxx.
|
inline |
Removes all elements.
Definition at line 184 of file LinearMap.hxx.
Get an Iterator index pointing one past the last element in mapping.
Definition at line 284 of file LinearMap.hxx.
Remove a node from the tree.
| it | Iterator index for the element to remove |
Definition at line 214 of file LinearMap.hxx.
|
inline |
Remove a node from the tree.
| key | key for the element to remove |
Definition at line 193 of file LinearMap.hxx.
|
inline |
Find an element matching the given key.
| key | key to search for |
Definition at line 269 of file LinearMap.hxx.
|
inline |
Maximum theoretical number of elements in the map.
Definition at line 260 of file LinearMap.hxx.
|
inline |
Find the index associated with the key and create it does not exist.
| key | key to lookup |
Definition at line 231 of file LinearMap.hxx.
|
inline |
Number of elements currently in the map.
Definition at line 252 of file LinearMap.hxx.
|
private |
total number of entries for this instance
Definition at line 300 of file LinearMap.hxx.
list of entries
Definition at line 306 of file LinearMap.hxx.
|
private |
total number of entries in use for this instance
Definition at line 303 of file LinearMap.hxx.