Flow123d
release_3.0.0-973-g92f55e826
|
Bidirectional map templated by <T, unsigned int>. More...
#include <bidirectional_map.hh>
Public Member Functions | |
BidirectionalMap () | |
Constructor. More... | |
unsigned int | size () const |
Return size of map. More... | |
void | set_item (T val, unsigned int pos) |
unsigned int | add_item (T val) |
Add new item at the end position of map. More... | |
int | get_position (T val) const |
Return position of item of given value. More... | |
void | reinit (unsigned int init_size=0) |
Reset data of map, allow reserve size. More... | |
void | resize (unsigned int new_size) |
Reset data of map, reserve space for given size. More... | |
T | operator[] (unsigned int pos) const |
Return value on given position. More... | |
Private Attributes | |
std::vector< T > | vals_vec_ |
Space to save values. More... | |
std::map< T, unsigned int > | vals_map_ |
Maps values to indexes into vals_vec_. More... | |
Bidirectional map templated by <T, unsigned int>.
Store pairs of value and its position (index) and allow bidirectional search. Items of both (values, positions) must be unique.
Definition at line 33 of file bidirectional_map.hh.
|
inline |
Constructor.
Definition at line 73 of file bidirectional_map.hh.
|
inline |
Add new item at the end position of map.
Definition at line 95 of file bidirectional_map.hh.
|
inline |
Return position of item of given value.
Definition at line 103 of file bidirectional_map.hh.
|
inline |
Return value on given position.
Definition at line 129 of file bidirectional_map.hh.
|
inline |
Reset data of map, allow reserve size.
Definition at line 110 of file bidirectional_map.hh.
|
inline |
Reset data of map, reserve space for given size.
Resizes to given new_size
if new size is smaller than the actual. The rest of data are thrown away and removed from the map.
Definition at line 118 of file bidirectional_map.hh.
|
inline |
Set value of given position.
Position must be in interval set in reinit
method <0, init_size-1>. Element on every position can be set only once.
Definition at line 82 of file bidirectional_map.hh.
|
inline |
Return size of map.
Definition at line 77 of file bidirectional_map.hh.
|
private |
Maps values to indexes into vals_vec_.
Definition at line 68 of file bidirectional_map.hh.
|
private |
Space to save values.
Definition at line 67 of file bidirectional_map.hh.