Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ClusterGraphObserver.h
Go to the documentation of this file.
1
37#pragma once
38
39#include <ogdf/basic/List.h>
41
42namespace ogdf {
43
54 friend class ClusterGraph;
55
56public:
57 ClusterGraphObserver() : m_pClusterGraph(nullptr) { }
58
59 explicit ClusterGraphObserver(const ClusterGraph* CG) : m_pClusterGraph(CG) {
60 m_itCGList = CG->registerObserver(this);
61 }
62
64 if (m_pClusterGraph) {
65 m_pClusterGraph->unregisterObserver(m_itCGList);
66 }
67 }
68
69 // associates structure with different graph
71 //small speedup: check if == m_pGraph
72 if (m_pClusterGraph) {
73 m_pClusterGraph->unregisterObserver(m_itCGList);
74 }
75 if ((m_pClusterGraph = pCG) != nullptr) {
76 m_itCGList = pCG->registerObserver(this);
77 }
78 }
79
80 virtual void clusterDeleted(cluster v) = 0;
81 virtual void clusterAdded(cluster v) = 0;
82#if 0
83 virtual void cleared() = 0;//Graph cleared
84#endif
85
86 const ClusterGraph* getGraph() const { return m_pClusterGraph; }
87
88protected:
89 const ClusterGraph* m_pClusterGraph; //underlying clustergraph
90
91 //List entry in cluster graphs list of all registered observers
93};
94
95}
Derived class of GraphObserver providing additional functionality to handle clustered graphs.
Declaration of doubly linked lists and iterators.
Representation of clusters in a clustered graph.
Representation of clustered graphs.
Abstract base class for cluster graph observers.
virtual void clusterAdded(cluster v)=0
const ClusterGraph * m_pClusterGraph
const ClusterGraph * getGraph() const
virtual void clusterDeleted(cluster v)=0
ClusterGraphObserver(const ClusterGraph *CG)
void reregister(const ClusterGraph *pCG)
ListIterator< ClusterGraphObserver * > m_itCGList
Encapsulates a pointer to a list element.
Definition List.h:103
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.