lemon/bits/array_map.h
changeset 1703 eb90e3d6bddc
parent 1669 66ae78d29f1e
child 1719 674182524bd9
     1.1 --- a/lemon/bits/array_map.h	Mon Oct 03 14:22:10 2005 +0000
     1.2 +++ b/lemon/bits/array_map.h	Wed Oct 05 13:15:47 2005 +0000
     1.3 @@ -48,6 +48,7 @@
     1.4  
     1.5      typedef _Item Item;
     1.6    public:
     1.7 +    typedef True AdaptibleTag;
     1.8  		
     1.9      /// The graph type of the maps. 
    1.10      typedef _Graph Graph;
    1.11 @@ -69,6 +70,8 @@
    1.12  
    1.13    public:
    1.14  
    1.15 +    /// \brief Graph and Registry initialized map constructor.
    1.16 +    ///
    1.17      /// Graph and Registry initialized map constructor.
    1.18      ArrayMap(const Graph& _g) : graph(&_g) {
    1.19        Item it;
    1.20 @@ -80,10 +83,9 @@
    1.21        }								
    1.22      }
    1.23  
    1.24 -    /// Constructor to use default value to initialize the map. 
    1.25 -
    1.26 -    /// It constrates a map and initialize all of the the map. 
    1.27 -
    1.28 +    /// \brief Constructor to use default value to initialize the map. 
    1.29 +    ///
    1.30 +    /// It constructs a map and initialize all of the the map. 
    1.31      ArrayMap(const Graph& _g, const Value& _v) : graph(&_g) {
    1.32        Item it;
    1.33        attach(_g.getNotifier(_Item()));
    1.34 @@ -94,8 +96,9 @@
    1.35        }								
    1.36      }
    1.37  
    1.38 -    /// Constructor to copy a map of the same map type.
    1.39 -     
    1.40 +    /// \brief Constructor to copy a map of the same map type.
    1.41 +    ///
    1.42 +    /// Constructor to copy a map of the same map type.     
    1.43      ArrayMap(const ArrayMap& copy) : Parent(), graph(copy.graph) {
    1.44        if (copy.attached()) {
    1.45  	attach(*copy.getRegistry());
    1.46 @@ -137,35 +140,37 @@
    1.47  
    1.48    public:
    1.49  
    1.50 -    ///The subscript operator. The map can be subscripted by the
    1.51 -    ///actual keys of the graph. 
    1.52 -     
    1.53 +    /// \brief The subscript operator. 
    1.54 +    ///
    1.55 +    /// The subscript operator. The map can be subscripted by the
    1.56 +    /// actual keys of the graph. 
    1.57      Value& operator[](const Key& key) {
    1.58        int id = graph->id(key);
    1.59        return values[id];
    1.60      } 
    1.61  		
    1.62 -
    1.63 -    ///The const subscript operator. The map can be subscripted by the
    1.64 -    ///actual keys of the graph. 
    1.65 -     
    1.66 +    /// \brief The const subscript operator.
    1.67 +    ///
    1.68 +    /// The const subscript operator. The map can be subscripted by the
    1.69 +    /// actual keys of the graph. 
    1.70      const Value& operator[](const Key& key) const {
    1.71        int id = graph->id(key);
    1.72        return values[id];
    1.73      }
    1.74 -	
    1.75 +
    1.76 +    /// \brief Setter function of the map.
    1.77 +    ///	
    1.78      /// Setter function of the map. Equivalent with map[key] = val.
    1.79      /// This is a compatibility feature with the not dereferable maps.
    1.80 -     
    1.81      void set(const Key& key, const Value& val) {
    1.82        (*this)[key] = val;
    1.83      }
    1.84  
    1.85    protected:
    1.86 -    
    1.87 +
    1.88      /// Add a new key to the map. It called by the map registry.
    1.89 -     
    1.90 -    void add(const Key& key) {
    1.91 +         
    1.92 +    virtual void add(const Key& key) {
    1.93        int id = graph->id(key);
    1.94        if (id >= capacity) {
    1.95  	int new_capacity = (capacity == 0 ? 1 : capacity);
    1.96 @@ -188,7 +193,7 @@
    1.97        allocator.construct(&(values[id]), Value());
    1.98      }
    1.99  
   1.100 -    void add(const std::vector<Key>& keys) {
   1.101 +    virtual void add(const std::vector<Key>& keys) {
   1.102        int max_id = -1;
   1.103        for (int i = 0; i < (int)keys.size(); ++i) {
   1.104  	int id = graph->id(keys[i]);
   1.105 @@ -229,19 +234,19 @@
   1.106  		
   1.107      /// Erase a key from the map. It called by the map registry.
   1.108       
   1.109 -    void erase(const Key& key) {
   1.110 +    virtual void erase(const Key& key) {
   1.111        int id = graph->id(key);
   1.112        allocator.destroy(&(values[id]));
   1.113      }
   1.114  
   1.115 -    void erase(const std::vector<Key>& keys) {
   1.116 +    virtual void erase(const std::vector<Key>& keys) {
   1.117        for (int i = 0; i < (int)keys.size(); ++i) {
   1.118  	int id = graph->id(keys[i]);
   1.119  	allocator.destroy(&(values[id]));
   1.120        }
   1.121      }
   1.122  
   1.123 -    void build() {
   1.124 +    virtual void build() {
   1.125        allocate_memory();
   1.126        Item it;
   1.127        for (graph->first(it); it != INVALID; graph->next(it)) {
   1.128 @@ -250,7 +255,7 @@
   1.129        }								
   1.130      }
   1.131  
   1.132 -    void clear() {	
   1.133 +    virtual void clear() {	
   1.134        if (capacity != 0) {
   1.135  	Item it;
   1.136  	for (graph->first(it); it != INVALID; graph->next(it)) {