1.1 --- a/src/lemon/alteration_notifier.h Mon Feb 07 10:48:14 2005 +0000
1.2 +++ b/src/lemon/alteration_notifier.h Mon Feb 07 10:49:44 2005 +0000
1.3 @@ -321,11 +321,17 @@
1.4
1.5 public:
1.6
1.7 - EdgeNotifier& getNotifier(Edge = INVALID) const {
1.8 + /// \brief Gives back the edge alteration notifier.
1.9 + ///
1.10 + /// Gives back the edge alteration notifier.
1.11 + EdgeNotifier& getNotifier(Edge) const {
1.12 return edge_notifier;
1.13 }
1.14
1.15 - NodeNotifier& getNotifier(Node = INVALID) const {
1.16 + /// \brief Gives back the node alteration notifier.
1.17 + ///
1.18 + /// Gives back the node alteration notifier.
1.19 + NodeNotifier& getNotifier(Node) const {
1.20 return node_notifier;
1.21 }
1.22
2.1 --- a/src/lemon/concept/graph_component.h Mon Feb 07 10:48:14 2005 +0000
2.2 +++ b/src/lemon/concept/graph_component.h Mon Feb 07 10:49:44 2005 +0000
2.3 @@ -25,6 +25,8 @@
2.4 #include <lemon/invalid.h>
2.5 #include <lemon/concept/maps.h>
2.6
2.7 +#include <lemon/alteration_notifier.h>
2.8 +
2.9 namespace lemon {
2.10 namespace concept {
2.11
2.12 @@ -571,9 +573,11 @@
2.13 /// Copy constructor.
2.14 ///
2.15 GraphIncIterator(GraphIncIterator const&) {}
2.16 - /// Sets the iterator to the first edge incoming into or outgoing from the node.
2.17 + /// Sets the iterator to the first edge incoming into or outgoing
2.18 + /// from the node.
2.19
2.20 - /// Sets the iterator to the first edge incoming into or outgoing from the node.
2.21 + /// Sets the iterator to the first edge incoming into or outgoing
2.22 + /// from the node.
2.23 ///
2.24 explicit GraphIncIterator(const Graph&, const typename Graph::Node&) {}
2.25 /// Invalid constructor \& conversion.
2.26 @@ -671,13 +675,46 @@
2.27 void constraints() {
2.28 checkConcept< BaseGraphComponent, _Graph>();
2.29
2.30 - checkConcept<GraphIterator<_Graph, typename _Graph::Edge>, typename _Graph::EdgeIt >();
2.31 - checkConcept<GraphIterator<_Graph, typename _Graph::Node>, typename _Graph::NodeIt >();
2.32 + checkConcept<GraphIterator<_Graph, typename _Graph::Edge>,
2.33 + typename _Graph::EdgeIt >();
2.34 + checkConcept<GraphIterator<_Graph, typename _Graph::Node>,
2.35 + typename _Graph::NodeIt >();
2.36 checkConcept<GraphIncIterator<_Graph>, typename _Graph::InEdgeIt >();
2.37 checkConcept<GraphIncIterator<_Graph>, typename _Graph::OutEdgeIt >();
2.38 }
2.39 };
2.40
2.41 + /// An empty alteration notifier base graph class.
2.42 +
2.43 + /// This class provides beside the core graph features
2.44 + /// alteration notifier interface for the graph structure.
2.45 + /// This is an observer-notifier pattern. More Obsevers can
2.46 + /// be registered into the notifier and whenever an alteration
2.47 + /// occured in the graph all the observers will notified about it.
2.48 + class AlterableGraphComponent : virtual public BaseGraphComponent {
2.49 + public:
2.50 +
2.51 + /// The edge observer registry.
2.52 + typedef AlterationNotifier<Edge> EdgeNotifier;
2.53 + /// The node observer registry.
2.54 + typedef AlterationNotifier<Node> NodeNotifier;
2.55 +
2.56 + /// \brief Gives back the edge alteration notifier.
2.57 + ///
2.58 + /// Gives back the edge alteration notifier.
2.59 + EdgeNotifier getNotifier(Edge) const {
2.60 + return EdgeNotifier();
2.61 + }
2.62 +
2.63 + /// \brief Gives back the node alteration notifier.
2.64 + ///
2.65 + /// Gives back the node alteration notifier.
2.66 + NodeNotifier getNotifier(Node) const {
2.67 + return NodeNotifier();
2.68 + }
2.69 +
2.70 + };
2.71 +
2.72
2.73 /// Class describing the concept of graph maps
2.74
2.75 @@ -689,10 +726,22 @@
2.76 protected:
2.77 GraphMap() {}
2.78 public:
2.79 + /// \brief Construct a new map.
2.80 + ///
2.81 + /// Construct a new map for the graph.
2.82 explicit GraphMap(const Graph&) {}
2.83 + /// \brief Construct a new map with default value.
2.84 + ///
2.85 + /// Construct a new map for the graph and initalise the values.
2.86 GraphMap(const Graph&, const _Value&) {}
2.87 + /// \brief Copy constructor.
2.88 + ///
2.89 + /// Copy Constructor.
2.90 GraphMap(const GraphMap&) {}
2.91
2.92 + /// \brief Assign operator.
2.93 + ///
2.94 + /// Assign operator.
2.95 GraphMap& operator=(const GraphMap&) { return *this;}
2.96
2.97 template<typename _Map>
2.98 @@ -740,11 +789,23 @@
2.99 private:
2.100 NodeMap();
2.101 public:
2.102 - // \todo call the right parent class constructor
2.103 + /// \brief Construct a new map.
2.104 + ///
2.105 + /// Construct a new map for the graph.
2.106 + /// \todo call the right parent class constructor
2.107 explicit NodeMap(const Graph&) {}
2.108 + /// \brief Construct a new map with default value.
2.109 + ///
2.110 + /// Construct a new map for the graph and initalise the values.
2.111 NodeMap(const Graph&, const _Value&) {}
2.112 + /// \brief Copy constructor.
2.113 + ///
2.114 + /// Copy Constructor.
2.115 NodeMap(const NodeMap&) {}
2.116
2.117 + /// \brief Assign operator.
2.118 + ///
2.119 + /// Assign operator.
2.120 NodeMap& operator=(const NodeMap&) { return *this;}
2.121
2.122 };
2.123 @@ -758,11 +819,23 @@
2.124 private:
2.125 EdgeMap();
2.126 public:
2.127 - // \todo call the right parent class constructor
2.128 + /// \brief Construct a new map.
2.129 + ///
2.130 + /// Construct a new map for the graph.
2.131 + /// \todo call the right parent class constructor
2.132 explicit EdgeMap(const Graph&) {}
2.133 + /// \brief Construct a new map with default value.
2.134 + ///
2.135 + /// Construct a new map for the graph and initalise the values.
2.136 EdgeMap(const Graph&, const _Value&) {}
2.137 + /// \brief Copy constructor.
2.138 + ///
2.139 + /// Copy Constructor.
2.140 EdgeMap(const EdgeMap&) {}
2.141
2.142 + /// \brief Assign operator.
2.143 + ///
2.144 + /// Assign operator.
2.145 EdgeMap& operator=(const EdgeMap&) { return *this;}
2.146
2.147 };
2.148 @@ -780,24 +853,30 @@
2.149 checkConcept<BaseGraphComponent, _Graph>();
2.150 { // int map test
2.151 typedef typename _Graph::template NodeMap<int> IntNodeMap;
2.152 - checkConcept<GraphMap<_Graph, typename _Graph::Node, int>, IntNodeMap >();
2.153 + checkConcept<GraphMap<_Graph, typename _Graph::Node, int>,
2.154 + IntNodeMap >();
2.155 } { // bool map test
2.156 typedef typename _Graph::template NodeMap<bool> BoolNodeMap;
2.157 - checkConcept<GraphMap<_Graph, typename _Graph::Node, bool>, BoolNodeMap >();
2.158 + checkConcept<GraphMap<_Graph, typename _Graph::Node, bool>,
2.159 + BoolNodeMap >();
2.160 } { // Type map test
2.161 typedef typename _Graph::template NodeMap<Type> TypeNodeMap;
2.162 - checkConcept<GraphMap<_Graph, typename _Graph::Node, Type>, TypeNodeMap >();
2.163 + checkConcept<GraphMap<_Graph, typename _Graph::Node, Type>,
2.164 + TypeNodeMap >();
2.165 }
2.166
2.167 { // int map test
2.168 typedef typename _Graph::template EdgeMap<int> IntEdgeMap;
2.169 - checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>, IntEdgeMap >();
2.170 + checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>,
2.171 + IntEdgeMap >();
2.172 } { // bool map test
2.173 typedef typename _Graph::template EdgeMap<bool> BoolEdgeMap;
2.174 - checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>, BoolEdgeMap >();
2.175 + checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>,
2.176 + BoolEdgeMap >();
2.177 } { // Type map test
2.178 typedef typename _Graph::template EdgeMap<Type> TypeEdgeMap;
2.179 - checkConcept<GraphMap<_Graph, typename _Graph::Edge, Type>, TypeEdgeMap >();
2.180 + checkConcept<GraphMap<_Graph, typename _Graph::Edge, Type>,
2.181 + TypeEdgeMap >();
2.182 }
2.183 }
2.184
2.185 @@ -805,7 +884,13 @@
2.186 };
2.187 };
2.188
2.189 -
2.190 + /// \brief An empty extendable extended graph class.
2.191 + ///
2.192 + /// This class provides beside the core graph features
2.193 + /// item addition interface for the graph structure.
2.194 + /// The difference between this class and the
2.195 + /// \c BaseExtendableGraphComponent is that it should
2.196 + /// notify the item alteration observers.
2.197 class ExtendableGraphComponent : virtual public BaseGraphComponent {
2.198 public:
2.199
2.200 @@ -814,10 +899,16 @@
2.201 typedef BaseGraphComponent::Node Node;
2.202 typedef BaseGraphComponent::Edge Edge;
2.203
2.204 + /// \brief Add a node to the graph.
2.205 + ///
2.206 + /// Add a node to the graph and notify the observers.
2.207 Node addNode() {
2.208 return INVALID;
2.209 }
2.210
2.211 + /// \brief Add an edge to the graph.
2.212 + ///
2.213 + /// Add an edge to the graph and notify the observers.
2.214 Edge addEdge(const Node& from, const Node& to) {
2.215 return INVALID;
2.216 }
2.217 @@ -834,6 +925,14 @@
2.218 _Graph& graph;
2.219 };
2.220 };
2.221 +
2.222 + /// \brief An empty erasable extended graph class.
2.223 + ///
2.224 + /// This class provides beside the core graph features
2.225 + /// item erase interface for the graph structure.
2.226 + /// The difference between this class and the
2.227 + /// \c BaseErasableGraphComponent is that it should
2.228 + /// notify the item alteration observers.
2.229 class ErasableGraphComponent : virtual public BaseGraphComponent {
2.230 public:
2.231
2.232 @@ -842,7 +941,14 @@
2.233 typedef BaseGraphComponent::Node Node;
2.234 typedef BaseGraphComponent::Edge Edge;
2.235
2.236 + /// \brief Erase the Node and notify the node alteration observers.
2.237 + ///
2.238 + /// Erase the Node and notify the node alteration observers.
2.239 void erase(const Node&) {}
2.240 +
2.241 + /// \brief Erase the Edge and notify the edge alteration observers.
2.242 + ///
2.243 + /// Erase the Edge and notify the edge alteration observers.
2.244 void erase(const Edge&) {}
2.245
2.246 template <typename _Graph>