lemon/concepts/graph.h
changeset 590 b61354458b59
parent 559 c5fd2d996909
child 657 bf7928412136
equal deleted inserted replaced
10:5580da3bd1d1 11:06cdc101bc32
   495         /// Assign the iterator to the next inarc of the corresponding node.
   495         /// Assign the iterator to the next inarc of the corresponding node.
   496         ///
   496         ///
   497         InArcIt& operator++() { return *this; }
   497         InArcIt& operator++() { return *this; }
   498       };
   498       };
   499 
   499 
   500       /// \brief Read write map of the nodes to type \c T.
   500       /// \brief Reference map of the nodes to type \c T.
   501       ///
   501       ///
   502       /// ReadWrite map of the nodes to type \c T.
   502       /// Reference map of the nodes to type \c T.
   503       /// \sa Reference
       
   504       template<class T>
   503       template<class T>
   505       class NodeMap : public ReadWriteMap< Node, T >
   504       class NodeMap : public ReferenceMap<Node, T, T&, const T&>
   506       {
   505       {
   507       public:
   506       public:
   508 
   507 
   509         ///\e
   508         ///\e
   510         NodeMap(const Graph&) { }
   509         NodeMap(const Graph&) { }
   511         ///\e
   510         ///\e
   512         NodeMap(const Graph&, T) { }
   511         NodeMap(const Graph&, T) { }
   513 
   512 
   514       private:
   513       private:
   515         ///Copy constructor
   514         ///Copy constructor
   516         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   515         NodeMap(const NodeMap& nm) :
       
   516           ReferenceMap<Node, T, T&, const T&>(nm) { }
   517         ///Assignment operator
   517         ///Assignment operator
   518         template <typename CMap>
   518         template <typename CMap>
   519         NodeMap& operator=(const CMap&) {
   519         NodeMap& operator=(const CMap&) {
   520           checkConcept<ReadMap<Node, T>, CMap>();
   520           checkConcept<ReadMap<Node, T>, CMap>();
   521           return *this;
   521           return *this;
   522         }
   522         }
   523       };
   523       };
   524 
   524 
   525       /// \brief Read write map of the directed arcs to type \c T.
   525       /// \brief Reference map of the arcs to type \c T.
   526       ///
   526       ///
   527       /// Reference map of the directed arcs to type \c T.
   527       /// Reference map of the arcs to type \c T.
   528       /// \sa Reference
       
   529       template<class T>
   528       template<class T>
   530       class ArcMap : public ReadWriteMap<Arc,T>
   529       class ArcMap : public ReferenceMap<Arc, T, T&, const T&>
   531       {
   530       {
   532       public:
   531       public:
   533 
   532 
   534         ///\e
   533         ///\e
   535         ArcMap(const Graph&) { }
   534         ArcMap(const Graph&) { }
   536         ///\e
   535         ///\e
   537         ArcMap(const Graph&, T) { }
   536         ArcMap(const Graph&, T) { }
   538       private:
   537       private:
   539         ///Copy constructor
   538         ///Copy constructor
   540         ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { }
   539         ArcMap(const ArcMap& em) :
       
   540           ReferenceMap<Arc, T, T&, const T&>(em) { }
   541         ///Assignment operator
   541         ///Assignment operator
   542         template <typename CMap>
   542         template <typename CMap>
   543         ArcMap& operator=(const CMap&) {
   543         ArcMap& operator=(const CMap&) {
   544           checkConcept<ReadMap<Arc, T>, CMap>();
   544           checkConcept<ReadMap<Arc, T>, CMap>();
   545           return *this;
   545           return *this;
   546         }
   546         }
   547       };
   547       };
   548 
   548 
   549       /// Read write map of the edges to type \c T.
   549       /// Reference map of the edges to type \c T.
   550 
   550 
   551       /// Reference map of the arcs to type \c T.
   551       /// Reference map of the edges to type \c T.
   552       /// \sa Reference
       
   553       template<class T>
   552       template<class T>
   554       class EdgeMap : public ReadWriteMap<Edge,T>
   553       class EdgeMap : public ReferenceMap<Edge, T, T&, const T&>
   555       {
   554       {
   556       public:
   555       public:
   557 
   556 
   558         ///\e
   557         ///\e
   559         EdgeMap(const Graph&) { }
   558         EdgeMap(const Graph&) { }
   560         ///\e
   559         ///\e
   561         EdgeMap(const Graph&, T) { }
   560         EdgeMap(const Graph&, T) { }
   562       private:
   561       private:
   563         ///Copy constructor
   562         ///Copy constructor
   564         EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) {}
   563         EdgeMap(const EdgeMap& em) :
       
   564           ReferenceMap<Edge, T, T&, const T&>(em) {}
   565         ///Assignment operator
   565         ///Assignment operator
   566         template <typename CMap>
   566         template <typename CMap>
   567         EdgeMap& operator=(const CMap&) {
   567         EdgeMap& operator=(const CMap&) {
   568           checkConcept<ReadMap<Edge, T>, CMap>();
   568           checkConcept<ReadMap<Edge, T>, CMap>();
   569           return *this;
   569           return *this;
   746       }
   746       }
   747 
   747 
   748       template <typename _Graph>
   748       template <typename _Graph>
   749       struct Constraints {
   749       struct Constraints {
   750         void constraints() {
   750         void constraints() {
       
   751           checkConcept<BaseGraphComponent, _Graph>();
   751           checkConcept<IterableGraphComponent<>, _Graph>();
   752           checkConcept<IterableGraphComponent<>, _Graph>();
   752           checkConcept<IDableGraphComponent<>, _Graph>();
   753           checkConcept<IDableGraphComponent<>, _Graph>();
   753           checkConcept<MappableGraphComponent<>, _Graph>();
   754           checkConcept<MappableGraphComponent<>, _Graph>();
   754         }
   755         }
   755       };
   756       };