diff -r 44d495c659b5 -r eb90e3d6bddc lemon/bits/vector_map.h --- a/lemon/bits/vector_map.h Mon Oct 03 14:22:10 2005 +0000 +++ b/lemon/bits/vector_map.h Wed Oct 05 13:15:47 2005 +0000 @@ -44,12 +44,11 @@ /// uses the std::vector to implement the container function. /// /// \param Registry The AlterationNotifier that will notify this map. - /// \param IdMap The IdMap type of the graph items. + /// \param Item The item type of the graph items. /// \param Value The value type of the map. /// /// \author Balazs Dezso - template < typename _Graph, typename _Item, @@ -57,6 +56,8 @@ > class VectorMap : public AlterationNotifier<_Item>::ObserverBase { public: + + typedef True AdaptibleTag; /// The graph type of the map. typedef _Graph Graph; @@ -93,26 +94,27 @@ typedef True FullTypeTag; - /// Constructor to attach the new map into the registry. - - /// It construates a map and attachs it into the registry. + /// \brief Constructor to attach the new map into the registry. + /// + /// It constructs a map and attachs it into the registry. /// It adds all the items of the graph to the map. - VectorMap(const Graph& _g) : graph(&_g) { attach(_g.getNotifier(_Item())); build(); } - /// Constructor uses given value to initialize the map. - - /// It construates a map uses a given value to initialize the map. + /// \brief Constructor uses given value to initialize the map. + /// + /// It constructs a map uses a given value to initialize the map. /// It adds all the items of the graph to the map. - VectorMap(const Graph& _g, const Value& _v) : graph(&_g) { attach(_g.getNotifier(_Item())); container.resize(graph->maxId(_Item()) + 1, _v); } + /// \brief Copy constructor + /// + /// Copy constructor. VectorMap(const VectorMap& _copy) : Parent(), graph(_copy.getGraph()) { if (_copy.attached()) { @@ -121,6 +123,9 @@ } } + /// \brief Destrcutor + /// + /// Destructor. virtual ~VectorMap() { if (attached()) { detach(); @@ -144,29 +149,26 @@ public: - /// The subcript operator. - + /// \brief The subcript operator. + /// /// The subscript operator. The map can be subscripted by the - /// actual items of the graph. - + /// actual items of the graph. Reference operator[](const Key& key) { return container[graph->id(key)]; } - /// The const subcript operator. - + /// \brief The const subcript operator. + /// /// The const subscript operator. The map can be subscripted by the /// actual items of the graph. - ConstReference operator[](const Key& key) const { return container[graph->id(key)]; } - /// The setter function of the map. - + /// \brief The setter function of the map. + /// /// It the same as operator[](key) = value expression. - /// void set(const Key& key, const Value& value) { (*this)[key] = value; } @@ -176,35 +178,33 @@ /// \brief Adds a new key to the map. /// /// It adds a new key to the map. It called by the observer registry - /// and it overrides the add() member function of the observer base. - - void add(const Key& key) { + /// and it overrides the add() member function of the observer base. + virtual void add(const Key& key) { int id = graph->id(key); if (id >= (int)container.size()) { container.resize(id + 1); } } - /// Erases a key from the map. - + /// \brief Erase a key from the map. + /// /// Erase a key from the map. It called by the observer registry /// and it overrides the erase() member function of the observer base. - void erase(const Key&) {} + virtual void erase(const Key&) {} - /// Buildes the map. - + /// \brief Buildes the map. + /// /// It buildes the map. It called by the observer registry /// and it overrides the build() member function of the observer base. - - void build() { + virtual void build() { container.resize(graph->maxId(_Item()) + 1); } - /// Clear the map. - + /// \brief Clear the map. + /// /// It erase all items from the map. It called by the observer registry /// and it overrides the clear() member function of the observer base. - void clear() { + virtual void clear() { container.clear(); }