lemon/bits/vector_map.h
changeset 315 c175e387da19
parent 280 e7f8647ce760
child 361 f58410582b9b
     1.1 --- a/lemon/bits/vector_map.h	Thu Oct 09 13:40:40 2008 +0100
     1.2 +++ b/lemon/bits/vector_map.h	Thu Oct 09 13:54:50 2008 +0100
     1.3 @@ -28,81 +28,81 @@
     1.4  #include <lemon/concept_check.h>
     1.5  #include <lemon/concepts/maps.h>
     1.6  
     1.7 -///\ingroup graphbits
     1.8 -///
     1.9 -///\file
    1.10 -///\brief Vector based graph maps.
    1.11 +//\ingroup graphbits
    1.12 +//
    1.13 +//\file
    1.14 +//\brief Vector based graph maps.
    1.15  namespace lemon {
    1.16  
    1.17 -  /// \ingroup graphbits
    1.18 -  ///
    1.19 -  /// \brief Graph map based on the std::vector storage.
    1.20 -  ///
    1.21 -  /// The VectorMap template class is graph map structure what
    1.22 -  /// automatically updates the map when a key is added to or erased from
    1.23 -  /// the map. This map type uses the std::vector to store the values.
    1.24 -  ///
    1.25 -  /// \tparam _Graph The graph this map is attached to.
    1.26 -  /// \tparam _Item The item type of the graph items.
    1.27 -  /// \tparam _Value The value type of the map.
    1.28 +  // \ingroup graphbits
    1.29 +  //
    1.30 +  // \brief Graph map based on the std::vector storage.
    1.31 +  //
    1.32 +  // The VectorMap template class is graph map structure what
    1.33 +  // automatically updates the map when a key is added to or erased from
    1.34 +  // the map. This map type uses the std::vector to store the values.
    1.35 +  //
    1.36 +  // \tparam _Graph The graph this map is attached to.
    1.37 +  // \tparam _Item The item type of the graph items.
    1.38 +  // \tparam _Value The value type of the map.
    1.39    template <typename _Graph, typename _Item, typename _Value>
    1.40    class VectorMap
    1.41      : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
    1.42    private:
    1.43  
    1.44 -    /// The container type of the map.
    1.45 +    // The container type of the map.
    1.46      typedef std::vector<_Value> Container;
    1.47  
    1.48    public:
    1.49  
    1.50 -    /// The graph type of the map.
    1.51 +    // The graph type of the map.
    1.52      typedef _Graph Graph;
    1.53 -    /// The item type of the map.
    1.54 +    // The item type of the map.
    1.55      typedef _Item Item;
    1.56 -    /// The reference map tag.
    1.57 +    // The reference map tag.
    1.58      typedef True ReferenceMapTag;
    1.59  
    1.60 -    /// The key type of the map.
    1.61 +    // The key type of the map.
    1.62      typedef _Item Key;
    1.63 -    /// The value type of the map.
    1.64 +    // The value type of the map.
    1.65      typedef _Value Value;
    1.66  
    1.67 -    /// The notifier type.
    1.68 +    // The notifier type.
    1.69      typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
    1.70  
    1.71 -    /// The map type.
    1.72 +    // The map type.
    1.73      typedef VectorMap Map;
    1.74 -    /// The base class of the map.
    1.75 +    // The base class of the map.
    1.76      typedef typename Notifier::ObserverBase Parent;
    1.77  
    1.78 -    /// The reference type of the map;
    1.79 +    // The reference type of the map;
    1.80      typedef typename Container::reference Reference;
    1.81 -    /// The const reference type of the map;
    1.82 +    // The const reference type of the map;
    1.83      typedef typename Container::const_reference ConstReference;
    1.84  
    1.85  
    1.86 -    /// \brief Constructor to attach the new map into the notifier.
    1.87 -    ///
    1.88 -    /// It constructs a map and attachs it into the notifier.
    1.89 -    /// It adds all the items of the graph to the map.
    1.90 +    // \brief Constructor to attach the new map into the notifier.
    1.91 +    //
    1.92 +    // It constructs a map and attachs it into the notifier.
    1.93 +    // It adds all the items of the graph to the map.
    1.94      VectorMap(const Graph& graph) {
    1.95        Parent::attach(graph.notifier(Item()));
    1.96        container.resize(Parent::notifier()->maxId() + 1);
    1.97      }
    1.98  
    1.99 -    /// \brief Constructor uses given value to initialize the map.
   1.100 -    ///
   1.101 -    /// It constructs a map uses a given value to initialize the map.
   1.102 -    /// It adds all the items of the graph to the map.
   1.103 +    // \brief Constructor uses given value to initialize the map.
   1.104 +    //
   1.105 +    // It constructs a map uses a given value to initialize the map.
   1.106 +    // It adds all the items of the graph to the map.
   1.107      VectorMap(const Graph& graph, const Value& value) {
   1.108        Parent::attach(graph.notifier(Item()));
   1.109        container.resize(Parent::notifier()->maxId() + 1, value);
   1.110      }
   1.111  
   1.112    private:
   1.113 -    /// \brief Copy constructor
   1.114 -    ///
   1.115 -    /// Copy constructor.
   1.116 +    // \brief Copy constructor
   1.117 +    //
   1.118 +    // Copy constructor.
   1.119      VectorMap(const VectorMap& _copy) : Parent() {
   1.120        if (_copy.attached()) {
   1.121          Parent::attach(*_copy.notifier());
   1.122 @@ -110,24 +110,24 @@
   1.123        }
   1.124      }
   1.125  
   1.126 -    /// \brief Assign operator.
   1.127 -    ///
   1.128 -    /// This operator assigns for each item in the map the
   1.129 -    /// value mapped to the same item in the copied map.
   1.130 -    /// The parameter map should be indiced with the same
   1.131 -    /// itemset because this assign operator does not change
   1.132 -    /// the container of the map.
   1.133 +    // \brief Assign operator.
   1.134 +    //
   1.135 +    // This operator assigns for each item in the map the
   1.136 +    // value mapped to the same item in the copied map.
   1.137 +    // The parameter map should be indiced with the same
   1.138 +    // itemset because this assign operator does not change
   1.139 +    // the container of the map.
   1.140      VectorMap& operator=(const VectorMap& cmap) {
   1.141        return operator=<VectorMap>(cmap);
   1.142      }
   1.143  
   1.144  
   1.145 -    /// \brief Template assign operator.
   1.146 -    ///
   1.147 -    /// The given parameter should be conform to the ReadMap
   1.148 -    /// concecpt and could be indiced by the current item set of
   1.149 -    /// the NodeMap. In this case the value for each item
   1.150 -    /// is assigned by the value of the given ReadMap.
   1.151 +    // \brief Template assign operator.
   1.152 +    //
   1.153 +    // The given parameter should be conform to the ReadMap
   1.154 +    // concecpt and could be indiced by the current item set of
   1.155 +    // the NodeMap. In this case the value for each item
   1.156 +    // is assigned by the value of the given ReadMap.
   1.157      template <typename CMap>
   1.158      VectorMap& operator=(const CMap& cmap) {
   1.159        checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
   1.160 @@ -141,36 +141,36 @@
   1.161  
   1.162    public:
   1.163  
   1.164 -    /// \brief The subcript operator.
   1.165 -    ///
   1.166 -    /// The subscript operator. The map can be subscripted by the
   1.167 -    /// actual items of the graph.
   1.168 +    // \brief The subcript operator.
   1.169 +    //
   1.170 +    // The subscript operator. The map can be subscripted by the
   1.171 +    // actual items of the graph.
   1.172      Reference operator[](const Key& key) {
   1.173        return container[Parent::notifier()->id(key)];
   1.174      }
   1.175  
   1.176 -    /// \brief The const subcript operator.
   1.177 -    ///
   1.178 -    /// The const subscript operator. The map can be subscripted by the
   1.179 -    /// actual items of the graph.
   1.180 +    // \brief The const subcript operator.
   1.181 +    //
   1.182 +    // The const subscript operator. The map can be subscripted by the
   1.183 +    // actual items of the graph.
   1.184      ConstReference operator[](const Key& key) const {
   1.185        return container[Parent::notifier()->id(key)];
   1.186      }
   1.187  
   1.188  
   1.189 -    /// \brief The setter function of the map.
   1.190 -    ///
   1.191 -    /// It the same as operator[](key) = value expression.
   1.192 +    // \brief The setter function of the map.
   1.193 +    //
   1.194 +    // It the same as operator[](key) = value expression.
   1.195      void set(const Key& key, const Value& value) {
   1.196        (*this)[key] = value;
   1.197      }
   1.198  
   1.199    protected:
   1.200  
   1.201 -    /// \brief Adds a new key to the map.
   1.202 -    ///
   1.203 -    /// It adds a new key to the map. It called by the observer notifier
   1.204 -    /// and it overrides the add() member function of the observer base.
   1.205 +    // \brief Adds a new key to the map.
   1.206 +    //
   1.207 +    // It adds a new key to the map. It called by the observer notifier
   1.208 +    // and it overrides the add() member function of the observer base.
   1.209      virtual void add(const Key& key) {
   1.210        int id = Parent::notifier()->id(key);
   1.211        if (id >= int(container.size())) {
   1.212 @@ -178,10 +178,10 @@
   1.213        }
   1.214      }
   1.215  
   1.216 -    /// \brief Adds more new keys to the map.
   1.217 -    ///
   1.218 -    /// It adds more new keys to the map. It called by the observer notifier
   1.219 -    /// and it overrides the add() member function of the observer base.
   1.220 +    // \brief Adds more new keys to the map.
   1.221 +    //
   1.222 +    // It adds more new keys to the map. It called by the observer notifier
   1.223 +    // and it overrides the add() member function of the observer base.
   1.224      virtual void add(const std::vector<Key>& keys) {
   1.225        int max = container.size() - 1;
   1.226        for (int i = 0; i < int(keys.size()); ++i) {
   1.227 @@ -193,38 +193,38 @@
   1.228        container.resize(max + 1);
   1.229      }
   1.230  
   1.231 -    /// \brief Erase a key from the map.
   1.232 -    ///
   1.233 -    /// Erase a key from the map. It called by the observer notifier
   1.234 -    /// and it overrides the erase() member function of the observer base.
   1.235 +    // \brief Erase a key from the map.
   1.236 +    //
   1.237 +    // Erase a key from the map. It called by the observer notifier
   1.238 +    // and it overrides the erase() member function of the observer base.
   1.239      virtual void erase(const Key& key) {
   1.240        container[Parent::notifier()->id(key)] = Value();
   1.241      }
   1.242  
   1.243 -    /// \brief Erase more keys from the map.
   1.244 -    ///
   1.245 -    /// Erase more keys from the map. It called by the observer notifier
   1.246 -    /// and it overrides the erase() member function of the observer base.
   1.247 +    // \brief Erase more keys from the map.
   1.248 +    //
   1.249 +    // Erase more keys from the map. It called by the observer notifier
   1.250 +    // and it overrides the erase() member function of the observer base.
   1.251      virtual void erase(const std::vector<Key>& keys) {
   1.252        for (int i = 0; i < int(keys.size()); ++i) {
   1.253          container[Parent::notifier()->id(keys[i])] = Value();
   1.254        }
   1.255      }
   1.256  
   1.257 -    /// \brief Buildes the map.
   1.258 -    ///
   1.259 -    /// It buildes the map. It called by the observer notifier
   1.260 -    /// and it overrides the build() member function of the observer base.
   1.261 +    // \brief Buildes the map.
   1.262 +    //
   1.263 +    // It buildes the map. It called by the observer notifier
   1.264 +    // and it overrides the build() member function of the observer base.
   1.265      virtual void build() {
   1.266        int size = Parent::notifier()->maxId() + 1;
   1.267        container.reserve(size);
   1.268        container.resize(size);
   1.269      }
   1.270  
   1.271 -    /// \brief Clear the map.
   1.272 -    ///
   1.273 -    /// It erase all items from the map. It called by the observer notifier
   1.274 -    /// and it overrides the clear() member function of the observer base.
   1.275 +    // \brief Clear the map.
   1.276 +    //
   1.277 +    // It erase all items from the map. It called by the observer notifier
   1.278 +    // and it overrides the clear() member function of the observer base.
   1.279      virtual void clear() {
   1.280        container.clear();
   1.281      }