30 #include <lemon/concept/graph_component.h> |
30 #include <lemon/concept/graph_component.h> |
31 |
31 |
32 namespace lemon { |
32 namespace lemon { |
33 namespace concept { |
33 namespace concept { |
34 |
34 |
35 |
|
36 /**************** The full-featured graph concepts ****************/ |
|
37 |
|
38 |
|
39 // \brief Modular static graph class. |
|
40 // |
|
41 // It should be the same as the \c Graph class. |
|
42 class _Graph |
|
43 : virtual public BaseGraphComponent, |
|
44 public IterableGraphComponent, public MappableGraphComponent { |
|
45 public: |
|
46 |
|
47 typedef BaseGraphComponent::Node Node; |
|
48 typedef BaseGraphComponent::Edge Edge; |
|
49 |
|
50 template <typename _Graph> |
|
51 struct Constraints { |
|
52 void constraints() { |
|
53 checkConcept<IterableGraphComponent, _Graph>(); |
|
54 checkConcept<MappableGraphComponent, _Graph>(); |
|
55 } |
|
56 }; |
|
57 }; |
|
58 |
|
59 /// \addtogroup graph_concepts |
35 /// \addtogroup graph_concepts |
60 /// @{ |
36 /// @{ |
61 |
37 |
62 /// The directed graph concept |
38 /// The directed graph concept |
63 |
39 |
408 /// |
384 /// |
409 /// ReadWrite map of the nodes to type \c T. |
385 /// ReadWrite map of the nodes to type \c T. |
410 /// \sa Reference |
386 /// \sa Reference |
411 /// \warning Making maps that can handle bool type (NodeMap<bool>) |
387 /// \warning Making maps that can handle bool type (NodeMap<bool>) |
412 /// needs some extra attention! |
388 /// needs some extra attention! |
413 /// \todo Wrong documentation |
|
414 template<class T> |
389 template<class T> |
415 class NodeMap : public ReadWriteMap< Node, T > |
390 class NodeMap : public ReadWriteMap< Node, T > { |
416 { |
|
417 public: |
391 public: |
418 |
392 |
419 ///\e |
393 ///\e |
420 NodeMap(const Graph&) { } |
394 NodeMap(const Graph&) { } |
421 ///\e |
395 ///\e |
422 NodeMap(const Graph&, T) { } |
396 NodeMap(const Graph&, T) { } |
423 |
397 |
424 ///Copy constructor |
398 ///Copy constructor |
425 NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } |
399 NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } |
426 ///Assignment operator |
400 ///Assignment operator |
427 NodeMap& operator=(const NodeMap&) { return *this; } |
401 template <typename CMap> |
428 // \todo fix this concept |
402 NodeMap& operator=(const CMap&) { |
|
403 checkConcept<ReadMap<Node, T>, CMap>(); |
|
404 return *this; |
|
405 } |
429 }; |
406 }; |
430 |
407 |
431 /// \brief Read write map of the edges to type \c T. |
408 /// \brief Read write map of the edges to type \c T. |
432 /// |
409 /// |
433 /// Reference map of the edges to type \c T. |
410 /// Reference map of the edges to type \c T. |
434 /// \sa Reference |
411 /// \sa Reference |
435 /// \warning Making maps that can handle bool type (EdgeMap<bool>) |
412 /// \warning Making maps that can handle bool type (EdgeMap<bool>) |
436 /// needs some extra attention! |
413 /// needs some extra attention! |
437 /// \todo Wrong documentation |
|
438 template<class T> |
414 template<class T> |
439 class EdgeMap : public ReadWriteMap<Edge,T> |
415 class EdgeMap : public ReadWriteMap<Edge,T> { |
440 { |
|
441 public: |
416 public: |
442 |
417 |
443 ///\e |
418 ///\e |
444 EdgeMap(const Graph&) { } |
419 EdgeMap(const Graph&) { } |
445 ///\e |
420 ///\e |
446 EdgeMap(const Graph&, T) { } |
421 EdgeMap(const Graph&, T) { } |
447 ///Copy constructor |
422 ///Copy constructor |
448 EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { } |
423 EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { } |
449 ///Assignment operator |
424 ///Assignment operator |
450 EdgeMap& operator=(const EdgeMap&) { return *this; } |
425 template <typename CMap> |
451 // \todo fix this concept |
426 EdgeMap& operator=(const CMap&) { |
|
427 checkConcept<ReadMap<Edge, T>, CMap>(); |
|
428 return *this; |
|
429 } |
452 }; |
430 }; |
453 |
431 |
454 template <typename RGraph> |
432 template <typename RGraph> |
455 struct Constraints : public _Graph::Constraints<RGraph> {}; |
433 struct Constraints { |
|
434 void constraints() { |
|
435 checkConcept<BaseIterableGraphComponent<>, Graph>(); |
|
436 checkConcept<IterableGraphComponent<>, Graph>(); |
|
437 checkConcept<MappableGraphComponent<>, Graph>(); |
|
438 } |
|
439 }; |
456 |
440 |
457 }; |
441 }; |
458 |
442 |
459 // @} |
443 // @} |
460 } //namespace concept |
444 } //namespace concept |