lemon/bits/default_map.h
changeset 1865 dcefd1d1377f
parent 1820 22099ef840d7
child 1875 98698b69a902
equal deleted inserted replaced
5:9a45db00d6d0 6:085906497624
   223     
   223     
   224   };
   224   };
   225 
   225 
   226   /// \e
   226   /// \e
   227   template <typename _Base> 
   227   template <typename _Base> 
       
   228   class MappableEdgeSetExtender : public _Base {
       
   229   public:
       
   230 
       
   231     typedef MappableEdgeSetExtender<_Base> Graph;
       
   232     typedef _Base Parent;
       
   233 
       
   234     typedef typename Parent::Edge Edge;
       
   235     typedef typename Parent::EdgeIt EdgeIt;
       
   236 
       
   237     template <typename _Value>
       
   238     class EdgeMap 
       
   239       : public IterableMapExtender<DefaultMap<Graph, Edge, _Value> > {
       
   240     public:
       
   241       typedef MappableEdgeSetExtender Graph;
       
   242       typedef IterableMapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
       
   243 
       
   244       EdgeMap(const Graph& _g) 
       
   245 	: Parent(_g) {}
       
   246       EdgeMap(const Graph& _g, const _Value& _v) 
       
   247 	: Parent(_g, _v) {}
       
   248 
       
   249       EdgeMap& operator=(const EdgeMap& cmap) {
       
   250 	return operator=<EdgeMap>(cmap);
       
   251       }
       
   252 
       
   253       template <typename CMap>
       
   254       EdgeMap& operator=(const CMap& cmap) {
       
   255 	checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
       
   256 	const typename Parent::Graph* graph = Parent::getGraph();
       
   257 	Edge it;
       
   258 	for (graph->first(it); it != INVALID; graph->next(it)) {
       
   259 	  Parent::set(it, cmap[it]);
       
   260 	}
       
   261 	return *this;
       
   262       }
       
   263     };
       
   264     
       
   265   };
       
   266 
       
   267   /// \e
       
   268   template <typename _Base> 
   228   class MappableUndirGraphExtender : 
   269   class MappableUndirGraphExtender : 
   229     public MappableGraphExtender<_Base> {
   270     public MappableGraphExtender<_Base> {
   230   public:
   271   public:
   231 
   272 
   232     typedef MappableUndirGraphExtender Graph;
   273     typedef MappableUndirGraphExtender Graph;
   237     template <typename _Value>
   278     template <typename _Value>
   238     class UndirEdgeMap 
   279     class UndirEdgeMap 
   239       : public IterableMapExtender<DefaultMap<Graph, UndirEdge, _Value> > {
   280       : public IterableMapExtender<DefaultMap<Graph, UndirEdge, _Value> > {
   240     public:
   281     public:
   241       typedef MappableUndirGraphExtender Graph;
   282       typedef MappableUndirGraphExtender Graph;
       
   283       typedef IterableMapExtender<
       
   284 	DefaultMap<Graph, UndirEdge, _Value> > Parent;
       
   285 
       
   286       UndirEdgeMap(const Graph& _g) 
       
   287 	: Parent(_g) {}
       
   288       UndirEdgeMap(const Graph& _g, const _Value& _v) 
       
   289 	: Parent(_g, _v) {}
       
   290 
       
   291       UndirEdgeMap& operator=(const UndirEdgeMap& cmap) {
       
   292 	return operator=<UndirEdgeMap>(cmap);
       
   293       }
       
   294 
       
   295       template <typename CMap>
       
   296       UndirEdgeMap& operator=(const CMap& cmap) {
       
   297 	checkConcept<concept::ReadMap<UndirEdge, _Value>, CMap>();
       
   298 	const typename Parent::Graph* graph = Parent::getGraph();
       
   299 	UndirEdge it;
       
   300 	for (graph->first(it); it != INVALID; graph->next(it)) {
       
   301 	  Parent::set(it, cmap[it]);
       
   302 	}
       
   303 	return *this;
       
   304       }
       
   305     };
       
   306 
       
   307 
       
   308   };
       
   309 
       
   310   /// \e
       
   311   template <typename _Base> 
       
   312   class MappableUndirEdgeSetExtender : 
       
   313     public MappableEdgeSetExtender<_Base> {
       
   314   public:
       
   315 
       
   316     typedef MappableUndirEdgeSetExtender Graph;
       
   317     typedef MappableEdgeSetExtender<_Base> Parent;
       
   318 
       
   319     typedef typename Parent::UndirEdge UndirEdge;
       
   320 
       
   321     template <typename _Value>
       
   322     class UndirEdgeMap 
       
   323       : public IterableMapExtender<DefaultMap<Graph, UndirEdge, _Value> > {
       
   324     public:
       
   325       typedef MappableUndirEdgeSetExtender Graph;
   242       typedef IterableMapExtender<
   326       typedef IterableMapExtender<
   243 	DefaultMap<Graph, UndirEdge, _Value> > Parent;
   327 	DefaultMap<Graph, UndirEdge, _Value> > Parent;
   244 
   328 
   245       UndirEdgeMap(const Graph& _g) 
   329       UndirEdgeMap(const Graph& _g) 
   246 	: Parent(_g) {}
   330 	: Parent(_g) {}