Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

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

Protected Attributes

ListIterator< GraphObserver * > m_itGList
 watched graph More...
 
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 74 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::ClusterGraph, and ogdf::PlanRepInc.

◆ 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::ClusterGraph, and ogdf::PlanRepInc.

◆ getGraph()

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

Definition at line 110 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.

◆ reInit()

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

Called by watched graph when it is reinitialized 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 80 of file GraphObserver.h.

Friends And Related Function 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 114 of file GraphObserver.h.

◆ m_pGraph

const Graph* ogdf::GraphObserver::m_pGraph
protected

Definition at line 113 of file GraphObserver.h.


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