All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions
IterableValueMap< GR, K, V > Class Template Reference

Detailed Description

template<typename GR, typename K, typename V>
class lemon::IterableValueMap< GR, K, V >

This class provides a special graph map type which can store a comparable value for graph items (Node, Arc or Edge). For each value it is possible to iterate on the keys mapped to the value (ItemIt), and the values of the map can be accessed with an STL compatible forward iterator (ValueIt). The map stores a linked list for each value, which contains the items mapped to the value, and the used values are stored in balanced binary tree (std::map).

IterableBoolMap and IterableIntMap are similar classes specialized for bool and int values, respectively.

This type is not reference map, so it cannot be modified with the subscript operator.

Template Parameters
GRThe graph type.
KThe key type of the map (GR::Node, GR::Arc or GR::Edge).
VThe value type of the map. It can be any comparable value type.
See Also
IterableBoolMap, IterableIntMap
CrossRefMap

#include <lemon/maps.h>

Inherits Type< GR, K >.

Classes

class  ItemIt
 Iterator for the keys with the same value. More...
 
class  ValueIt
 Forward iterator for values. More...
 

Public Types

typedef K Key
 The key type.
 
typedef V Value
 The value type.
 
typedef GR Graph
 The graph type.
 

Public Member Functions

 IterableValueMap (const Graph &graph, const Value &value=Value())
 
ValueIt beginValue () const
 Returns an iterator to the first value.
 
ValueIt endValue () const
 Returns an iterator after the last value.
 
void set (const Key &key, const Value &value)
 
const Valueoperator[] (const Key &key) const
 

Constructor & Destructor Documentation

IterableValueMap ( const Graph graph,
const Value value = Value() 
)
inlineexplicit

Constructor of the map with a given value.

Member Function Documentation

ValueIt beginValue ( ) const
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.

ValueIt endValue ( ) const
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.

void set ( const Key key,
const Value value 
)
inline

Set operation of the map.

const Value& operator[] ( const Key key) const
inline

Const subscript operator of the map.