lemon/concepts/digraph.h
changeset 648 4ff8041e9c2e
parent 529 f5bc148f7e1f
child 734 bd72f8d20f33
child 1083 3e711ee55d31
equal deleted inserted replaced
8:eee01114534a 9:bdced82c75af
   419       /// \brief The opposite node on the given arc.
   419       /// \brief The opposite node on the given arc.
   420       ///
   420       ///
   421       /// Gives back the opposite node on the given arc.
   421       /// Gives back the opposite node on the given arc.
   422       Node oppositeNode(const Node&, const Arc&) const { return INVALID; }
   422       Node oppositeNode(const Node&, const Arc&) const { return INVALID; }
   423 
   423 
   424       /// \brief Read write map of the nodes to type \c T.
   424       /// \brief Reference map of the nodes to type \c T.
   425       ///
   425       ///
   426       /// ReadWrite map of the nodes to type \c T.
   426       /// Reference map of the nodes to type \c T.
   427       /// \sa Reference
       
   428       template<class T>
   427       template<class T>
   429       class NodeMap : public ReadWriteMap< Node, T > {
   428       class NodeMap : public ReferenceMap<Node, T, T&, const T&> {
   430       public:
   429       public:
   431 
   430 
   432         ///\e
   431         ///\e
   433         NodeMap(const Digraph&) { }
   432         NodeMap(const Digraph&) { }
   434         ///\e
   433         ///\e
   435         NodeMap(const Digraph&, T) { }
   434         NodeMap(const Digraph&, T) { }
   436 
   435 
   437       private:
   436       private:
   438         ///Copy constructor
   437         ///Copy constructor
   439         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   438         NodeMap(const NodeMap& nm) : 
       
   439           ReferenceMap<Node, T, T&, const T&>(nm) { }
   440         ///Assignment operator
   440         ///Assignment operator
   441         template <typename CMap>
   441         template <typename CMap>
   442         NodeMap& operator=(const CMap&) {
   442         NodeMap& operator=(const CMap&) {
   443           checkConcept<ReadMap<Node, T>, CMap>();
   443           checkConcept<ReadMap<Node, T>, CMap>();
   444           return *this;
   444           return *this;
   445         }
   445         }
   446       };
   446       };
   447 
   447 
   448       /// \brief Read write map of the arcs to type \c T.
   448       /// \brief Reference map of the arcs to type \c T.
   449       ///
   449       ///
   450       /// Reference map of the arcs to type \c T.
   450       /// Reference map of the arcs to type \c T.
   451       /// \sa Reference
       
   452       template<class T>
   451       template<class T>
   453       class ArcMap : public ReadWriteMap<Arc,T> {
   452       class ArcMap : public ReferenceMap<Arc, T, T&, const T&> {
   454       public:
   453       public:
   455 
   454 
   456         ///\e
   455         ///\e
   457         ArcMap(const Digraph&) { }
   456         ArcMap(const Digraph&) { }
   458         ///\e
   457         ///\e
   459         ArcMap(const Digraph&, T) { }
   458         ArcMap(const Digraph&, T) { }
   460       private:
   459       private:
   461         ///Copy constructor
   460         ///Copy constructor
   462         ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { }
   461         ArcMap(const ArcMap& em) :
       
   462           ReferenceMap<Arc, T, T&, const T&>(em) { }
   463         ///Assignment operator
   463         ///Assignment operator
   464         template <typename CMap>
   464         template <typename CMap>
   465         ArcMap& operator=(const CMap&) {
   465         ArcMap& operator=(const CMap&) {
   466           checkConcept<ReadMap<Arc, T>, CMap>();
   466           checkConcept<ReadMap<Arc, T>, CMap>();
   467           return *this;
   467           return *this;
   469       };
   469       };
   470 
   470 
   471       template <typename _Digraph>
   471       template <typename _Digraph>
   472       struct Constraints {
   472       struct Constraints {
   473         void constraints() {
   473         void constraints() {
       
   474           checkConcept<BaseDigraphComponent, _Digraph>();
   474           checkConcept<IterableDigraphComponent<>, _Digraph>();
   475           checkConcept<IterableDigraphComponent<>, _Digraph>();
   475           checkConcept<IDableDigraphComponent<>, _Digraph>();
   476           checkConcept<IDableDigraphComponent<>, _Digraph>();
   476           checkConcept<MappableDigraphComponent<>, _Digraph>();
   477           checkConcept<MappableDigraphComponent<>, _Digraph>();
   477         }
   478         }
   478       };
   479       };