src/lemon/idmappable_graph_extender.h
author alpar
Sat, 30 Oct 2004 18:33:14 +0000
changeset 950 d74557d1f100
permissions -rw-r--r--
- Changes in doc (spell check).
- SmallGraph is a class instead of being a typedef. (For the sake of doxygen.)
     1 // -*- c++ -*-
     2 
     3 #ifndef LEMON_IDMAPPABLE_GRAPH_EXTENDER_H
     4 #define LEMON_IDMAPPABLE_GRAPH_EXTENDER_H
     5 
     6 
     7 namespace lemon {
     8 
     9   template <typename Base> 
    10   class IdMappableGraphExtender : public Base {
    11   public:
    12 
    13     typedef IdMappableGraphExtender Graph;
    14     typedef Base Parent;
    15  
    16     typedef typename Parent::Node Node;
    17     typedef typename Parent::Edge Edge;
    18 
    19 
    20   public:
    21 
    22     class NodeIdMap {
    23     private:
    24       const Graph* graph;
    25 
    26     public:
    27       NodeIdMap(const Graph& g) : graph(&g) {}
    28 
    29       int operator[](const Node& node) const { return graph->id(node); }
    30 
    31       int maxId() const {return graph->maxNodeId(); }
    32 
    33     };
    34 
    35     class EdgeIdMap {
    36     private:
    37       const Graph* graph;
    38 
    39     public:
    40       EdgeIdMap(const Graph& g) : graph(&g) {}
    41 
    42       int operator[](const Edge& edge) const { return graph->id(edge); }
    43 
    44       int maxId() const {return graph->maxEdgeId(); }
    45 
    46     };
    47 
    48   };
    49 
    50 }
    51 
    52 #endif