diff -r aa19ca32d9b0 -r ca95f8b5c931 src/lemon/concept/graph.h --- a/src/lemon/concept/graph.h Sat Nov 13 17:47:44 2004 +0000 +++ b/src/lemon/concept/graph.h Sat Nov 13 21:37:54 2004 +0000 @@ -101,14 +101,6 @@ // /// // bool operator!=(Node) const { return true; } -// ///Comparison operator. - -// ///This is a strict ordering between the nodes. -// /// -// ///This ordering can be different from the order in which NodeIt -// ///goes through the nodes. -// ///\todo Possibly we don't need it. -// bool operator<(Node) const { return true; } // }; // /// This iterator goes through each node. @@ -188,14 +180,6 @@ // /// \sa operator==(Node n) // /// // bool operator!=(Edge) const { return true; } -// ///Comparison operator. - -// ///This is a strict ordering between the nodes. -// /// -// ///This ordering can be different from the order in which NodeIt -// ///goes through the nodes. -// ///\todo Possibly we don't need it. -// bool operator<(Edge) const { return true; } // }; // /// This iterator goes trough the outgoing edges of a node. @@ -339,30 +323,6 @@ // /// edge of the corresponding node. // EdgeIt& operator++() { return *this; } // }; - -// /// First node of the graph. - -// /// \retval i the first node. -// /// \return the first node. -// /// -// NodeIt& first(NodeIt& i) const { return i; } - -// /// The first incoming edge. - -// /// The first incoming edge. -// /// -// InEdgeIt& first(InEdgeIt &i, Node) const { return i; } -// /// The first outgoing edge. - -// /// The first outgoing edge. -// /// -// OutEdgeIt& first(OutEdgeIt& i, Node) const { return i; } -// /// The first edge of the Graph. - -// /// The first edge of the Graph. -// /// -// EdgeIt& first(EdgeIt& i) const { return i; } - // ///Gives back the target node of an edge. // ///Gives back the target node of an edge. @@ -373,40 +333,15 @@ // ///Gives back the source node of an edge. // /// // Node source(Edge) const { return INVALID; } - -// ///Gives back the \e id of a node. - -// ///\warning Not all graph structures provide this feature. -// /// -// ///\todo Should each graph provide \c id? -// int id(const Node&) const { return 0; } -// ///Gives back the \e id of an edge. - -// ///\warning Not all graph structures provide this feature. -// /// -// ///\todo Should each graph provide \c id? -// int id(const Edge&) const { return 0; } - -// ///\e - -// ///\todo Should it be in the concept? -// /// -// int nodeNum() const { return 0; } -// ///\e - -// ///\todo Should it be in the concept? -// /// -// int edgeNum() const { return 0; } - - -// ///Reference map of the nodes to type \c T. +// /// Read write map of the nodes to type \c T. // /// \ingroup concept -// ///Reference map of the nodes to type \c T. +// /// ReadWrite map of the nodes to type \c T. // /// \sa Reference // /// \warning Making maps that can handle bool type (NodeMap) // /// needs some extra attention! -// template class NodeMap : public ReferenceMap< Node, T > +// template +// class NodeMap : public ReadWriteMap< Node, T > // { // public: @@ -416,21 +351,21 @@ // NodeMap(const StaticGraph&, T) { } // ///Copy constructor -// template NodeMap(const NodeMap&) { } +// NodeMap(const NodeMap&) { } // ///Assignment operator -// template NodeMap& operator=(const NodeMap&) -// { return *this; } +// NodeMap& operator=(const NodeMap&) { return *this; } +// // \todo fix this concept // }; -// ///Reference map of the edges to type \c T. +// /// Read write map of the edges to type \c T. // /// \ingroup concept // ///Reference map of the edges to type \c T. // /// \sa Reference // /// \warning Making maps that can handle bool type (EdgeMap) // /// needs some extra attention! -// template class EdgeMap -// : public ReferenceMap +// template +// class EdgeMap : public ReadWriteMap // { // public: @@ -438,213 +373,14 @@ // EdgeMap(const StaticGraph&) { } // ///\e // EdgeMap(const StaticGraph&, T) { } - // ///Copy constructor -// template EdgeMap(const EdgeMap&) { } +// EdgeMap(const EdgeMap&) { } // ///Assignment operator -// template EdgeMap &operator=(const EdgeMap&) -// { return *this; } +// EdgeMap& operator=(const EdgeMap&) { return *this; } +// // \todo fix this concept // }; // }; -// struct DummyType { -// int value; -// DummyType() {} -// DummyType(int p) : value(p) {} -// DummyType& operator=(int p) { value = p; return *this;} -// }; - -// ///\brief Checks whether \c G meets the -// ///\ref lemon::concept::StaticGraph "StaticGraph" concept -// template void checkCompileStaticGraph(Graph &G) -// { -// typedef typename Graph::Node Node; -// typedef typename Graph::NodeIt NodeIt; -// typedef typename Graph::Edge Edge; -// typedef typename Graph::EdgeIt EdgeIt; -// typedef typename Graph::InEdgeIt InEdgeIt; -// typedef typename Graph::OutEdgeIt OutEdgeIt; - -// { -// Node i; Node j(i); Node k(INVALID); -// i=j; -// bool b; b=true; -// b=(i==INVALID); b=(i!=INVALID); -// b=(i==j); b=(i!=j); b=(iNodeIt conversion -// NodeIt ni(G,n); -// } -// { -// Edge i; Edge j(i); Edge k(INVALID); -// i=j; -// bool b; b=true; -// b=(i==INVALID); b=(i!=INVALID); -// b=(i==j); b=(i!=j); b=(iEdgeIt conversion -// EdgeIt ei(G,e); -// } -// { -// Node n; -// InEdgeIt i; InEdgeIt j(i); InEdgeIt k(INVALID); InEdgeIt l(G,n); -// i=j; -// j=G.first(i,n); -// j=++i; -// bool b; b=true; -// b=(i==INVALID); b=(i!=INVALID); -// Edge e(i); -// e=i; -// b=(i==j); b=(i!=j); b=(iInEdgeIt conversion -// InEdgeIt ei(G,e); -// } -// { -// Node n; -// OutEdgeIt i; OutEdgeIt j(i); OutEdgeIt k(INVALID); OutEdgeIt l(G,n); -// i=j; -// j=G.first(i,n); -// j=++i; -// bool b; b=true; -// b=(i==INVALID); b=(i!=INVALID); -// Edge e(i); -// e=i; -// b=(i==j); b=(i!=j); b=(iOutEdgeIt conversion -// OutEdgeIt ei(G,e); -// } -// { -// Node n,m; -// n=m=INVALID; -// Edge e; -// e=INVALID; -// n=G.source(e); -// n=G.target(e); -// } -// // id tests -// { Node n; int i=G.id(n); i=i; } -// { Edge e; int i=G.id(e); i=i; } -// //NodeMap tests -// { -// Node k; -// typename Graph::template NodeMap m(G); -// //Const map -// typename Graph::template NodeMap const &cm = m; -// //Inicialize with default value -// typename Graph::template NodeMap mdef(G,12); -// //Copy -// typename Graph::template NodeMap mm(cm); -// //Copy from another type -// typename Graph::template NodeMap dm(cm); -// //Copy to more complex type -// typename Graph::template NodeMap em(cm); -// int v; -// v=m[k]; m[k]=v; m.set(k,v); -// v=cm[k]; - -// m=cm; -// dm=cm; //Copy from another type -// em=cm; //Copy to more complex type -// { -// //Check the typedef's -// typename Graph::template NodeMap::Value val; -// val=1; -// typename Graph::template NodeMap::Key key; -// key = typename Graph::NodeIt(G); -// } -// } -// { //bool NodeMap -// Node k; -// typename Graph::template NodeMap m(G); -// typename Graph::template NodeMap const &cm = m; //Const map -// //Inicialize with default value -// typename Graph::template NodeMap mdef(G,12); -// typename Graph::template NodeMap mm(cm); //Copy -// typename Graph::template NodeMap dm(cm); //Copy from another type -// bool v; -// v=m[k]; m[k]=v; m.set(k,v); -// v=cm[k]; - -// m=cm; -// dm=cm; //Copy from another type -// m=dm; //Copy to another type - -// { -// //Check the typedef's -// typename Graph::template NodeMap::Value val; -// val=true; -// typename Graph::template NodeMap::Key key; -// key= typename Graph::NodeIt(G); -// } -// } -// //EdgeMap tests -// { -// Edge k; -// typename Graph::template EdgeMap m(G); -// typename Graph::template EdgeMap const &cm = m; //Const map -// //Inicialize with default value -// typename Graph::template EdgeMap mdef(G,12); -// typename Graph::template EdgeMap mm(cm); //Copy -// typename Graph::template EdgeMap dm(cm);//Copy from another type -// int v; -// v=m[k]; m[k]=v; m.set(k,v); -// v=cm[k]; - -// m=cm; -// dm=cm; //Copy from another type -// { -// //Check the typedef's -// typename Graph::template EdgeMap::Value val; -// val=1; -// typename Graph::template EdgeMap::Key key; -// key= typename Graph::EdgeIt(G); -// } -// } -// { //bool EdgeMap -// Edge k; -// typename Graph::template EdgeMap m(G); -// typename Graph::template EdgeMap const &cm = m; //Const map -// //Inicialize with default value -// typename Graph::template EdgeMap mdef(G,12); -// typename Graph::template EdgeMap mm(cm); //Copy -// typename Graph::template EdgeMap dm(cm); //Copy from another type -// bool v; -// v=m[k]; m[k]=v; m.set(k,v); -// v=cm[k]; - -// m=cm; -// dm=cm; //Copy from another type -// m=dm; //Copy to another type -// { -// //Check the typedef's -// typename Graph::template EdgeMap::Value val; -// val=true; -// typename Graph::template EdgeMap::Key key; -// key= typename Graph::EdgeIt(G); -// } -// } -// } - // /// An empty non-static graph class. // /// This class provides everything that \ref StaticGraph @@ -665,10 +401,10 @@ // Node addNode() { return INVALID; } // ///Add a new edge to the graph. -// ///Add a new edge to the graph with source node \c t -// ///and target node \c h. +// ///Add a new edge to the graph with source node \c s +// ///and target node \c t. // ///\return the new edge. -// Edge addEdge(Node h, Node t) { return INVALID; } +// Edge addEdge(Node s, Node t) { return INVALID; } // /// Resets the graph. @@ -678,30 +414,6 @@ // void clear() { } // }; - -// ///\brief Checks whether \c G meets the -// ///\ref lemon::concept::ExtendableGraph "ExtendableGraph" concept -// template void checkCompileExtendableGraph(Graph &G) -// { -// checkCompileStaticGraph(G); - -// typedef typename Graph::Node Node; -// typedef typename Graph::NodeIt NodeIt; -// typedef typename Graph::Edge Edge; -// typedef typename Graph::EdgeIt EdgeIt; -// typedef typename Graph::InEdgeIt InEdgeIt; -// typedef typename Graph::OutEdgeIt OutEdgeIt; - -// Node n,m; -// n=G.addNode(); -// m=G.addNode(); -// Edge e; -// e=G.addEdge(n,m); - -// // G.clear(); -// } - - // /// An empty erasable graph class. // /// This class is an extension of \ref ExtendableGraph. It also makes it @@ -725,43 +437,8 @@ // /// // void erase(Edge e) { } // }; + -// template void checkCompileGraphEraseEdge(Graph &G) -// { -// typename Graph::Edge e; -// G.erase(e); -// } - -// template void checkCompileGraphEraseNode(Graph &G) -// { -// typename Graph::Node n; -// G.erase(n); -// } - -// ///\brief Checks whether \c G meets the -// ///\ref lemon::concept::EresableGraph "EresableGraph" concept -// template void checkCompileErasableGraph(Graph &G) -// { -// checkCompileExtendableGraph(G); -// checkCompileGraphEraseNode(G); -// checkCompileGraphEraseEdge(G); -// } - -// ///Checks whether a graph has findEdge() member function. - -// ///\todo findEdge() might be a global function. -// /// -// template void checkCompileGraphFindEdge(Graph &G) -// { -// typedef typename Graph::NodeIt Node; -// typedef typename Graph::NodeIt NodeIt; - -// G.findEdge(NodeIt(G),++NodeIt(G),G.findEdge(NodeIt(G),++NodeIt(G))); -// G.findEdge(Node(),Node(),G.findEdge(Node(),Node())); -// } - - - /************* New GraphBase stuff **************/ @@ -815,10 +492,10 @@ // a required...) template - class NodeMap : public GraphMap {}; + class NodeMap : public GraphMap {}; template - class EdgeMap : public GraphMap {}; + class EdgeMap : public GraphMap {}; }; @@ -833,14 +510,14 @@ public: typedef BaseGraphComponent::Node Node; typedef BaseGraphComponent::Edge Edge; - }; - template - struct StaticGraphConcept { - void constraints() { - function_requires >(); - function_requires >(); - } + template + struct Constraints { + void constraints() { + checkConcept(); + checkConcept(); + } + }; }; class ExtendableGraph @@ -849,15 +526,15 @@ public: typedef BaseGraphComponent::Node Node; typedef BaseGraphComponent::Edge Edge; - }; - template - struct ExtendableGraphConcept { - void constraints() { - function_requires >(); - function_requires >(); - function_requires >(); - } + template + struct Constraints { + void constraints() { + checkConcept(); + checkConcept(); + checkConcept(); + } + }; }; class ErasableGraph @@ -866,14 +543,14 @@ public: typedef BaseGraphComponent::Node Node; typedef BaseGraphComponent::Edge Edge; - }; - template - struct ErasableGraphConcept { - void constraints() { - function_requires >(); - function_requires >(); - } + template + struct Constraints { + void constraints() { + checkConcept(); + checkConcept(); + } + }; }; // @}