This class provides simple invertable graph maps. It wraps a standard graph map (NodeMap
, ArcMap
or EdgeMap
) and if a key is set to a new value, then stores it in the inverse map. The values of the map can be accessed with stl compatible forward iterator.
This type is not reference map, so it cannot be modified with the subscript operator.
GR | The graph type. |
K | The key type of the map (GR::Node , GR::Arc or GR::Edge ). |
V | The value type of the map. |
#include <lemon/maps.h>
Inherits Type< GR, K >.
Classes | |
class | InverseMap |
The inverse map type. More... | |
class | ValueIterator |
Forward iterator for values. More... | |
Public Types | |
typedef GR | Graph |
The graph type of CrossRefMap. | |
typedef K | Item |
The key type of CrossRefMap (Node , Arc or Edge ). | |
typedef K | Key |
The key type of CrossRefMap (Node , Arc or Edge ). | |
typedef V | Value |
The value type of CrossRefMap. | |
Public Member Functions | |
CrossRefMap (const Graph &graph) | |
Constructor. | |
ValueIterator | beginValue () const |
Returns an iterator to the first value. | |
ValueIterator | endValue () const |
Returns an iterator after the last value. | |
void | set (const Key &key, const Value &val) |
MapTraits< Map >::ConstReturnValue | operator[] (const Key &key) const |
Key | operator() (const Value &val) const |
Gives back an item by its value. | |
InverseMap | inverse () const |
Protected Member Functions | |
virtual void | erase (const Key &key) |
Erase the key from the map and the inverse map. | |
virtual void | erase (const std::vector< Key > &keys) |
Erase more keys from the map and the inverse map. | |
virtual void | clear () |
Clear the keys from the map and the inverse map. | |
|
inlineexplicit |
Construct a new CrossRefMap for the given graph.
|
inline |
Returns an stl compatible iterator to the first value of the map. The values of the map can be accessed in the [beginValue, endValue)
range.
|
inline |
Returns an stl compatible iterator after the last value of the map. The values of the map can be accessed in the [beginValue, endValue)
range.
Sets the value associated with the given key.
|
inline |
Returns the value associated with the given key.
This function gives back an item that is assigned to the given value or INVALID
if no such item exists. If there are more items with the same associated value, only one of them is returned.
|
inlineprotectedvirtual |
Erase the key from the map and the inverse map. It is called by the AlterationNotifier
.
|
inlineprotectedvirtual |
Erase more keys from the map and the inverse map. It is called by the AlterationNotifier
.
|
inlineprotectedvirtual |
Clear the keys from the map and the inverse map. It is called by the AlterationNotifier
.
|
inline |
It gives back the read-only inverse map.