Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00058 #ifdef _MSC_VER
00059 #pragma once
00060 #endif
00061
00062 #ifndef OGDF_GRAPH_STRUCTURE_H
00063 #define OGDF_GRAPH_STRUCTURE_H
00064
00065
00066 #include <ogdf/basic/List.h>
00067 #include <ogdf/basic/Graph.h>
00068
00069 namespace ogdf {
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00094 class OGDF_EXPORT GraphObserver {
00095 friend class Graph;
00096
00097 public:
00099 GraphObserver() : m_pGraph(0) {}
00104 GraphObserver(const Graph* G) : m_pGraph(G)
00105 {
00106 m_itGList = G->registerStructure(this);
00107 }
00109 virtual ~GraphObserver()
00110 {
00111 if (m_pGraph) m_pGraph->unregisterStructure(m_itGList);
00112 }
00113
00115 void reregister(const Graph *pG) {
00116
00117 if (m_pGraph) m_pGraph->unregisterStructure(m_itGList);
00118 if ((m_pGraph = pG) != 0) m_itGList = pG->registerStructure(this);
00119 }
00120
00123 virtual void nodeDeleted(node v) = 0;
00126 virtual void nodeAdded(node v) = 0;
00129 virtual void edgeDeleted(edge e) = 0;
00132 virtual void edgeAdded(edge e) = 0;
00135 virtual void reInit() = 0;
00138 virtual void cleared() = 0;
00139
00140 const Graph* getGraph() const {return m_pGraph;}
00141
00142 protected:
00143 const Graph* m_pGraph;
00144 ListIterator<GraphObserver*> m_itGList;
00145
00146
00147 };
00148
00149 }
00150
00151 #endif