# HG changeset patch # User alpar # Date 1152634189 0 # Node ID 509846825ddf8179d6f0ab91ed3da75d845ede44 # Parent 1d43a276fc26888d328f07b8fae2577001a14ba7 - Disable the copy constructor and operator= of {List|Smart}[U]Graph. - Improve graph doc - Also put private members into the doc (if they are documented) diff -r 1d43a276fc26 -r 509846825ddf doc/Doxyfile.in --- a/doc/Doxyfile.in Tue Jul 11 15:50:19 2006 +0000 +++ b/doc/Doxyfile.in Tue Jul 11 16:09:49 2006 +0000 @@ -224,12 +224,12 @@ # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. -EXTRACT_PRIVATE = NO +EXTRACT_PRIVATE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. -EXTRACT_STATIC = NO +EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. @@ -581,7 +581,7 @@ # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. -VERBATIM_HEADERS = YES +VERBATIM_HEADERS = NO #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index diff -r 1d43a276fc26 -r 509846825ddf lemon/concept/graph.h --- a/lemon/concept/graph.h Tue Jul 11 15:50:19 2006 +0000 +++ b/lemon/concept/graph.h Tue Jul 11 16:09:49 2006 +0000 @@ -53,14 +53,11 @@ /// Defalult constructor. /// Graph() { } + /// Class for identifying a node of the graph - /// The base type of node iterators, - /// or in other words, the trivial node iterator. - - /// This is the base type of each node iterator, - /// thus each kind of node iterator converts to this. - /// More precisely each kind of node iterator should be inherited - /// from the trivial node iterator. + /// This class identifies a node of the graph. It also serves + /// as a base class of the node iterators, + /// thus they will convert to this type. class Node { public: /// Default constructor @@ -149,10 +146,11 @@ }; - /// The base type of the edge iterators. + /// Class for identifying an edge of the graph - /// The base type of the edge iterators. - /// + /// This class identifies an edge of the graph. It also serves + /// as a base class of the edge iterators, + /// thus they will convert to this type. class Edge { public: /// Default constructor @@ -384,8 +382,6 @@ /// /// 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 ReadWriteMap< Node, T > { public: @@ -409,8 +405,6 @@ /// /// 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 ReadWriteMap { public: diff -r 1d43a276fc26 -r 509846825ddf lemon/list_graph.h --- a/lemon/list_graph.h Tue Jul 11 15:50:19 2006 +0000 +++ b/lemon/list_graph.h Tue Jul 11 16:09:49 2006 +0000 @@ -325,10 +325,28 @@ ///\sa concept::Graph. class ListGraph : public ExtendedListGraphBase { + private: + ///ListGraph is \e not copy constructible. Use GraphCopy() instead. + + ///ListGraph is \e not copy constructible. Use GraphCopy() instead. + /// + ListGraph(const ListGraph &) :ExtendedListGraphBase() {}; + ///\brief Assignment of ListGraph to another is \e not allowed. + ///Use GraphCopy() instead. + + ///Assignment of ListGraph to another is \e not allowed. + ///Use GraphCopy() instead. + void operator=(const ListGraph &) {} public: typedef ExtendedListGraphBase Parent; + /// Constructor + + /// Constructor. + /// + ListGraph() {} + ///Add a new node to the graph. /// \return the new node. @@ -736,7 +754,25 @@ ///haven't been implemented yet. /// class ListUGraph : public ExtendedListUGraphBase { + private: + ///ListUGraph is \e not copy constructible. Use UGraphCopy() instead. + + ///ListUGraph is \e not copy constructible. Use UGraphCopy() instead. + /// + ListUGraph(const ListUGraph &) :ExtendedListUGraphBase() {}; + ///\brief Assignment of ListUGraph to another is \e not allowed. + ///Use UGraphCopy() instead. + + ///Assignment of ListUGraph to another is \e not allowed. + ///Use UGraphCopy() instead. + void operator=(const ListUGraph &) {} public: + /// Constructor + + /// Constructor. + /// + ListUGraph() {} + typedef ExtendedListUGraphBase Parent; /// \brief Add a new node to the graph. /// @@ -1131,7 +1167,11 @@ edges[edge.id].next_out = first_free_edge; first_free_edge = edge.id; } - + + ///\e + + ///\bug Undocumented + ///\bug Doesn't destruct the maps. void clear() { aNodes.clear(); bNodes.clear(); diff -r 1d43a276fc26 -r 509846825ddf lemon/smart_graph.h --- a/lemon/smart_graph.h Tue Jul 11 15:50:19 2006 +0000 +++ b/lemon/smart_graph.h Tue Jul 11 16:09:49 2006 +0000 @@ -97,6 +97,23 @@ ///\sa id(Edge) int maxEdgeId() const { return edges.size()-1; } + Node addNode() { + Node n; n.n=nodes.size(); + nodes.push_back(NodeT()); //FIXME: Hmmm... + return n; + } + + Edge addEdge(Node u, Node v) { + Edge e; e.n=edges.size(); edges.push_back(EdgeT()); //FIXME: Hmmm... + edges[e.n].source=u.n; edges[e.n].target=v.n; + edges[e.n].next_out=nodes[u.n].first_out; + edges[e.n].next_in=nodes[v.n].first_in; + nodes[u.n].first_out=nodes[v.n].first_in=e.n; + + return e; + } + + Node source(Edge e) const { return edges[e.n].source; } Node target(Edge e) const { return edges[e.n].target; } @@ -131,28 +148,6 @@ /// with the given id the effect of the function is undefinied. static Edge edgeFromId(int id) { return Edge(id);} - Node addNode() { - Node n; n.n=nodes.size(); - nodes.push_back(NodeT()); //FIXME: Hmmm... - return n; - } - - Edge addEdge(Node u, Node v) { - Edge e; e.n=edges.size(); edges.push_back(EdgeT()); //FIXME: Hmmm... - edges[e.n].source=u.n; edges[e.n].target=v.n; - edges[e.n].next_out=nodes[u.n].first_out; - edges[e.n].next_in=nodes[v.n].first_in; - nodes[u.n].first_out=nodes[v.n].first_in=e.n; - - return e; - } - - void clear() { - edges.clear(); - nodes.clear(); - } - - class Node { friend class SmartGraphBase; friend class SmartGraph; @@ -216,16 +211,6 @@ edge.n = edges[edge.n].next_in; } - Node _split(Node n, bool connect = true) - { - Node b = addNode(); - nodes[b.n].first_out=nodes[n.n].first_out; - nodes[n.n].first_out=-1; - for(int i=nodes[b.n].first_out;i!=-1;i++) edges[i].source=b.n; - if(connect) addEdge(n,b); - return b; - } - }; typedef GraphExtender ExtendedSmartGraphBase; @@ -251,6 +236,18 @@ class Snapshot; friend class Snapshot; + private: + ///SmartGraph is \e not copy constructible. Use GraphCopy() instead. + + ///SmartGraph is \e not copy constructible. Use GraphCopy() instead. + /// + SmartGraph(const SmartGraph &) :ExtendedSmartGraphBase() {}; + ///\brief Assignment of SmartGraph to another is \e not allowed. + ///Use GraphCopy() instead. + + ///Assignment of SmartGraph to another is \e not allowed. + ///Use GraphCopy() instead. + void operator=(const SmartGraph &) {} protected: void restoreSnapshot(const Snapshot &s) { @@ -268,6 +265,36 @@ } public: + + /// Constructor + + /// Constructor. + /// + SmartGraph() {}; + + ///Add a new node to the graph. + + /// \return the new node. + /// + Node addNode() { return Parent::addNode(); } + + ///Add a new edge to the graph. + + ///Add a new edge to the graph with source node \c s + ///and target node \c t. + ///\return the new edge. + Edge addEdge(const Node& s, const Node& t) { + return Parent::addEdge(s, t); + } + + ///\e + + ///\bug Undocumented + ///\bug Doesn't destruct the maps. + void clear() { + edges.clear(); + nodes.clear(); + } ///Split a node. @@ -284,12 +311,15 @@ ///\warning This functionality cannot be used together with the Snapshot ///feature. ///\todo It could be implemented in a bit faster way. - Node split(Node n, bool connect = true) + Node split(Node n, bool connect = true) { - Node b = _split(n,connect); + Node b = addNode(); + nodes[b.n].first_out=nodes[n.n].first_out; + nodes[n.n].first_out=-1; + for(int i=nodes[b.n].first_out;i!=-1;i++) edges[i].source=b.n; + if(connect) addEdge(n,b); return b; } - ///Class to make a snapshot of the graph and to restrore to it later. @@ -376,6 +406,24 @@ /// \todo Snapshot hasn't been implemented yet. /// class SmartUGraph : public ExtendedSmartUGraphBase { + private: + ///SmartUGraph is \e not copy constructible. Use UGraphCopy() instead. + + ///SmartUGraph is \e not copy constructible. Use UGraphCopy() instead. + /// + SmartUGraph(const SmartUGraph &) : ExtendedSmartUGraphBase() {}; + ///\brief Assignment of SmartUGraph to another is \e not allowed. + ///Use UGraphCopy() instead. + + ///Assignment of SmartUGraph to another is \e not allowed. + ///Use UGraphCopy() instead. + void operator=(const SmartUGraph &) {} + public: + /// Constructor + + /// Constructor. + /// + SmartUGraph() {} };