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. More... | |
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. More... | |
const std::map< VALUE, KEY > & | getInverseMap () const |
Return a read-only reference to the internal map KEY->VALUES. More... | |
void | clear () |
void | insert (const KEY &k, const VALUE &v) |
Insert a new pair KEY<->VALUE in the bi-map. More... | |
bool | direct (const KEY &k, VALUE &out_v) const |
Get the value associated the given key, KEY->VALUE, returning false if not present. More... | |
bool | hasKey (const KEY &k) const |
Return true if the given key 'k' is in the bi-map. More... | |
bool | hasValue (const VALUE &v) const |
Return true if the given value 'v' is in the bi-map. More... | |
VALUE | direct (const KEY &k) const |
Get the value associated the given key, KEY->VALUE, raising an exception if not present. More... | |
bool | inverse (const VALUE &v, KEY &out_k) const |
Get the key associated the given value, VALUE->KEY, returning false if not present. More... | |
KEY | inverse (const VALUE &v) const |
Get the key associated the given value, VALUE->KEY, raising an exception if not present. More... | |
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 |
|
inline |
|
inline |
Definition at line 45 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_k2v.
|
inline |
Definition at line 44 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_k2v.
|
inline |
Definition at line 62 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_k2v, and mrpt::utils::bimap< KEY, VALUE >::m_v2k.
|
inline |
Get the value associated the given key, KEY->VALUE, raising an exception if not present.
std::exception | On key not present in the bi-map. |
Definition at line 100 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_k2v, and THROW_EXCEPTION.
|
inline |
|
inline |
Definition at line 55 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_k2v.
|
inline |
Definition at line 47 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_k2v.
|
inline |
Definition at line 46 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_k2v.
|
inline |
Definition at line 132 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_k2v.
|
inline |
Definition at line 131 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_k2v.
|
inline |
Definition at line 135 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_v2k.
|
inline |
Definition at line 134 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_v2k.
|
inline |
Return a read-only reference to the internal map KEY->VALUES.
Definition at line 58 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_k2v.
|
inline |
Return a read-only reference to the internal map KEY->VALUES.
Definition at line 60 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_v2k.
|
inline |
|
inline |
|
inline |
Insert a new pair KEY<->VALUE in the bi-map.
Definition at line 69 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_k2v, and mrpt::utils::bimap< KEY, VALUE >::m_v2k.
Referenced by mrpt::utils::TEnumTypeFiller< poses::CPose3DInterpolator::TInterpolatorMethod >::fill(), mrpt::utils::TEnumTypeFiller< bayes::TKFMethod >::fill(), mrpt::utils::TEnumTypeFiller< hwdrivers::CGPSInterface::PARSERS >::fill(), mrpt::utils::TEnumTypeFiller< hwdrivers::CKinect::TVideoChannel >::fill(), mrpt::utils::TEnumTypeFiller< hwdrivers::CVelodyneScanner::model_t >::fill(), mrpt::utils::TEnumTypeFiller< maps::CHeightGridMap2D::TMapRepresentation >::fill(), mrpt::utils::TEnumTypeFiller< maps::CRandomFieldGridMap2D::TMapRepresentation >::fill(), mrpt::utils::TEnumTypeFiller< nav::THolonomicMethod >::fill(), mrpt::utils::TEnumTypeFiller< nav::CHolonomicND::TSituations >::fill(), mrpt::utils::TEnumTypeFiller< mrpt::obs::CObservation3DRangeScan::TIntensityChannelID >::fill(), mrpt::utils::TEnumTypeFiller< slam::CGridMapAligner::TAlignerMethod >::fill(), mrpt::utils::TEnumTypeFiller< slam::TICPAlgorithm >::fill(), mrpt::utils::TEnumTypeFiller< slam::TICPCovarianceMethod >::fill(), mrpt::utils::TEnumTypeFiller< slam::TDataAssociationMethod >::fill(), and mrpt::utils::TEnumTypeFiller< slam::TDataAssociationMetric >::fill().
|
inline |
Get the key associated the given value, VALUE->KEY, raising an exception if not present.
Definition at line 123 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_v2k, and THROW_EXCEPTION.
|
inline |
|
inline |
Definition at line 50 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_v2k.
|
inline |
Definition at line 49 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_v2k.
|
inline |
Definition at line 52 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_v2k.
|
inline |
Definition at line 51 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_v2k.
|
inline |
Definition at line 54 of file bimap.h.
References mrpt::utils::bimap< KEY, VALUE >::m_k2v.
|
private |
Definition at line 31 of file bimap.h.
Referenced by mrpt::utils::bimap< KEY, VALUE >::begin(), mrpt::utils::bimap< KEY, VALUE >::clear(), mrpt::utils::bimap< KEY, VALUE >::direct(), mrpt::utils::bimap< KEY, VALUE >::empty(), mrpt::utils::bimap< KEY, VALUE >::end(), mrpt::utils::bimap< KEY, VALUE >::find_key(), mrpt::utils::bimap< KEY, VALUE >::getDirectMap(), mrpt::utils::bimap< KEY, VALUE >::hasKey(), mrpt::utils::bimap< KEY, VALUE >::insert(), and mrpt::utils::bimap< KEY, VALUE >::size().
|
private |
Definition at line 32 of file bimap.h.
Referenced by mrpt::utils::bimap< KEY, VALUE >::clear(), mrpt::utils::bimap< KEY, VALUE >::find_value(), mrpt::utils::bimap< KEY, VALUE >::getInverseMap(), mrpt::utils::bimap< KEY, VALUE >::hasValue(), mrpt::utils::bimap< KEY, VALUE >::insert(), mrpt::utils::bimap< KEY, VALUE >::inverse(), mrpt::utils::bimap< KEY, VALUE >::inverse_begin(), and mrpt::utils::bimap< KEY, VALUE >::inverse_end().
Page generated by Doxygen 1.9.5 for MRPT 1.4.0 SVN: at Sun Nov 27 02:47:40 UTC 2022 |