Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
HypergraphObserver.h
Go to the documentation of this file.
1
40#pragma once
41
42#include <ogdf/basic/List.h>
44
45namespace ogdf {
46
47// HypergraphObserver
49 friend class Hypergraph;
50
51protected:
54
57
58public:
60 HypergraphObserver() : m_hypergraph(nullptr) { }
61
63 explicit HypergraphObserver(const Hypergraph* pH) {
64 m_hypergraph = pH;
65 m_itObserver = pH->registerObserver(this);
66 }
67
70 if (m_hypergraph) {
71 m_hypergraph->unregisterObserver(m_itObserver);
72 }
73 }
74
76 void init(const Hypergraph* pH) {
77 if (m_hypergraph) {
78 m_hypergraph->unregisterObserver(m_itObserver);
79 }
80
81 if (pH) {
82 m_hypergraph = pH;
83 m_itObserver = pH->registerObserver(this);
84 }
85 }
86
88 virtual void hypernodeDeleted(hypernode v) = 0;
89
91 virtual void hypernodeAdded(hypernode v) = 0;
92
94 virtual void hyperedgeDeleted(hyperedge e) = 0;
95
97 virtual void hyperedgeAdded(hyperedge e) = 0;
98
100 virtual void cleared() = 0;
101
103 const Hypergraph* hypergraph() const { return m_hypergraph; }
104};
105
106}
Declaration and a partial implementation of a Hypergraph class partly based on the original classes f...
Declaration of doubly linked lists and iterators.
Class for the representation of hyperedges.
Definition Hypergraph.h:135
void unregisterObserver(ListIterator< HypergraphObserver * > it) const
Unregisters a hypergraph observer.
void init(const Hypergraph *pH)
Associates an observer instance with hypergraph pH.
virtual void hyperedgeDeleted(hyperedge e)=0
Called by an observed hypergraph when a hyperedge is deleted.
virtual void hypernodeDeleted(hypernode v)=0
Called by an observed hypergraph when a hypernode is deleted.
virtual void hyperedgeAdded(hyperedge e)=0
Called by an observed hypergraph when a hyperedge is added.
const Hypergraph * m_hypergraph
Observed hypergraph.
virtual ~HypergraphObserver()
Destructor.
virtual void cleared()=0
Called by the observed hypergraph when it is cleared.
const Hypergraph * hypergraph() const
Returns the observer hypergraph.
HypergraphObserver(const Hypergraph *pH)
Constructor assigning pH hypergraph to the observer.
virtual void hypernodeAdded(hypernode v)=0
Called by an observed hypergraph when a hypernode is added.
ListIterator< HypergraphObserver * > m_itObserver
List of all registered hypergraph observers.
Class for the representation of hypernodes.
Definition Hypergraph.h:215
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.