# HG changeset patch # User deba # Date 1107773384 0 # Node ID 56b07afdbf8dcf18736c090b9485e35979227cd4 # Parent 9fd485470fee2c667907fc3a5febc6a160d47d05 Documentation diff -r 9fd485470fee -r 56b07afdbf8d src/lemon/alteration_notifier.h --- a/src/lemon/alteration_notifier.h Mon Feb 07 10:48:14 2005 +0000 +++ b/src/lemon/alteration_notifier.h Mon Feb 07 10:49:44 2005 +0000 @@ -321,11 +321,17 @@ public: - EdgeNotifier& getNotifier(Edge = INVALID) const { + /// \brief Gives back the edge alteration notifier. + /// + /// Gives back the edge alteration notifier. + EdgeNotifier& getNotifier(Edge) const { return edge_notifier; } - NodeNotifier& getNotifier(Node = INVALID) const { + /// \brief Gives back the node alteration notifier. + /// + /// Gives back the node alteration notifier. + NodeNotifier& getNotifier(Node) const { return node_notifier; } diff -r 9fd485470fee -r 56b07afdbf8d src/lemon/concept/graph_component.h --- a/src/lemon/concept/graph_component.h Mon Feb 07 10:48:14 2005 +0000 +++ b/src/lemon/concept/graph_component.h Mon Feb 07 10:49:44 2005 +0000 @@ -25,6 +25,8 @@ #include <lemon/invalid.h> #include <lemon/concept/maps.h> +#include <lemon/alteration_notifier.h> + namespace lemon { namespace concept { @@ -571,9 +573,11 @@ /// Copy constructor. /// GraphIncIterator(GraphIncIterator const&) {} - /// Sets the iterator to the first edge incoming into or outgoing from the node. + /// Sets the iterator to the first edge incoming into or outgoing + /// from the node. - /// Sets the iterator to the first edge incoming into or outgoing from the node. + /// Sets the iterator to the first edge incoming into or outgoing + /// from the node. /// explicit GraphIncIterator(const Graph&, const typename Graph::Node&) {} /// Invalid constructor \& conversion. @@ -671,13 +675,46 @@ void constraints() { checkConcept< BaseGraphComponent, _Graph>(); - checkConcept<GraphIterator<_Graph, typename _Graph::Edge>, typename _Graph::EdgeIt >(); - checkConcept<GraphIterator<_Graph, typename _Graph::Node>, typename _Graph::NodeIt >(); + checkConcept<GraphIterator<_Graph, typename _Graph::Edge>, + typename _Graph::EdgeIt >(); + checkConcept<GraphIterator<_Graph, typename _Graph::Node>, + typename _Graph::NodeIt >(); checkConcept<GraphIncIterator<_Graph>, typename _Graph::InEdgeIt >(); checkConcept<GraphIncIterator<_Graph>, typename _Graph::OutEdgeIt >(); } }; + /// An empty alteration notifier base graph class. + + /// This class provides beside the core graph features + /// alteration notifier interface for the graph structure. + /// This is an observer-notifier pattern. More Obsevers can + /// be registered into the notifier and whenever an alteration + /// occured in the graph all the observers will notified about it. + class AlterableGraphComponent : virtual public BaseGraphComponent { + public: + + /// The edge observer registry. + typedef AlterationNotifier<Edge> EdgeNotifier; + /// The node observer registry. + typedef AlterationNotifier<Node> NodeNotifier; + + /// \brief Gives back the edge alteration notifier. + /// + /// Gives back the edge alteration notifier. + EdgeNotifier getNotifier(Edge) const { + return EdgeNotifier(); + } + + /// \brief Gives back the node alteration notifier. + /// + /// Gives back the node alteration notifier. + NodeNotifier getNotifier(Node) const { + return NodeNotifier(); + } + + }; + /// Class describing the concept of graph maps @@ -689,10 +726,22 @@ protected: GraphMap() {} public: + /// \brief Construct a new map. + /// + /// Construct a new map for the graph. explicit GraphMap(const Graph&) {} + /// \brief Construct a new map with default value. + /// + /// Construct a new map for the graph and initalise the values. GraphMap(const Graph&, const _Value&) {} + /// \brief Copy constructor. + /// + /// Copy Constructor. GraphMap(const GraphMap&) {} + /// \brief Assign operator. + /// + /// Assign operator. GraphMap& operator=(const GraphMap&) { return *this;} template<typename _Map> @@ -740,11 +789,23 @@ private: NodeMap(); public: - // \todo call the right parent class constructor + /// \brief Construct a new map. + /// + /// Construct a new map for the graph. + /// \todo call the right parent class constructor explicit NodeMap(const Graph&) {} + /// \brief Construct a new map with default value. + /// + /// Construct a new map for the graph and initalise the values. NodeMap(const Graph&, const _Value&) {} + /// \brief Copy constructor. + /// + /// Copy Constructor. NodeMap(const NodeMap&) {} + /// \brief Assign operator. + /// + /// Assign operator. NodeMap& operator=(const NodeMap&) { return *this;} }; @@ -758,11 +819,23 @@ private: EdgeMap(); public: - // \todo call the right parent class constructor + /// \brief Construct a new map. + /// + /// Construct a new map for the graph. + /// \todo call the right parent class constructor explicit EdgeMap(const Graph&) {} + /// \brief Construct a new map with default value. + /// + /// Construct a new map for the graph and initalise the values. EdgeMap(const Graph&, const _Value&) {} + /// \brief Copy constructor. + /// + /// Copy Constructor. EdgeMap(const EdgeMap&) {} + /// \brief Assign operator. + /// + /// Assign operator. EdgeMap& operator=(const EdgeMap&) { return *this;} }; @@ -780,24 +853,30 @@ checkConcept<BaseGraphComponent, _Graph>(); { // int map test typedef typename _Graph::template NodeMap<int> IntNodeMap; - checkConcept<GraphMap<_Graph, typename _Graph::Node, int>, IntNodeMap >(); + checkConcept<GraphMap<_Graph, typename _Graph::Node, int>, + IntNodeMap >(); } { // bool map test typedef typename _Graph::template NodeMap<bool> BoolNodeMap; - checkConcept<GraphMap<_Graph, typename _Graph::Node, bool>, BoolNodeMap >(); + checkConcept<GraphMap<_Graph, typename _Graph::Node, bool>, + BoolNodeMap >(); } { // Type map test typedef typename _Graph::template NodeMap<Type> TypeNodeMap; - checkConcept<GraphMap<_Graph, typename _Graph::Node, Type>, TypeNodeMap >(); + checkConcept<GraphMap<_Graph, typename _Graph::Node, Type>, + TypeNodeMap >(); } { // int map test typedef typename _Graph::template EdgeMap<int> IntEdgeMap; - checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>, IntEdgeMap >(); + checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>, + IntEdgeMap >(); } { // bool map test typedef typename _Graph::template EdgeMap<bool> BoolEdgeMap; - checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>, BoolEdgeMap >(); + checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>, + BoolEdgeMap >(); } { // Type map test typedef typename _Graph::template EdgeMap<Type> TypeEdgeMap; - checkConcept<GraphMap<_Graph, typename _Graph::Edge, Type>, TypeEdgeMap >(); + checkConcept<GraphMap<_Graph, typename _Graph::Edge, Type>, + TypeEdgeMap >(); } } @@ -805,7 +884,13 @@ }; }; - + /// \brief An empty extendable extended graph class. + /// + /// This class provides beside the core graph features + /// item addition interface for the graph structure. + /// The difference between this class and the + /// \c BaseExtendableGraphComponent is that it should + /// notify the item alteration observers. class ExtendableGraphComponent : virtual public BaseGraphComponent { public: @@ -814,10 +899,16 @@ typedef BaseGraphComponent::Node Node; typedef BaseGraphComponent::Edge Edge; + /// \brief Add a node to the graph. + /// + /// Add a node to the graph and notify the observers. Node addNode() { return INVALID; } + /// \brief Add an edge to the graph. + /// + /// Add an edge to the graph and notify the observers. Edge addEdge(const Node& from, const Node& to) { return INVALID; } @@ -834,6 +925,14 @@ _Graph& graph; }; }; + + /// \brief An empty erasable extended graph class. + /// + /// This class provides beside the core graph features + /// item erase interface for the graph structure. + /// The difference between this class and the + /// \c BaseErasableGraphComponent is that it should + /// notify the item alteration observers. class ErasableGraphComponent : virtual public BaseGraphComponent { public: @@ -842,7 +941,14 @@ typedef BaseGraphComponent::Node Node; typedef BaseGraphComponent::Edge Edge; + /// \brief Erase the Node and notify the node alteration observers. + /// + /// Erase the Node and notify the node alteration observers. void erase(const Node&) {} + + /// \brief Erase the Edge and notify the edge alteration observers. + /// + /// Erase the Edge and notify the edge alteration observers. void erase(const Edge&) {} template <typename _Graph>