Changeset 1669:66ae78d29f1e in lemon0.x for lemon/bits/vector_map.h
 Timestamp:
 08/31/05 15:29:32 (14 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2185
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/bits/vector_map.h
r1587 r1669 24 24 #include <lemon/bits/map_iterator.h> 25 25 #include <lemon/bits/alteration_notifier.h> 26 27 ///\ingroup graphmapfactory 26 #include <lemon/concept_check.h> 27 #include <lemon/concept/maps.h> 28 29 /// \ingroup graphmapfactory 30 /// 28 31 ///\file 29 32 ///\brief Vector based graph maps. 30 33 31 34 namespace lemon { 32 33 /// \addtogroup graphmapfactory 34 /// @{ 35 35 36 /// \ingroup graphmapfactory 37 /// 38 /// \brief Graph map based on the std::vector storage. 39 /// 36 40 /// The VectorMap template class is graph map structure what 37 41 /// automatically updates the map when a key is added to or erased from … … 118 122 } 119 123 120 using Parent::attach;121 using Parent::detach;122 using Parent::attached;123 124 /** Assign operator to copy a map of the same map type.125 */126 VectorMap& operator=(const VectorMap& copy) {127 if (© == this) return *this;128 129 if (graph != copy.graph) {130 if (attached()) {131 detach();132 }133 if (copy.attached()) {134 attach(*copy.getRegistry());135 }136 }137 container = copy.container;138 139 return *this;140 }141 142 143 124 virtual ~VectorMap() { 144 125 if (attached()) { … … 147 128 } 148 129 130 131 private: 132 133 VectorMap& operator=(const VectorMap&); 134 135 protected: 136 137 using Parent::attach; 138 using Parent::detach; 139 using Parent::attached; 140 149 141 const Graph* getGraph() const { 150 142 return graph; 151 143 } 144 145 public: 152 146 153 147 /// The subcript operator. … … 174 168 /// It the same as operator[](key) = value expression. 175 169 /// 176 177 170 void set(const Key& key, const Value& value) { 178 171 (*this)[key] = value; 179 172 } 180 173 181 /// Adds a new key to the map. 182 174 protected: 175 176 /// \brief Adds a new key to the map. 177 /// 183 178 /// It adds a new key to the map. It called by the observer registry 184 179 /// and it overrides the add() member function of the observer base. … … 221 216 }; 222 217 223 224 template <typename _Base>225 class VectorMappableGraphExtender : public _Base {226 public:227 228 typedef VectorMappableGraphExtender<_Base> Graph;229 typedef _Base Parent;230 231 typedef typename Parent::Node Node;232 typedef typename Parent::NodeIt NodeIt;233 typedef typename Parent::NodeIdMap NodeIdMap;234 typedef typename Parent::NodeNotifier NodeObserverRegistry;235 236 typedef typename Parent::Edge Edge;237 typedef typename Parent::EdgeIt EdgeIt;238 typedef typename Parent::EdgeIdMap EdgeIdMap;239 typedef typename Parent::EdgeNotifier EdgeObserverRegistry;240 241 242 template <typename _Value>243 class NodeMap :244 public IterableMapExtender<VectorMap<Graph, Node, _Value> > {245 public:246 typedef VectorMappableGraphExtender<_Base> Graph;247 248 typedef typename Graph::Node Node;249 250 typedef IterableMapExtender<VectorMap<Graph, Node, _Value> > Parent;251 252 //typedef typename Parent::Graph Graph;253 typedef typename Parent::Value Value;254 255 NodeMap(const Graph& g)256 : Parent(g) {}257 NodeMap(const Graph& g, const Value& v)258 : Parent(g, v) {}259 260 };261 262 template <typename _Value>263 class EdgeMap264 : public IterableMapExtender<VectorMap<Graph, Edge, _Value> > {265 public:266 typedef VectorMappableGraphExtender<_Base> Graph;267 268 typedef typename Graph::Edge Edge;269 270 typedef IterableMapExtender<VectorMap<Graph, Edge, _Value> > Parent;271 272 //typedef typename Parent::Graph Graph;273 typedef typename Parent::Value Value;274 275 EdgeMap(const Graph& g)276 : Parent(g) {}277 EdgeMap(const Graph& g, const Value& v)278 : Parent(g, v) {}279 280 };281 282 };283 284 /// @}285 286 218 } 287 219
Note: See TracChangeset
for help on using the changeset viewer.