diff -r 44d495c659b5 -r eb90e3d6bddc lemon/bits/array_map.h --- a/lemon/bits/array_map.h Mon Oct 03 14:22:10 2005 +0000 +++ b/lemon/bits/array_map.h Wed Oct 05 13:15:47 2005 +0000 @@ -48,6 +48,7 @@ typedef _Item Item; public: + typedef True AdaptibleTag; /// The graph type of the maps. typedef _Graph Graph; @@ -69,6 +70,8 @@ public: + /// \brief Graph and Registry initialized map constructor. + /// /// Graph and Registry initialized map constructor. ArrayMap(const Graph& _g) : graph(&_g) { Item it; @@ -80,10 +83,9 @@ } } - /// Constructor to use default value to initialize the map. - - /// It constrates a map and initialize all of the the map. - + /// \brief Constructor to use default value to initialize the map. + /// + /// It constructs a map and initialize all of the the map. ArrayMap(const Graph& _g, const Value& _v) : graph(&_g) { Item it; attach(_g.getNotifier(_Item())); @@ -94,8 +96,9 @@ } } - /// Constructor to copy a map of the same map type. - + /// \brief Constructor to copy a map of the same map type. + /// + /// Constructor to copy a map of the same map type. ArrayMap(const ArrayMap& copy) : Parent(), graph(copy.graph) { if (copy.attached()) { attach(*copy.getRegistry()); @@ -137,35 +140,37 @@ public: - ///The subscript operator. The map can be subscripted by the - ///actual keys of the graph. - + /// \brief The subscript operator. + /// + /// The subscript operator. The map can be subscripted by the + /// actual keys of the graph. Value& operator[](const Key& key) { int id = graph->id(key); return values[id]; } - - ///The const subscript operator. The map can be subscripted by the - ///actual keys of the graph. - + /// \brief The const subscript operator. + /// + /// The const subscript operator. The map can be subscripted by the + /// actual keys of the graph. const Value& operator[](const Key& key) const { int id = graph->id(key); return values[id]; } - + + /// \brief Setter function of the map. + /// /// Setter function of the map. Equivalent with map[key] = val. /// This is a compatibility feature with the not dereferable maps. - void set(const Key& key, const Value& val) { (*this)[key] = val; } protected: - + /// Add a new key to the map. It called by the map registry. - - void add(const Key& key) { + + virtual void add(const Key& key) { int id = graph->id(key); if (id >= capacity) { int new_capacity = (capacity == 0 ? 1 : capacity); @@ -188,7 +193,7 @@ allocator.construct(&(values[id]), Value()); } - void add(const std::vector& keys) { + virtual void add(const std::vector& keys) { int max_id = -1; for (int i = 0; i < (int)keys.size(); ++i) { int id = graph->id(keys[i]); @@ -229,19 +234,19 @@ /// Erase a key from the map. It called by the map registry. - void erase(const Key& key) { + virtual void erase(const Key& key) { int id = graph->id(key); allocator.destroy(&(values[id])); } - void erase(const std::vector& keys) { + virtual void erase(const std::vector& keys) { for (int i = 0; i < (int)keys.size(); ++i) { int id = graph->id(keys[i]); allocator.destroy(&(values[id])); } } - void build() { + virtual void build() { allocate_memory(); Item it; for (graph->first(it); it != INVALID; graph->next(it)) { @@ -250,7 +255,7 @@ } } - void clear() { + virtual void clear() { if (capacity != 0) { Item it; for (graph->first(it); it != INVALID; graph->next(it)) {