Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ogdf::GraphObserver Class Referenceabstract

Abstract Base class for graph observers. More...

#include <ogdf/basic/GraphObserver.h>

+ Inheritance diagram for ogdf::GraphObserver:

Public Member Functions

 GraphObserver ()
 Constructs instance of GraphObserver class.
 
 GraphObserver (const Graph *G)
 Constructs instance of GraphObserver class.
 
virtual ~GraphObserver ()
 Destroys the instance, unregisters it from watched graph.
 
virtual void cleared ()=0
 Called by watched graph when its clear function is called Has to be implemented by derived classes.
 
virtual void edgeAdded (edge e)=0
 Called by watched graph when an edge is added Has to be implemented by derived classes.
 
virtual void edgeDeleted (edge e)=0
 Called by watched graph when an edge is deleted Has to be implemented by derived classes.
 
const GraphgetGraph () const
 
virtual void nodeAdded (node v)=0
 Called by watched graph when a node is added Has to be implemented by derived classes.
 
virtual void nodeDeleted (node v)=0
 Called by watched graph when a node is deleted Has to be implemented by derived classes.
 
void reregister (const Graph *pG)
 Associates observer instance with graph G.
 

Protected Attributes

ListIterator< GraphObserver * > m_itGList
 watched graph
 
const Graphm_pGraph
 

Friends

class Graph
 

Detailed Description

Abstract Base class for graph observers.

If a class needs to keep track of changes in a graph like addition or deletion of nodes or edges, you can derive it from GraphObserver and override the notification methods nodeDeleted, nodeAdded, edgeDeleted, edgeAdded.

Definition at line 57 of file GraphObserver.h.

Constructor & Destructor Documentation

◆ GraphObserver() [1/2]

ogdf::GraphObserver::GraphObserver ( )
inline

Constructs instance of GraphObserver class.

Definition at line 62 of file GraphObserver.h.

◆ GraphObserver() [2/2]

ogdf::GraphObserver::GraphObserver ( const Graph G)
inlineexplicit

Constructs instance of GraphObserver class.

Parameters
Gis the graph to be watched

Definition at line 68 of file GraphObserver.h.

◆ ~GraphObserver()

virtual ogdf::GraphObserver::~GraphObserver ( )
inlinevirtual

Destroys the instance, unregisters it from watched graph.

Definition at line 71 of file GraphObserver.h.

Member Function Documentation

◆ cleared()

virtual void ogdf::GraphObserver::cleared ( )
pure virtual

Called by watched graph when its clear function is called Has to be implemented by derived classes.

Implemented in ogdf::ClusterGraph, and ogdf::PlanRepInc.

◆ edgeAdded()

virtual void ogdf::GraphObserver::edgeAdded ( edge  e)
pure virtual

Called by watched graph when an edge is added Has to be implemented by derived classes.

Implemented in ogdf::PlanRepInc, and ogdf::ClusterGraph.

◆ edgeDeleted()

virtual void ogdf::GraphObserver::edgeDeleted ( edge  e)
pure virtual

Called by watched graph when an edge is deleted Has to be implemented by derived classes.

Implemented in ogdf::PlanRepInc, and ogdf::ClusterGraph.

◆ getGraph()

const Graph * ogdf::GraphObserver::getGraph ( ) const
inline

Definition at line 108 of file GraphObserver.h.

◆ nodeAdded()

virtual void ogdf::GraphObserver::nodeAdded ( node  v)
pure virtual

Called by watched graph when a node is added Has to be implemented by derived classes.

Implemented in ogdf::ClusterGraph, and ogdf::PlanRepInc.

◆ nodeDeleted()

virtual void ogdf::GraphObserver::nodeDeleted ( node  v)
pure virtual

Called by watched graph when a node is deleted Has to be implemented by derived classes.

Implemented in ogdf::ClusterGraph, and ogdf::PlanRepInc.

◆ reregister()

void ogdf::GraphObserver::reregister ( const Graph pG)
inline

Associates observer instance with graph G.

Definition at line 78 of file GraphObserver.h.

Friends And Related Symbol Documentation

◆ Graph

friend class Graph
friend

Definition at line 58 of file GraphObserver.h.

Member Data Documentation

◆ m_itGList

ListIterator<GraphObserver*> ogdf::GraphObserver::m_itGList
protected

watched graph

Definition at line 112 of file GraphObserver.h.

◆ m_pGraph

const Graph* ogdf::GraphObserver::m_pGraph
protected

Definition at line 111 of file GraphObserver.h.


The documentation for this class was generated from the following file: