- 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)
1.1 --- a/doc/Doxyfile.in Tue Jul 11 15:50:19 2006 +0000
1.2 +++ b/doc/Doxyfile.in Tue Jul 11 16:09:49 2006 +0000
1.3 @@ -224,12 +224,12 @@
1.4 # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
1.5 # will be included in the documentation.
1.6
1.7 -EXTRACT_PRIVATE = NO
1.8 +EXTRACT_PRIVATE = YES
1.9
1.10 # If the EXTRACT_STATIC tag is set to YES all static members of a file
1.11 # will be included in the documentation.
1.12
1.13 -EXTRACT_STATIC = NO
1.14 +EXTRACT_STATIC = YES
1.15
1.16 # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
1.17 # defined locally in source files will be included in the documentation.
1.18 @@ -581,7 +581,7 @@
1.19 # will generate a verbatim copy of the header file for each class for
1.20 # which an include is specified. Set to NO to disable this.
1.21
1.22 -VERBATIM_HEADERS = YES
1.23 +VERBATIM_HEADERS = NO
1.24
1.25 #---------------------------------------------------------------------------
1.26 # configuration options related to the alphabetical class index
2.1 --- a/lemon/concept/graph.h Tue Jul 11 15:50:19 2006 +0000
2.2 +++ b/lemon/concept/graph.h Tue Jul 11 16:09:49 2006 +0000
2.3 @@ -53,14 +53,11 @@
2.4 /// Defalult constructor.
2.5 ///
2.6 Graph() { }
2.7 + /// Class for identifying a node of the graph
2.8
2.9 - /// The base type of node iterators,
2.10 - /// or in other words, the trivial node iterator.
2.11 -
2.12 - /// This is the base type of each node iterator,
2.13 - /// thus each kind of node iterator converts to this.
2.14 - /// More precisely each kind of node iterator should be inherited
2.15 - /// from the trivial node iterator.
2.16 + /// This class identifies a node of the graph. It also serves
2.17 + /// as a base class of the node iterators,
2.18 + /// thus they will convert to this type.
2.19 class Node {
2.20 public:
2.21 /// Default constructor
2.22 @@ -149,10 +146,11 @@
2.23 };
2.24
2.25
2.26 - /// The base type of the edge iterators.
2.27 + /// Class for identifying an edge of the graph
2.28
2.29 - /// The base type of the edge iterators.
2.30 - ///
2.31 + /// This class identifies an edge of the graph. It also serves
2.32 + /// as a base class of the edge iterators,
2.33 + /// thus they will convert to this type.
2.34 class Edge {
2.35 public:
2.36 /// Default constructor
2.37 @@ -384,8 +382,6 @@
2.38 ///
2.39 /// ReadWrite map of the nodes to type \c T.
2.40 /// \sa Reference
2.41 - /// \warning Making maps that can handle bool type (NodeMap<bool>)
2.42 - /// needs some extra attention!
2.43 template<class T>
2.44 class NodeMap : public ReadWriteMap< Node, T > {
2.45 public:
2.46 @@ -409,8 +405,6 @@
2.47 ///
2.48 /// Reference map of the edges to type \c T.
2.49 /// \sa Reference
2.50 - /// \warning Making maps that can handle bool type (EdgeMap<bool>)
2.51 - /// needs some extra attention!
2.52 template<class T>
2.53 class EdgeMap : public ReadWriteMap<Edge,T> {
2.54 public:
3.1 --- a/lemon/list_graph.h Tue Jul 11 15:50:19 2006 +0000
3.2 +++ b/lemon/list_graph.h Tue Jul 11 16:09:49 2006 +0000
3.3 @@ -325,10 +325,28 @@
3.4 ///\sa concept::Graph.
3.5
3.6 class ListGraph : public ExtendedListGraphBase {
3.7 + private:
3.8 + ///ListGraph is \e not copy constructible. Use GraphCopy() instead.
3.9 +
3.10 + ///ListGraph is \e not copy constructible. Use GraphCopy() instead.
3.11 + ///
3.12 + ListGraph(const ListGraph &) :ExtendedListGraphBase() {};
3.13 + ///\brief Assignment of ListGraph to another is \e not allowed.
3.14 + ///Use GraphCopy() instead.
3.15 +
3.16 + ///Assignment of ListGraph to another is \e not allowed.
3.17 + ///Use GraphCopy() instead.
3.18 + void operator=(const ListGraph &) {}
3.19 public:
3.20
3.21 typedef ExtendedListGraphBase Parent;
3.22
3.23 + /// Constructor
3.24 +
3.25 + /// Constructor.
3.26 + ///
3.27 + ListGraph() {}
3.28 +
3.29 ///Add a new node to the graph.
3.30
3.31 /// \return the new node.
3.32 @@ -736,7 +754,25 @@
3.33 ///haven't been implemented yet.
3.34 ///
3.35 class ListUGraph : public ExtendedListUGraphBase {
3.36 + private:
3.37 + ///ListUGraph is \e not copy constructible. Use UGraphCopy() instead.
3.38 +
3.39 + ///ListUGraph is \e not copy constructible. Use UGraphCopy() instead.
3.40 + ///
3.41 + ListUGraph(const ListUGraph &) :ExtendedListUGraphBase() {};
3.42 + ///\brief Assignment of ListUGraph to another is \e not allowed.
3.43 + ///Use UGraphCopy() instead.
3.44 +
3.45 + ///Assignment of ListUGraph to another is \e not allowed.
3.46 + ///Use UGraphCopy() instead.
3.47 + void operator=(const ListUGraph &) {}
3.48 public:
3.49 + /// Constructor
3.50 +
3.51 + /// Constructor.
3.52 + ///
3.53 + ListUGraph() {}
3.54 +
3.55 typedef ExtendedListUGraphBase Parent;
3.56 /// \brief Add a new node to the graph.
3.57 ///
3.58 @@ -1131,7 +1167,11 @@
3.59 edges[edge.id].next_out = first_free_edge;
3.60 first_free_edge = edge.id;
3.61 }
3.62 -
3.63 +
3.64 + ///\e
3.65 +
3.66 + ///\bug Undocumented
3.67 + ///\bug Doesn't destruct the maps.
3.68 void clear() {
3.69 aNodes.clear();
3.70 bNodes.clear();
4.1 --- a/lemon/smart_graph.h Tue Jul 11 15:50:19 2006 +0000
4.2 +++ b/lemon/smart_graph.h Tue Jul 11 16:09:49 2006 +0000
4.3 @@ -97,6 +97,23 @@
4.4 ///\sa id(Edge)
4.5 int maxEdgeId() const { return edges.size()-1; }
4.6
4.7 + Node addNode() {
4.8 + Node n; n.n=nodes.size();
4.9 + nodes.push_back(NodeT()); //FIXME: Hmmm...
4.10 + return n;
4.11 + }
4.12 +
4.13 + Edge addEdge(Node u, Node v) {
4.14 + Edge e; e.n=edges.size(); edges.push_back(EdgeT()); //FIXME: Hmmm...
4.15 + edges[e.n].source=u.n; edges[e.n].target=v.n;
4.16 + edges[e.n].next_out=nodes[u.n].first_out;
4.17 + edges[e.n].next_in=nodes[v.n].first_in;
4.18 + nodes[u.n].first_out=nodes[v.n].first_in=e.n;
4.19 +
4.20 + return e;
4.21 + }
4.22 +
4.23 +
4.24 Node source(Edge e) const { return edges[e.n].source; }
4.25 Node target(Edge e) const { return edges[e.n].target; }
4.26
4.27 @@ -131,28 +148,6 @@
4.28 /// with the given id the effect of the function is undefinied.
4.29 static Edge edgeFromId(int id) { return Edge(id);}
4.30
4.31 - Node addNode() {
4.32 - Node n; n.n=nodes.size();
4.33 - nodes.push_back(NodeT()); //FIXME: Hmmm...
4.34 - return n;
4.35 - }
4.36 -
4.37 - Edge addEdge(Node u, Node v) {
4.38 - Edge e; e.n=edges.size(); edges.push_back(EdgeT()); //FIXME: Hmmm...
4.39 - edges[e.n].source=u.n; edges[e.n].target=v.n;
4.40 - edges[e.n].next_out=nodes[u.n].first_out;
4.41 - edges[e.n].next_in=nodes[v.n].first_in;
4.42 - nodes[u.n].first_out=nodes[v.n].first_in=e.n;
4.43 -
4.44 - return e;
4.45 - }
4.46 -
4.47 - void clear() {
4.48 - edges.clear();
4.49 - nodes.clear();
4.50 - }
4.51 -
4.52 -
4.53 class Node {
4.54 friend class SmartGraphBase;
4.55 friend class SmartGraph;
4.56 @@ -216,16 +211,6 @@
4.57 edge.n = edges[edge.n].next_in;
4.58 }
4.59
4.60 - Node _split(Node n, bool connect = true)
4.61 - {
4.62 - Node b = addNode();
4.63 - nodes[b.n].first_out=nodes[n.n].first_out;
4.64 - nodes[n.n].first_out=-1;
4.65 - for(int i=nodes[b.n].first_out;i!=-1;i++) edges[i].source=b.n;
4.66 - if(connect) addEdge(n,b);
4.67 - return b;
4.68 - }
4.69 -
4.70 };
4.71
4.72 typedef GraphExtender<SmartGraphBase> ExtendedSmartGraphBase;
4.73 @@ -251,6 +236,18 @@
4.74 class Snapshot;
4.75 friend class Snapshot;
4.76
4.77 + private:
4.78 + ///SmartGraph is \e not copy constructible. Use GraphCopy() instead.
4.79 +
4.80 + ///SmartGraph is \e not copy constructible. Use GraphCopy() instead.
4.81 + ///
4.82 + SmartGraph(const SmartGraph &) :ExtendedSmartGraphBase() {};
4.83 + ///\brief Assignment of SmartGraph to another is \e not allowed.
4.84 + ///Use GraphCopy() instead.
4.85 +
4.86 + ///Assignment of SmartGraph to another is \e not allowed.
4.87 + ///Use GraphCopy() instead.
4.88 + void operator=(const SmartGraph &) {}
4.89 protected:
4.90 void restoreSnapshot(const Snapshot &s)
4.91 {
4.92 @@ -268,6 +265,36 @@
4.93 }
4.94
4.95 public:
4.96 +
4.97 + /// Constructor
4.98 +
4.99 + /// Constructor.
4.100 + ///
4.101 + SmartGraph() {};
4.102 +
4.103 + ///Add a new node to the graph.
4.104 +
4.105 + /// \return the new node.
4.106 + ///
4.107 + Node addNode() { return Parent::addNode(); }
4.108 +
4.109 + ///Add a new edge to the graph.
4.110 +
4.111 + ///Add a new edge to the graph with source node \c s
4.112 + ///and target node \c t.
4.113 + ///\return the new edge.
4.114 + Edge addEdge(const Node& s, const Node& t) {
4.115 + return Parent::addEdge(s, t);
4.116 + }
4.117 +
4.118 + ///\e
4.119 +
4.120 + ///\bug Undocumented
4.121 + ///\bug Doesn't destruct the maps.
4.122 + void clear() {
4.123 + edges.clear();
4.124 + nodes.clear();
4.125 + }
4.126
4.127 ///Split a node.
4.128
4.129 @@ -284,12 +311,15 @@
4.130 ///\warning This functionality cannot be used together with the Snapshot
4.131 ///feature.
4.132 ///\todo It could be implemented in a bit faster way.
4.133 - Node split(Node n, bool connect = true)
4.134 + Node split(Node n, bool connect = true)
4.135 {
4.136 - Node b = _split(n,connect);
4.137 + Node b = addNode();
4.138 + nodes[b.n].first_out=nodes[n.n].first_out;
4.139 + nodes[n.n].first_out=-1;
4.140 + for(int i=nodes[b.n].first_out;i!=-1;i++) edges[i].source=b.n;
4.141 + if(connect) addEdge(n,b);
4.142 return b;
4.143 }
4.144 -
4.145
4.146 ///Class to make a snapshot of the graph and to restrore to it later.
4.147
4.148 @@ -376,6 +406,24 @@
4.149 /// \todo Snapshot hasn't been implemented yet.
4.150 ///
4.151 class SmartUGraph : public ExtendedSmartUGraphBase {
4.152 + private:
4.153 + ///SmartUGraph is \e not copy constructible. Use UGraphCopy() instead.
4.154 +
4.155 + ///SmartUGraph is \e not copy constructible. Use UGraphCopy() instead.
4.156 + ///
4.157 + SmartUGraph(const SmartUGraph &) : ExtendedSmartUGraphBase() {};
4.158 + ///\brief Assignment of SmartUGraph to another is \e not allowed.
4.159 + ///Use UGraphCopy() instead.
4.160 +
4.161 + ///Assignment of SmartUGraph to another is \e not allowed.
4.162 + ///Use UGraphCopy() instead.
4.163 + void operator=(const SmartUGraph &) {}
4.164 + public:
4.165 + /// Constructor
4.166 +
4.167 + /// Constructor.
4.168 + ///
4.169 + SmartUGraph() {}
4.170 };
4.171
4.172