27 template <
typename KEY,
typename VALUE>
36 typedef typename std::map<KEY,VALUE>::iterator
iterator;
69 void insert(
const KEY &k,
const VALUE &v)
79 bool direct(
const KEY &k, VALUE &out_v)
const
82 if (i==
m_k2v.end())
return false;
88 inline bool hasKey(
const KEY& k)
const {
111 bool inverse(
const VALUE &v, KEY &out_k)
const
114 if (i==
m_v2k.end())
return false;
A bidirectional version of std::map, declared as bimap<KEY,VALUE> and which actually contains two std...
std::map< VALUE, KEY >::const_iterator const_iterator_inverse
bimap()
Default constructor - does nothing.
std::map< KEY, VALUE >::iterator iterator
bool direct(const KEY &k, VALUE &out_v) const
Get the value associated the given key, KEY->VALUE, returning false if not present.
iterator_inverse find_value(const VALUE &v)
std::map< KEY, VALUE >::const_iterator const_iterator
const_iterator begin() const
iterator find_key(const KEY &k)
std::map< KEY, VALUE > m_k2v
const_iterator find_key(const KEY &k) const
bool inverse(const VALUE &v, KEY &out_k) const
Get the key associated the given value, VALUE->KEY, returning false if not present.
const_iterator end() const
VALUE direct(const KEY &k) const
Get the value associated the given key, KEY->VALUE, raising an exception if not present.
bool hasValue(const VALUE &v) const
Return true if the given value 'v' is in the bi-map.
std::map< VALUE, KEY >::iterator iterator_inverse
bool hasKey(const KEY &k) const
Return true if the given key 'k' is in the bi-map.
const std::map< KEY, VALUE > & getDirectMap() const
Return a read-only reference to the internal map KEY->VALUES.
iterator_inverse inverse_end()
const_iterator_inverse inverse_begin() const
iterator_inverse inverse_begin()
const_iterator_inverse inverse_end() const
void insert(const KEY &k, const VALUE &v)
Insert a new pair KEY<->VALUE in the bi-map.
std::map< VALUE, KEY > m_v2k
const_iterator_inverse find_value(const VALUE &v) const
const std::map< VALUE, KEY > & getInverseMap() const
Return a read-only reference to the internal map KEY->VALUES.
KEY inverse(const VALUE &v) const
Get the key associated the given value, VALUE->KEY, raising an exception if not present.
#define THROW_EXCEPTION(msg)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.