|
|
Internally the class is implemented as a mapped linked list: - A linked list of pairs <ConfigNodeId, typename V> contains the ConfigNodeId nodes and the corresponding values. - An STL <map> stores the mapping between unique node IDs and the corresponding iterators in the above list.
The advantage of such implementation is that the time to insert and remove entries to/from the list is similar to the time to perform those operations on an STL map container.
typedef list<pair<ConfigNodeId, V> > ValuesList | ValuesList |
typedef ValuesList::iterator iterator | iterator |
typedef ValuesList::const_iterator const_iterator | const_iterator |
ConfigNodeIdMap ()
| ConfigNodeIdMap |
~ConfigNodeIdMap ()
| ~ConfigNodeIdMap |
[virtual]
typename ConfigNodeIdMap::iterator begin ()
| begin |
Get the iterator to the first element.
Returns: the iterator to the first element.
typename ConfigNodeIdMap::const_iterator begin ()
| begin |
[const]
Get the const iterator to the first element.
Returns: the const iterator to the first element.
typename ConfigNodeIdMap::iterator end ()
| end |
Get the iterator to the last element.
Returns: the iterator to the last element.
typename ConfigNodeIdMap::const_iterator end ()
| end |
[const]
Get the const iterator to the last element.
Returns: the const iterator to the last element.
typename ConfigNodeIdMap::iterator find (const ConfigNodeId& node_id)
| find |
Find an element for a given node ID.
Parameters:
node_id | the node ID to search for. |
Returns: the iterator to the element.
typename ConfigNodeIdMap::const_iterator find (const ConfigNodeId& node_id)
| find |
[const]
Find an element for a given node ID.
Parameters:
node_id | the node ID to search for. |
Returns: the const iterator to the element.
pair<iterator, bool> insert (const ConfigNodeId& node_id,
const V& v)
| insert |
Insert a new element.
Parameters:
node_id | the node ID of the element to insert. |
v | the value of the element to insert. |
Returns: true a pair of two values: iterator and a boolean flag. If the boolean flag is true, the element was inserted successfully, and the iterator points to the new element. If the boolean flag is false, then either there is an element with the same node ID, and the iterator points to that element, or the element could not be inserted because of invalid node ID and the iterator points to end() of the container.
pair<iterator, bool> insert_out_of_order (
const ConfigNodeId& node_id, const V& v)
| insert_out_of_order |
Insert a new element that might be out-of-order.
Parameters:
node_id | the node ID of the element to insert. |
v | the value of the element to insert. |
Returns: true a pair of two values: iterator and a boolean flag. If the boolean flag is true, the element was inserted successfully, and the iterator points to the new element. If the boolean flag is false, then there is an element with the same node ID, and the iterator points to that element.
size_t erase (const ConfigNodeId& node_id)
| erase |
Remove an existing element.
Parameters:
node_id | the node ID of the element to remove. |
Returns: the number of removed elements.
void erase (ConfigNodeIdMap::iterator iter)
| erase |
Remove an existing element.
Parameters:
iter | the iterator to the element to remove. |
void clear ()
| clear |
string str ()
| str |
[const]
Convert this object from binary form to presentation format.
Returns: C++ string with the human-readable ASCII representation of the object.
size_t size ()
| size |
[const]
Get the number of elements in the storage.
Returns: the number of elements in the storage.
bool empty ()
| empty |
[const]
Test if the container is empty.
Returns: true if the container is empty, otherwise false.