lemon/concept/bpugraph.h
changeset 2252 133028e83940
parent 2163 bef3457be038
equal deleted inserted replaced
9:08a809dfb53e 10:2cef035f7870
   130       /// \brief Helper class for ANodes.
   130       /// \brief Helper class for ANodes.
   131       ///
   131       ///
   132       /// This class is just a helper class for ANodes, it is not
   132       /// This class is just a helper class for ANodes, it is not
   133       /// suggested to use it directly. It can be converted easily to
   133       /// suggested to use it directly. It can be converted easily to
   134       /// node and vice versa. The usage of this class is limited
   134       /// node and vice versa. The usage of this class is limited
   135       /// two use just as template parameters for special map types. 
   135       /// to use just as template parameters for special map types. 
   136       class ANode {
   136       class ANode : public Node {
   137       public:
   137       public:
   138         /// Default constructor
   138         /// Default constructor
   139 
   139 
   140         /// @warning The default constructor sets the iterator
   140         /// @warning The default constructor sets the iterator
   141         /// to an undefined value.
   141         /// to an undefined value.
   142         ANode() { }
   142         ANode() : Node() { }
   143         /// Copy constructor.
   143         /// Copy constructor.
   144 
   144 
   145         /// Copy constructor.
   145         /// Copy constructor.
   146         ///
   146         ///
   147         ANode(const ANode&) { }
   147         ANode(const ANode&) : Node() { }
   148 
   148 
   149         /// Construct the same node as ANode.
   149         /// Construct the same node as ANode.
   150 
   150 
   151         /// Construct the same node as ANode. It may throws assertion
   151         /// Construct the same node as ANode. It may throws assertion
   152         /// when the given node is from the BNode set.
   152         /// when the given node is from the BNode set.
   153         ANode(const Node&) { }
   153         ANode(const Node&) : Node() { }
       
   154 
       
   155         /// Assign node to A-node.
       
   156 
       
   157         /// Besides the core graph item functionality each node should
       
   158         /// be convertible to the represented A-node if it is it possible. 
       
   159         ANode& operator=(const Node&) { return *this; }
   154 
   160 
   155         /// Invalid constructor \& conversion.
   161         /// Invalid constructor \& conversion.
   156 
   162 
   157         /// This constructor initializes the iterator to be invalid.
   163         /// This constructor initializes the iterator to be invalid.
   158         /// \sa Invalid for more details.
   164         /// \sa Invalid for more details.
   184       /// \brief Helper class for BNodes.
   190       /// \brief Helper class for BNodes.
   185       ///
   191       ///
   186       /// This class is just a helper class for BNodes, it is not
   192       /// This class is just a helper class for BNodes, it is not
   187       /// suggested to use it directly. It can be converted easily to
   193       /// suggested to use it directly. It can be converted easily to
   188       /// node and vice versa. The usage of this class is limited
   194       /// node and vice versa. The usage of this class is limited
   189       /// two use just as template parameters for special map types. 
   195       /// to use just as template parameters for special map types. 
   190       class BNode {
   196       class BNode : public Node {
   191       public:
   197       public:
   192         /// Default constructor
   198         /// Default constructor
   193 
   199 
   194         /// @warning The default constructor sets the iterator
   200         /// @warning The default constructor sets the iterator
   195         /// to an undefined value.
   201         /// to an undefined value.
   196         BNode() { }
   202         BNode() : Node() { }
   197         /// Copy constructor.
   203         /// Copy constructor.
   198 
   204 
   199         /// Copy constructor.
   205         /// Copy constructor.
   200         ///
   206         ///
   201         BNode(const BNode&) { }
   207         BNode(const BNode&) : Node() { }
   202 
   208 
   203         /// Construct the same node as BNode.
   209         /// Construct the same node as BNode.
   204 
   210 
   205         /// Construct the same node as BNode. It may throws assertion
   211         /// Construct the same node as BNode. It may throws assertion
   206         /// when the given node is from the ANode set.
   212         /// when the given node is from the ANode set.
   207         BNode(const Node&) { }
   213         BNode(const Node&) : Node() { }
       
   214 
       
   215         /// Assign node to B-node.
       
   216 
       
   217         /// Besides the core graph item functionality each node should
       
   218         /// be convertible to the represented B-node if it is it possible. 
       
   219         BNode& operator=(const Node&) { return *this; }
   208 
   220 
   209         /// Invalid constructor \& conversion.
   221         /// Invalid constructor \& conversion.
   210 
   222 
   211         /// This constructor initializes the iterator to be invalid.
   223         /// This constructor initializes the iterator to be invalid.
   212         /// \sa Invalid for more details.
   224         /// \sa Invalid for more details.
   715 
   727 
   716         ///Copy constructor
   728         ///Copy constructor
   717         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   729         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   718         ///Assignment operator
   730         ///Assignment operator
   719         NodeMap& operator=(const NodeMap&) { return *this; }
   731         NodeMap& operator=(const NodeMap&) { return *this; }
   720         // \todo fix this concept
   732         ///Assignment operator
       
   733         template <typename CMap>
       
   734         NodeMap& operator=(const CMap&) { 
       
   735           checkConcept<ReadMap<Node, T>, CMap>();
       
   736           return *this; 
       
   737         }
   721       };
   738       };
   722 
   739 
   723       /// \brief Read write map of the ANodes to type \c T.
   740       /// \brief Read write map of the ANodes to type \c T.
   724       /// 
   741       /// 
   725       /// ReadWrite map of the ANodes to type \c T.
   742       /// ReadWrite map of the ANodes to type \c T.
   736         ANodeMap(const BpUGraph&) { }
   753         ANodeMap(const BpUGraph&) { }
   737         ///\e
   754         ///\e
   738         ANodeMap(const BpUGraph&, T) { }
   755         ANodeMap(const BpUGraph&, T) { }
   739 
   756 
   740         ///Copy constructor
   757         ///Copy constructor
   741         ANodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   758         ANodeMap(const ANodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   742         ///Assignment operator
   759         ///Assignment operator
   743         ANodeMap& operator=(const NodeMap&) { return *this; }
   760         ANodeMap& operator=(const ANodeMap&) { return *this; }
   744         // \todo fix this concept
   761         ///Assignment operator
       
   762         template <typename CMap>
       
   763         ANodeMap& operator=(const CMap&) { 
       
   764           checkConcept<ReadMap<Node, T>, CMap>();
       
   765           return *this; 
       
   766         }
   745       };
   767       };
   746 
   768 
   747       /// \brief Read write map of the BNodes to type \c T.
   769       /// \brief Read write map of the BNodes to type \c T.
   748       /// 
   770       /// 
   749       /// ReadWrite map of the BNodes to type \c T.
   771       /// ReadWrite map of the BNodes to type \c T.
   760         BNodeMap(const BpUGraph&) { }
   782         BNodeMap(const BpUGraph&) { }
   761         ///\e
   783         ///\e
   762         BNodeMap(const BpUGraph&, T) { }
   784         BNodeMap(const BpUGraph&, T) { }
   763 
   785 
   764         ///Copy constructor
   786         ///Copy constructor
   765         BNodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   787         BNodeMap(const BNodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   766         ///Assignment operator
   788         ///Assignment operator
   767         BNodeMap& operator=(const NodeMap&) { return *this; }
   789         BNodeMap& operator=(const BNodeMap&) { return *this; }
   768         // \todo fix this concept
   790         ///Assignment operator
       
   791         template <typename CMap>
       
   792         BNodeMap& operator=(const CMap&) { 
       
   793           checkConcept<ReadMap<Node, T>, CMap>();
       
   794           return *this; 
       
   795         }
   769       };
   796       };
   770 
   797 
   771       /// \brief Read write map of the directed edges to type \c T.
   798       /// \brief Read write map of the directed edges to type \c T.
   772       ///
   799       ///
   773       /// Reference map of the directed edges to type \c T.
   800       /// Reference map of the directed edges to type \c T.
   786         EdgeMap(const BpUGraph&, T) { }
   813         EdgeMap(const BpUGraph&, T) { }
   787         ///Copy constructor
   814         ///Copy constructor
   788         EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
   815         EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
   789         ///Assignment operator
   816         ///Assignment operator
   790         EdgeMap& operator=(const EdgeMap&) { return *this; }
   817         EdgeMap& operator=(const EdgeMap&) { return *this; }
   791         // \todo fix this concept    
   818         ///Assignment operator
       
   819         template <typename CMap>
       
   820         EdgeMap& operator=(const CMap&) { 
       
   821           checkConcept<ReadMap<Edge, T>, CMap>();
       
   822           return *this; 
       
   823         }
   792       };
   824       };
   793 
   825 
   794       /// Read write map of the undirected edges to type \c T.
   826       /// Read write map of the undirected edges to type \c T.
   795 
   827 
   796       /// Reference map of the edges to type \c T.
   828       /// Reference map of the edges to type \c T.
   809         UEdgeMap(const BpUGraph&, T) { }
   841         UEdgeMap(const BpUGraph&, T) { }
   810         ///Copy constructor
   842         ///Copy constructor
   811         UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
   843         UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
   812         ///Assignment operator
   844         ///Assignment operator
   813         UEdgeMap &operator=(const UEdgeMap&) { return *this; }
   845         UEdgeMap &operator=(const UEdgeMap&) { return *this; }
   814         // \todo fix this concept    
   846         ///Assignment operator
       
   847         template <typename CMap>
       
   848         UEdgeMap& operator=(const CMap&) { 
       
   849           checkConcept<ReadMap<UEdge, T>, CMap>();
       
   850           return *this; 
       
   851         }
   815       };
   852       };
   816 
   853 
   817       /// \brief Direct the given undirected edge.
   854       /// \brief Direct the given undirected edge.
   818       ///
   855       ///
   819       /// Direct the given undirected edge. The returned edge source
   856       /// Direct the given undirected edge. The returned edge source
   931       /// Returns the running node of the iterator
   968       /// Returns the running node of the iterator
   932       Node runningNode(IncEdgeIt) const {
   969       Node runningNode(IncEdgeIt) const {
   933 	return INVALID;
   970 	return INVALID;
   934       }
   971       }
   935 
   972 
       
   973       void first(Node&) const {}
       
   974       void next(Node&) const {}
       
   975 
       
   976       void first(Edge&) const {}
       
   977       void next(Edge&) const {}
       
   978 
       
   979       void first(UEdge&) const {}
       
   980       void next(UEdge&) const {}
       
   981 
       
   982       void firstANode(Node&) const {}
       
   983       void nextANode(Node&) const {}
       
   984 
       
   985       void firstBNode(Node&) const {}
       
   986       void nextBNode(Node&) const {}
       
   987 
       
   988       void firstIn(Edge&, const Node&) const {}
       
   989       void nextIn(Edge&) const {}
       
   990 
       
   991       void firstOut(Edge&, const Node&) const {}
       
   992       void nextOut(Edge&) const {}
       
   993 
       
   994       void firstInc(UEdge &, bool &, const Node &) const {}
       
   995       void nextInc(UEdge &, bool &) const {}
       
   996 
       
   997       void firstFromANode(UEdge&, const Node&) const {}
       
   998       void nextFromANode(UEdge&) const {}
       
   999 
       
  1000       void firstFromBNode(UEdge&, const Node&) const {}
       
  1001       void nextFromBNode(UEdge&) const {}
       
  1002 
   936       template <typename Graph>
  1003       template <typename Graph>
   937       struct Constraints {
  1004       struct Constraints {
   938 	void constraints() {
  1005 	void constraints() {
       
  1006 	  checkConcept<IterableBpUGraphComponent<>, Graph>();
       
  1007 	  checkConcept<MappableBpUGraphComponent<>, Graph>();
   939 	}
  1008 	}
   940       };
  1009       };
   941 
  1010 
   942     };
  1011     };
   943 
  1012