src/lemon/vector_map.h
changeset 937 d4e911acef3d
parent 921 818510fa3d99
child 946 c94ef40a22ce
     1.1 --- a/src/lemon/vector_map.h	Mon Oct 04 16:03:25 2004 +0000
     1.2 +++ b/src/lemon/vector_map.h	Mon Oct 04 17:13:21 2004 +0000
     1.3 @@ -31,18 +31,16 @@
     1.4    /// \addtogroup graphmaps
     1.5    /// @{
     1.6    
     1.7 -  /** The ArrayMap template class is graph map structure what
     1.8 +  /** The VectorMap template class is graph map structure what
     1.9     *  automatically updates the map when a key is added to or erased from
    1.10     *  the map. This map factory uses the allocators to implement 
    1.11     *  the container functionality. This map factory
    1.12     *  uses the std::vector to implement the container function.
    1.13     *
    1.14 -   *  The template parameter is the MapRegistry that the maps
    1.15 -   *  will belong to and the ValueType.
    1.16 +   *  \param MapRegistry The MapRegistry that the maps will belong to.
    1.17 +   *  \param Value The value type of the map.
    1.18     * 
    1.19 -   * \todo It should use a faster initialization using the maxNodeId() or
    1.20 -   * maxEdgeId() function of the graph instead of iterating through each
    1.21 -   * edge/node.
    1.22 +   *  \author Balazs Dezso
    1.23     */
    1.24  	
    1.25    template <typename MapRegistry, typename Value>
    1.26 @@ -84,17 +82,27 @@
    1.27      /// The pointer type of the map;
    1.28      typedef typename Container::const_pointer ConstPointerType;
    1.29  
    1.30 -    /** Graph and Registry initialized map constructor.
    1.31 +    /// Constructor to attach the new map into a registry.
    1.32 +
    1.33 +    /** Constructor to attach the new map into a registry.
    1.34 +     *  It adds all the nodes or edges of the graph to the map.
    1.35       */
    1.36      VectorMap(const Graph& g, MapRegistry& r) 
    1.37        : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1) {}
    1.38  
    1.39 -    /** Constructor to use default value to initialize the map. 
    1.40 +    /// Constructor uses given value to initialize the map. 
    1.41 +
    1.42 +    /** Constructor uses given value to initialize the map. 
    1.43 +     *  It adds all the nodes or edges of the graph to the map.
    1.44       */
    1.45      VectorMap(const Graph& g, MapRegistry& r, const Value& v) 
    1.46        : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1, v) {}
    1.47  
    1.48 +    /// Assign operator to copy a map of an other map type.
    1.49 +
    1.50      /** Assign operator to copy a map of an other map type.
    1.51 +     *  This map's value type must be assignable by the other
    1.52 +     *  map type's value type.
    1.53       */
    1.54      template <typename TT>
    1.55      VectorMap(const VectorMap<MapRegistry, TT>& c) 
    1.56 @@ -105,7 +113,11 @@
    1.57        }
    1.58      }
    1.59  
    1.60 +    /// Assign operator to copy a map of an other map type.
    1.61 +
    1.62      /** Assign operator to copy a map of an other map type.
    1.63 +     *  This map's value type must be assignable by the other
    1.64 +     *  map type's value type.
    1.65       */
    1.66      template <typename TT>
    1.67      VectorMap& operator=(const VectorMap<MapRegistry, TT>& c) {
    1.68 @@ -119,6 +131,9 @@
    1.69        }
    1.70        return *this;
    1.71      }
    1.72 +
    1.73 +    /// The subcript operator.
    1.74 +
    1.75      /**
    1.76       * The subscript operator. The map can be subscripted by the
    1.77       * actual keys of the graph. 
    1.78 @@ -128,6 +143,8 @@
    1.79        return container[id];
    1.80      } 
    1.81  		
    1.82 +    /// The const subcript operator.
    1.83 +
    1.84      /**
    1.85       * The const subscript operator. The map can be subscripted by the
    1.86       * actual keys of the graph. 
    1.87 @@ -137,6 +154,8 @@
    1.88        return container[id];
    1.89      }
    1.90  
    1.91 +    ///Setter function of the map.
    1.92 +
    1.93      /** Setter function of the map. Equivalent with map[key] = val.
    1.94       *  This is a compatibility feature with the not dereferable maps.
    1.95       */
    1.96 @@ -144,8 +163,11 @@
    1.97        int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
    1.98        container[id] = val;
    1.99      }
   1.100 +    /// Adds a new key to the map.
   1.101  		
   1.102 -    /** Add a new key to the map. It called by the map registry.
   1.103 +    /** Adds a new key to the map. It called by the map registry
   1.104 +     *  and it overrides the \ref MapRegistry::MapBase MapBase's
   1.105 +     *  add() member function.
   1.106       */
   1.107      void add(const KeyType& key) {
   1.108        int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
   1.109 @@ -153,13 +175,22 @@
   1.110  	container.resize(id + 1);
   1.111        }
   1.112      }
   1.113 +
   1.114 +    /// Erases a key from the map.
   1.115  		
   1.116 -    /** Erase a key from the map. It called by the map registry.
   1.117 +    /** Erase a key from the map. It called by the map registry 
   1.118 +     *  and it overrides the \ref MapRegistry::MapBase MapBase's
   1.119 +     *  erase() member function.
   1.120       */
   1.121      void erase(const KeyType& key) {}
   1.122  
   1.123 -    /** Clear the data structure.
   1.124 +    /// Makes empty the map.
   1.125 +
   1.126 +    /** Makes empty the map. It called by the map registry 
   1.127 +     *  and it overrides the \ref MapRegistry::MapBase MapBase's
   1.128 +     *  clear() member function.
   1.129       */
   1.130 +
   1.131      void clear() { 
   1.132        container.clear();
   1.133      }