diff -r d5a7d6bc0f00 -r 66ae78d29f1e lemon/bits/vector_map.h --- a/lemon/bits/vector_map.h Tue Aug 30 21:19:07 2005 +0000 +++ b/lemon/bits/vector_map.h Wed Aug 31 13:29:32 2005 +0000 @@ -23,16 +23,20 @@ #include #include #include +#include +#include -///\ingroup graphmapfactory +/// \ingroup graphmapfactory +/// ///\file ///\brief Vector based graph maps. namespace lemon { - - /// \addtogroup graphmapfactory - /// @{ - + + /// \ingroup graphmapfactory + /// + /// \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 factory uses the allocators to implement @@ -117,39 +121,29 @@ } } - using Parent::attach; - using Parent::detach; - using Parent::attached; - - /** Assign operator to copy a map of the same map type. - */ - VectorMap& operator=(const VectorMap& copy) { - if (© == this) return *this; - - if (graph != copy.graph) { - if (attached()) { - detach(); - } - if (copy.attached()) { - attach(*copy.getRegistry()); - } - } - container = copy.container; - - return *this; - } - - virtual ~VectorMap() { if (attached()) { detach(); } } + + private: + + VectorMap& operator=(const VectorMap&); + + protected: + + using Parent::attach; + using Parent::detach; + using Parent::attached; + const Graph* getGraph() const { return graph; } + public: + /// The subcript operator. /// The subscript operator. The map can be subscripted by the @@ -173,13 +167,14 @@ /// It the same as operator[](key) = value expression. /// - void set(const Key& key, const Value& value) { (*this)[key] = value; } - /// Adds a new key to the map. - + protected: + + /// \brief Adds a new key to the map. + /// /// It adds a new key to the map. It called by the observer registry /// and it overrides the add() member function of the observer base. @@ -220,69 +215,6 @@ }; - - template - class VectorMappableGraphExtender : public _Base { - public: - - typedef VectorMappableGraphExtender<_Base> Graph; - typedef _Base Parent; - - typedef typename Parent::Node Node; - typedef typename Parent::NodeIt NodeIt; - typedef typename Parent::NodeIdMap NodeIdMap; - typedef typename Parent::NodeNotifier NodeObserverRegistry; - - typedef typename Parent::Edge Edge; - typedef typename Parent::EdgeIt EdgeIt; - typedef typename Parent::EdgeIdMap EdgeIdMap; - typedef typename Parent::EdgeNotifier EdgeObserverRegistry; - - - template - class NodeMap : - public IterableMapExtender > { - public: - typedef VectorMappableGraphExtender<_Base> Graph; - - typedef typename Graph::Node Node; - - typedef IterableMapExtender > Parent; - - //typedef typename Parent::Graph Graph; - typedef typename Parent::Value Value; - - NodeMap(const Graph& g) - : Parent(g) {} - NodeMap(const Graph& g, const Value& v) - : Parent(g, v) {} - - }; - - template - class EdgeMap - : public IterableMapExtender > { - public: - typedef VectorMappableGraphExtender<_Base> Graph; - - typedef typename Graph::Edge Edge; - - typedef IterableMapExtender > Parent; - - //typedef typename Parent::Graph Graph; - typedef typename Parent::Value Value; - - EdgeMap(const Graph& g) - : Parent(g) {} - EdgeMap(const Graph& g, const Value& v) - : Parent(g, v) {} - - }; - - }; - - /// @} - } #endif