303 |
303 |
304 }; |
304 }; |
305 |
305 |
306 /// \e |
306 /// \e |
307 template <typename _Base> |
307 template <typename _Base> |
308 class StaticMappableUndirGraphExtender : |
308 class StaticMappableUGraphExtender : |
309 public StaticMappableGraphExtender<_Base> { |
309 public StaticMappableGraphExtender<_Base> { |
310 public: |
310 public: |
311 |
311 |
312 typedef StaticMappableUndirGraphExtender Graph; |
312 typedef StaticMappableUGraphExtender Graph; |
313 typedef StaticMappableGraphExtender<_Base> Parent; |
313 typedef StaticMappableGraphExtender<_Base> Parent; |
314 |
314 |
315 typedef typename Parent::UndirEdge UndirEdge; |
315 typedef typename Parent::UEdge UEdge; |
316 |
316 |
317 template <typename _Value> |
317 template <typename _Value> |
318 class UndirEdgeMap |
318 class UEdgeMap |
319 : public IterableMapExtender<StaticMap<Graph, UndirEdge, _Value> > { |
319 : public IterableMapExtender<StaticMap<Graph, UEdge, _Value> > { |
320 public: |
320 public: |
321 typedef StaticMappableUndirGraphExtender Graph; |
321 typedef StaticMappableUGraphExtender Graph; |
322 typedef IterableMapExtender< |
322 typedef IterableMapExtender< |
323 StaticMap<Graph, UndirEdge, _Value> > Parent; |
323 StaticMap<Graph, UEdge, _Value> > Parent; |
324 |
324 |
325 UndirEdgeMap(const Graph& _g) |
325 UEdgeMap(const Graph& _g) |
326 : Parent(_g) {} |
326 : Parent(_g) {} |
327 UndirEdgeMap(const Graph& _g, const _Value& _v) |
327 UEdgeMap(const Graph& _g, const _Value& _v) |
328 : Parent(_g, _v) {} |
328 : Parent(_g, _v) {} |
329 |
329 |
330 UndirEdgeMap& operator=(const UndirEdgeMap& cmap) { |
330 UEdgeMap& operator=(const UEdgeMap& cmap) { |
331 return operator=<UndirEdgeMap>(cmap); |
331 return operator=<UEdgeMap>(cmap); |
332 } |
332 } |
333 |
333 |
334 template <typename CMap> |
334 template <typename CMap> |
335 UndirEdgeMap& operator=(const CMap& cmap) { |
335 UEdgeMap& operator=(const CMap& cmap) { |
336 checkConcept<concept::ReadMap<UndirEdge, _Value>, CMap>(); |
336 checkConcept<concept::ReadMap<UEdge, _Value>, CMap>(); |
337 const typename Parent::Graph* graph = Parent::getGraph(); |
337 const typename Parent::Graph* graph = Parent::getGraph(); |
338 UndirEdge it; |
338 UEdge it; |
339 for (graph->first(it); it != INVALID; graph->next(it)) { |
339 for (graph->first(it); it != INVALID; graph->next(it)) { |
340 Parent::set(it, cmap[it]); |
340 Parent::set(it, cmap[it]); |
341 } |
341 } |
342 return *this; |
342 return *this; |
343 } |
343 } |
344 }; |
344 }; |
345 |
345 |
346 }; |
346 }; |
347 |
347 |
348 template <typename _Base> |
348 template <typename _Base> |
349 class StaticMappableUndirBipartiteGraphExtender : public _Base { |
349 class StaticMappableUBipartiteGraphExtender : public _Base { |
350 public: |
350 public: |
351 |
351 |
352 typedef _Base Parent; |
352 typedef _Base Parent; |
353 typedef StaticMappableUndirBipartiteGraphExtender Graph; |
353 typedef StaticMappableUBipartiteGraphExtender Graph; |
354 |
354 |
355 typedef typename Parent::Node Node; |
355 typedef typename Parent::Node Node; |
356 typedef typename Parent::UpperNode UpperNode; |
356 typedef typename Parent::UpperNode UpperNode; |
357 typedef typename Parent::LowerNode LowerNode; |
357 typedef typename Parent::LowerNode LowerNode; |
358 typedef typename Parent::Edge Edge; |
358 typedef typename Parent::Edge Edge; |
359 typedef typename Parent::UndirEdge UndirEdge; |
359 typedef typename Parent::UEdge UEdge; |
360 |
360 |
361 template <typename _Value> |
361 template <typename _Value> |
362 class UpperNodeMap |
362 class UpperNodeMap |
363 : public IterableMapExtender<StaticMap<Graph, UpperNode, _Value> > { |
363 : public IterableMapExtender<StaticMap<Graph, UpperNode, _Value> > { |
364 public: |
364 public: |
365 typedef StaticMappableUndirBipartiteGraphExtender Graph; |
365 typedef StaticMappableUBipartiteGraphExtender Graph; |
366 typedef IterableMapExtender<StaticMap<Graph, UpperNode, _Value> > |
366 typedef IterableMapExtender<StaticMap<Graph, UpperNode, _Value> > |
367 Parent; |
367 Parent; |
368 |
368 |
369 UpperNodeMap(const Graph& _g) |
369 UpperNodeMap(const Graph& _g) |
370 : Parent(_g) {} |
370 : Parent(_g) {} |
553 |
553 |
554 template <typename _Value> |
554 template <typename _Value> |
555 class EdgeMap |
555 class EdgeMap |
556 : public IterableMapExtender<StaticMap<Graph, Edge, _Value> > { |
556 : public IterableMapExtender<StaticMap<Graph, Edge, _Value> > { |
557 public: |
557 public: |
558 typedef StaticMappableUndirBipartiteGraphExtender Graph; |
558 typedef StaticMappableUBipartiteGraphExtender Graph; |
559 typedef IterableMapExtender<StaticMap<Graph, Edge, _Value> > Parent; |
559 typedef IterableMapExtender<StaticMap<Graph, Edge, _Value> > Parent; |
560 |
560 |
561 EdgeMap(const Graph& _g) |
561 EdgeMap(const Graph& _g) |
562 : Parent(_g) {} |
562 : Parent(_g) {} |
563 EdgeMap(const Graph& _g, const _Value& _v) |
563 EdgeMap(const Graph& _g, const _Value& _v) |
578 return *this; |
578 return *this; |
579 } |
579 } |
580 }; |
580 }; |
581 |
581 |
582 template <typename _Value> |
582 template <typename _Value> |
583 class UndirEdgeMap |
583 class UEdgeMap |
584 : public IterableMapExtender<StaticMap<Graph, UndirEdge, _Value> > { |
584 : public IterableMapExtender<StaticMap<Graph, UEdge, _Value> > { |
585 public: |
585 public: |
586 typedef StaticMappableUndirBipartiteGraphExtender Graph; |
586 typedef StaticMappableUBipartiteGraphExtender Graph; |
587 typedef IterableMapExtender<StaticMap<Graph, UndirEdge, _Value> > |
587 typedef IterableMapExtender<StaticMap<Graph, UEdge, _Value> > |
588 Parent; |
588 Parent; |
589 |
589 |
590 UndirEdgeMap(const Graph& _g) |
590 UEdgeMap(const Graph& _g) |
591 : Parent(_g) {} |
591 : Parent(_g) {} |
592 UndirEdgeMap(const Graph& _g, const _Value& _v) |
592 UEdgeMap(const Graph& _g, const _Value& _v) |
593 : Parent(_g, _v) {} |
593 : Parent(_g, _v) {} |
594 |
594 |
595 UndirEdgeMap& operator=(const UndirEdgeMap& cmap) { |
595 UEdgeMap& operator=(const UEdgeMap& cmap) { |
596 return operator=<UndirEdgeMap>(cmap); |
596 return operator=<UEdgeMap>(cmap); |
597 } |
597 } |
598 |
598 |
599 template <typename CMap> |
599 template <typename CMap> |
600 UndirEdgeMap& operator=(const CMap& cmap) { |
600 UEdgeMap& operator=(const CMap& cmap) { |
601 checkConcept<concept::ReadMap<UndirEdge, _Value>, CMap>(); |
601 checkConcept<concept::ReadMap<UEdge, _Value>, CMap>(); |
602 const typename Parent::Graph* graph = Parent::getGraph(); |
602 const typename Parent::Graph* graph = Parent::getGraph(); |
603 UndirEdge it; |
603 UEdge it; |
604 for (graph->first(it); it != INVALID; graph->next(it)) { |
604 for (graph->first(it); it != INVALID; graph->next(it)) { |
605 Parent::set(it, cmap[it]); |
605 Parent::set(it, cmap[it]); |
606 } |
606 } |
607 return *this; |
607 return *this; |
608 } |
608 } |