lemon/bits/vector_map.h
changeset 705 39a5b48bcace
parent 503 9605e051942f
equal deleted inserted replaced
10:ffa537567679 11:e4236ece39cf
    54     typedef std::vector<_Value> Container;
    54     typedef std::vector<_Value> Container;
    55 
    55 
    56   public:
    56   public:
    57 
    57 
    58     // The graph type of the map.
    58     // The graph type of the map.
    59     typedef _Graph Graph;
    59     typedef _Graph GraphType;
    60     // The item type of the map.
    60     // The item type of the map.
    61     typedef _Item Item;
    61     typedef _Item Item;
    62     // The reference map tag.
    62     // The reference map tag.
    63     typedef True ReferenceMapTag;
    63     typedef True ReferenceMapTag;
    64 
    64 
    70     // The notifier type.
    70     // The notifier type.
    71     typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
    71     typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
    72 
    72 
    73     // The map type.
    73     // The map type.
    74     typedef VectorMap Map;
    74     typedef VectorMap Map;
    75     // The base class of the map.
       
    76     typedef typename Notifier::ObserverBase Parent;
       
    77 
    75 
    78     // The reference type of the map;
    76     // The reference type of the map;
    79     typedef typename Container::reference Reference;
    77     typedef typename Container::reference Reference;
    80     // The const reference type of the map;
    78     // The const reference type of the map;
    81     typedef typename Container::const_reference ConstReference;
    79     typedef typename Container::const_reference ConstReference;
    82 
    80 
       
    81   private:
       
    82 
       
    83     // The base class of the map.
       
    84     typedef typename Notifier::ObserverBase Parent;
       
    85 
       
    86   public:
    83 
    87 
    84     // \brief Constructor to attach the new map into the notifier.
    88     // \brief Constructor to attach the new map into the notifier.
    85     //
    89     //
    86     // It constructs a map and attachs it into the notifier.
    90     // It constructs a map and attachs it into the notifier.
    87     // It adds all the items of the graph to the map.
    91     // It adds all the items of the graph to the map.
    88     VectorMap(const Graph& graph) {
    92     VectorMap(const GraphType& graph) {
    89       Parent::attach(graph.notifier(Item()));
    93       Parent::attach(graph.notifier(Item()));
    90       container.resize(Parent::notifier()->maxId() + 1);
    94       container.resize(Parent::notifier()->maxId() + 1);
    91     }
    95     }
    92 
    96 
    93     // \brief Constructor uses given value to initialize the map.
    97     // \brief Constructor uses given value to initialize the map.
    94     //
    98     //
    95     // It constructs a map uses a given value to initialize the map.
    99     // It constructs a map uses a given value to initialize the map.
    96     // It adds all the items of the graph to the map.
   100     // It adds all the items of the graph to the map.
    97     VectorMap(const Graph& graph, const Value& value) {
   101     VectorMap(const GraphType& graph, const Value& value) {
    98       Parent::attach(graph.notifier(Item()));
   102       Parent::attach(graph.notifier(Item()));
    99       container.resize(Parent::notifier()->maxId() + 1, value);
   103       container.resize(Parent::notifier()->maxId() + 1, value);
   100     }
   104     }
   101 
   105 
   102   private:
   106   private: