diff -r 64f8f7cc6168 -r 2cc60866a0c9 lemon/bits/vector_map.h --- a/lemon/bits/vector_map.h Thu Oct 09 10:09:44 2008 +0200 +++ b/lemon/bits/vector_map.h Thu Oct 09 13:27:35 2008 +0200 @@ -28,81 +28,81 @@ #include #include -///\ingroup graphbits -/// -///\file -///\brief Vector based graph maps. +//\ingroup graphbits +// +//\file +//\brief Vector based graph maps. namespace lemon { - /// \ingroup graphbits - /// - /// \brief Graph map based on the std::vector storage. - /// - /// The VectorMap template class is graph map structure what - /// automatically updates the map when a key is added to or erased from - /// the map. This map type uses the std::vector to store the values. - /// - /// \tparam _Graph The graph this map is attached to. - /// \tparam _Item The item type of the graph items. - /// \tparam _Value The value type of the map. + // \ingroup graphbits + // + // \brief Graph map based on the std::vector storage. + // + // The VectorMap template class is graph map structure what + // automatically updates the map when a key is added to or erased from + // the map. This map type uses the std::vector to store the values. + // + // \tparam _Graph The graph this map is attached to. + // \tparam _Item The item type of the graph items. + // \tparam _Value The value type of the map. template class VectorMap : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase { private: - /// The container type of the map. + // The container type of the map. typedef std::vector<_Value> Container; public: - /// The graph type of the map. + // The graph type of the map. typedef _Graph Graph; - /// The item type of the map. + // The item type of the map. typedef _Item Item; - /// The reference map tag. + // The reference map tag. typedef True ReferenceMapTag; - /// The key type of the map. + // The key type of the map. typedef _Item Key; - /// The value type of the map. + // The value type of the map. typedef _Value Value; - /// The notifier type. + // The notifier type. typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier; - /// The map type. + // The map type. typedef VectorMap Map; - /// The base class of the map. + // The base class of the map. typedef typename Notifier::ObserverBase Parent; - /// The reference type of the map; + // The reference type of the map; typedef typename Container::reference Reference; - /// The const reference type of the map; + // The const reference type of the map; typedef typename Container::const_reference ConstReference; - /// \brief Constructor to attach the new map into the notifier. - /// - /// It constructs a map and attachs it into the notifier. - /// It adds all the items of the graph to the map. + // \brief Constructor to attach the new map into the notifier. + // + // It constructs a map and attachs it into the notifier. + // It adds all the items of the graph to the map. VectorMap(const Graph& graph) { Parent::attach(graph.notifier(Item())); container.resize(Parent::notifier()->maxId() + 1); } - /// \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. + // \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& graph, const Value& value) { Parent::attach(graph.notifier(Item())); container.resize(Parent::notifier()->maxId() + 1, value); } private: - /// \brief Copy constructor - /// - /// Copy constructor. + // \brief Copy constructor + // + // Copy constructor. VectorMap(const VectorMap& _copy) : Parent() { if (_copy.attached()) { Parent::attach(*_copy.notifier()); @@ -110,24 +110,24 @@ } } - /// \brief Assign operator. - /// - /// This operator assigns for each item in the map the - /// value mapped to the same item in the copied map. - /// The parameter map should be indiced with the same - /// itemset because this assign operator does not change - /// the container of the map. + // \brief Assign operator. + // + // This operator assigns for each item in the map the + // value mapped to the same item in the copied map. + // The parameter map should be indiced with the same + // itemset because this assign operator does not change + // the container of the map. VectorMap& operator=(const VectorMap& cmap) { return operator=(cmap); } - /// \brief Template assign operator. - /// - /// The given parameter should be conform to the ReadMap - /// concecpt and could be indiced by the current item set of - /// the NodeMap. In this case the value for each item - /// is assigned by the value of the given ReadMap. + // \brief Template assign operator. + // + // The given parameter should be conform to the ReadMap + // concecpt and could be indiced by the current item set of + // the NodeMap. In this case the value for each item + // is assigned by the value of the given ReadMap. template VectorMap& operator=(const CMap& cmap) { checkConcept, CMap>(); @@ -141,36 +141,36 @@ public: - /// \brief The subcript operator. - /// - /// The subscript operator. The map can be subscripted by the - /// actual items of the graph. + // \brief The subcript operator. + // + // The subscript operator. The map can be subscripted by the + // actual items of the graph. Reference operator[](const Key& key) { return container[Parent::notifier()->id(key)]; } - /// \brief The const subcript operator. - /// - /// The const subscript operator. The map can be subscripted by the - /// actual items of the graph. + // \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[Parent::notifier()->id(key)]; } - /// \brief The setter function of the map. - /// - /// It the same as operator[](key) = value expression. + // \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; } protected: - /// \brief Adds a new key to the map. - /// - /// It adds a new key to the map. It called by the observer notifier - /// and it overrides the add() member function of the observer base. + // \brief Adds a new key to the map. + // + // It adds a new key to the map. It called by the observer notifier + // and it overrides the add() member function of the observer base. virtual void add(const Key& key) { int id = Parent::notifier()->id(key); if (id >= int(container.size())) { @@ -178,10 +178,10 @@ } } - /// \brief Adds more new keys to the map. - /// - /// It adds more new keys to the map. It called by the observer notifier - /// and it overrides the add() member function of the observer base. + // \brief Adds more new keys to the map. + // + // It adds more new keys to the map. It called by the observer notifier + // and it overrides the add() member function of the observer base. virtual void add(const std::vector& keys) { int max = container.size() - 1; for (int i = 0; i < int(keys.size()); ++i) { @@ -193,38 +193,38 @@ container.resize(max + 1); } - /// \brief Erase a key from the map. - /// - /// Erase a key from the map. It called by the observer notifier - /// and it overrides the erase() member function of the observer base. + // \brief Erase a key from the map. + // + // Erase a key from the map. It called by the observer notifier + // and it overrides the erase() member function of the observer base. virtual void erase(const Key& key) { container[Parent::notifier()->id(key)] = Value(); } - /// \brief Erase more keys from the map. - /// - /// Erase more keys from the map. It called by the observer notifier - /// and it overrides the erase() member function of the observer base. + // \brief Erase more keys from the map. + // + // Erase more keys from the map. It called by the observer notifier + // and it overrides the erase() member function of the observer base. virtual void erase(const std::vector& keys) { for (int i = 0; i < int(keys.size()); ++i) { container[Parent::notifier()->id(keys[i])] = Value(); } } - /// \brief Buildes the map. - /// - /// It buildes the map. It called by the observer notifier - /// and it overrides the build() member function of the observer base. + // \brief Buildes the map. + // + // It buildes the map. It called by the observer notifier + // and it overrides the build() member function of the observer base. virtual void build() { int size = Parent::notifier()->maxId() + 1; container.reserve(size); container.resize(size); } - /// \brief Clear the map. - /// - /// It erase all items from the map. It called by the observer notifier - /// and it overrides the clear() member function of the observer base. + // \brief Clear the map. + // + // It erase all items from the map. It called by the observer notifier + // and it overrides the clear() member function of the observer base. virtual void clear() { container.clear(); }