A bidirectional version of std::map, declared as bimap<KEY,VALUE> and which actually contains two std::map's, one for keys and another for values.
To use this class, insert new pairs KEY<->VALUE with bimap::insert. Then, you can access the KEY->VALUE map with bimap::direct(), and the VALUE->KEY map with bimap::inverse(). The consistency of the two internal maps is assured at any time.
#include <mrpt/utils/bimap.h>
Public Types | |
typedef std::map< KEY, VALUE > ::const_iterator | const_iterator |
typedef std::map< KEY, VALUE > ::iterator | iterator |
typedef std::map< VALUE, KEY > ::const_iterator | const_iterator_inverse |
typedef std::map< VALUE, KEY > ::iterator | iterator_inverse |
Public Member Functions | |
bimap () | |
Default constructor - does nothing. | |
const_iterator | begin () const |
iterator | begin () |
const_iterator | end () const |
iterator | end () |
const_iterator_inverse | inverse_begin () const |
iterator_inverse | inverse_begin () |
const_iterator_inverse | inverse_end () const |
iterator_inverse | inverse_end () |
size_t | size () const |
bool | empty () const |
const std::map< KEY, VALUE > & | getDirectMap () const |
Return a read-only reference to the internal map KEY->VALUES. | |
const std::map< VALUE, KEY > & | getInverseMap () const |
Return a read-only reference to the internal map KEY->VALUES. | |
void | clear () |
void | insert (const KEY &k, const VALUE &v) |
Insert a new pair KEY<->VALUE in the bi-map. | |
bool | direct (const KEY &k, VALUE &out_v) const |
Get the value associated the given key, KEY->VALUE, returning false if not present. | |
bool | hasKey (const KEY &k) const |
Return true if the given key 'k' is in the bi-map. | |
bool | hasValue (const VALUE &v) const |
Return true if the given value 'v' is in the bi-map. | |
VALUE | direct (const KEY &k) const |
Get the value associated the given key, KEY->VALUE, raising an exception if not present. | |
bool | inverse (const VALUE &v, KEY &out_k) const |
Get the key associated the given value, VALUE->KEY, returning false if not present. | |
KEY | inverse (const VALUE &v) const |
Get the key associated the given value, VALUE->KEY, raising an exception if not present. | |
const_iterator | find_key (const KEY &k) const |
iterator | find_key (const KEY &k) |
const_iterator_inverse | find_value (const VALUE &v) const |
iterator_inverse | find_value (const VALUE &v) |
Private Attributes | |
std::map< KEY, VALUE > | m_k2v |
std::map< VALUE, KEY > | m_v2k |
typedef std::map<KEY,VALUE>::const_iterator mrpt::utils::bimap< KEY, VALUE >::const_iterator |
typedef std::map<VALUE,KEY>::const_iterator mrpt::utils::bimap< KEY, VALUE >::const_iterator_inverse |
typedef std::map<KEY,VALUE>::iterator mrpt::utils::bimap< KEY, VALUE >::iterator |
typedef std::map<VALUE,KEY>::iterator mrpt::utils::bimap< KEY, VALUE >::iterator_inverse |
mrpt::utils::bimap< KEY, VALUE >::bimap | ( | ) | [inline] |
const_iterator mrpt::utils::bimap< KEY, VALUE >::begin | ( | ) | const [inline] |
iterator mrpt::utils::bimap< KEY, VALUE >::begin | ( | ) | [inline] |
void mrpt::utils::bimap< KEY, VALUE >::clear | ( | void | ) | [inline] |
VALUE mrpt::utils::bimap< KEY, VALUE >::direct | ( | const KEY & | k | ) | const [inline] |
bool mrpt::utils::bimap< KEY, VALUE >::direct | ( | const KEY & | k, |
VALUE & | out_v | ||
) | const [inline] |
bool mrpt::utils::bimap< KEY, VALUE >::empty | ( | ) | const [inline] |
iterator mrpt::utils::bimap< KEY, VALUE >::end | ( | ) | [inline] |
const_iterator mrpt::utils::bimap< KEY, VALUE >::end | ( | ) | const [inline] |
const_iterator mrpt::utils::bimap< KEY, VALUE >::find_key | ( | const KEY & | k | ) | const [inline] |
iterator mrpt::utils::bimap< KEY, VALUE >::find_key | ( | const KEY & | k | ) | [inline] |
iterator_inverse mrpt::utils::bimap< KEY, VALUE >::find_value | ( | const VALUE & | v | ) | [inline] |
const_iterator_inverse mrpt::utils::bimap< KEY, VALUE >::find_value | ( | const VALUE & | v | ) | const [inline] |
const std::map<KEY,VALUE>& mrpt::utils::bimap< KEY, VALUE >::getDirectMap | ( | ) | const [inline] |
const std::map<VALUE,KEY>& mrpt::utils::bimap< KEY, VALUE >::getInverseMap | ( | ) | const [inline] |
bool mrpt::utils::bimap< KEY, VALUE >::hasKey | ( | const KEY & | k | ) | const [inline] |
bool mrpt::utils::bimap< KEY, VALUE >::hasValue | ( | const VALUE & | v | ) | const [inline] |
void mrpt::utils::bimap< KEY, VALUE >::insert | ( | const KEY & | k, |
const VALUE & | v | ||
) | [inline] |
Insert a new pair KEY<->VALUE in the bi-map.
Definition at line 88 of file bimap.h.
Referenced by mrpt::utils::TEnumTypeFiller< poses::CPose3DInterpolator::TInterpolatorMethod >::fill(), mrpt::utils::TEnumTypeFiller< slam::CHeightGridMap2D::TMapRepresentation >::fill(), and mrpt::utils::TEnumTypeFiller< slam::CGasConcentrationGridMap2D::TMapRepresentation >::fill().
bool mrpt::utils::bimap< KEY, VALUE >::inverse | ( | const VALUE & | v, |
KEY & | out_k | ||
) | const [inline] |
KEY mrpt::utils::bimap< KEY, VALUE >::inverse | ( | const VALUE & | v | ) | const [inline] |
iterator_inverse mrpt::utils::bimap< KEY, VALUE >::inverse_begin | ( | ) | [inline] |
const_iterator_inverse mrpt::utils::bimap< KEY, VALUE >::inverse_begin | ( | ) | const [inline] |
iterator_inverse mrpt::utils::bimap< KEY, VALUE >::inverse_end | ( | ) | [inline] |
const_iterator_inverse mrpt::utils::bimap< KEY, VALUE >::inverse_end | ( | ) | const [inline] |
size_t mrpt::utils::bimap< KEY, VALUE >::size | ( | ) | const [inline] |
std::map<KEY,VALUE> mrpt::utils::bimap< KEY, VALUE >::m_k2v [private] |
Definition at line 50 of file bimap.h.
Referenced by mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::begin(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::clear(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::direct(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::empty(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::end(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::find_key(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::getDirectMap(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::hasKey(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::insert(), and mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::size().
std::map<VALUE,KEY> mrpt::utils::bimap< KEY, VALUE >::m_v2k [private] |
Definition at line 51 of file bimap.h.
Referenced by mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::clear(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::find_value(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::getInverseMap(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::hasValue(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::insert(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::inverse(), mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::inverse_begin(), and mrpt::utils::bimap< CLandmark::TLandmarkID, unsigned int >::inverse_end().
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011 |