aGrUM  0.16.0
gum::MixedGraphListener Class Referenceabstract

Abstract Base class for all mixed Graph Listener. More...

#include <mixedGraphListener.h>

+ Inheritance diagram for gum::MixedGraphListener:
+ Collaboration diagram for gum::MixedGraphListener:

Public Member Functions

void attachSignal__ (__sig__::ISignaler *sender)
 
void detachSignal__ (__sig__::ISignaler *sender)
 
Constructors / Destructors
 MixedGraphListener (MixedGraph *g)
 default constructor More...
 
 ~MixedGraphListener ()
 destructor More...
 
signals to listen to
virtual void whenNodeAdded (const void *src, NodeId id)=0
 the action to take when a new node is inserted into the graph More...
 
virtual void whenNodeDeleted (const void *src, NodeId id)=0
 the action to take when a node has just been removed from the graph More...
 
virtual void whenArcAdded (const void *src, NodeId from, NodeId to)=0
 the action to take when a new arc is inserted into the graph More...
 
virtual void whenArcDeleted (const void *src, NodeId from, NodeId to)=0
 the action to take when an arc has just been removed from the graph More...
 
virtual void whenEdgeAdded (const void *src, NodeId id1, NodeId id2)=0
 the action to take when a new edge is inserted into the graph More...
 
virtual void whenEdgeDeleted (const void *src, NodeId from, NodeId to)=0
 the action to take when an edge has just been removed from the graph More...
 

Protected Attributes

MixedGraph_graph
 the graph to listen to More...
 

Detailed Description

Constructor & Destructor Documentation

◆ MixedGraphListener() [1/2]

gum::MixedGraphListener::MixedGraphListener ( MixedGraph g)

default constructor

Parameters
gthe graph to listen to
Warning
Note that, by the aGrUM's constructor parameter's rule, the fact that g is passed as a pointer means that g is not copied, but only referenced by the listener.

Definition at line 47 of file mixedGraphListener.cpp.

References _graph, GUM_CONNECT, GUM_ERROR, whenArcAdded(), whenArcDeleted(), whenEdgeAdded(), whenEdgeDeleted(), whenNodeAdded(), and whenNodeDeleted().

47  {
48  if (!g) {
49  GUM_ERROR(OperationNotAllowed, "A graph listener need a graph to listen to");
50  }
51 
52  GUM_CONSTRUCTOR(MixedGraphListener);
53  _graph = g;
54 
56  (*_graph), onNodeAdded, (*this), MixedGraphListener::whenNodeAdded);
58  (*_graph), onNodeDeleted, (*this), MixedGraphListener::whenNodeDeleted);
59  GUM_CONNECT((*_graph), onArcAdded, (*this), MixedGraphListener::whenArcAdded);
61  (*_graph), onArcDeleted, (*this), MixedGraphListener::whenArcDeleted);
63  (*_graph), onEdgeAdded, (*this), MixedGraphListener::whenEdgeAdded);
65  (*_graph), onEdgeDeleted, (*this), MixedGraphListener::whenEdgeDeleted);
66  }
virtual void whenEdgeAdded(const void *src, NodeId id1, NodeId id2)=0
the action to take when a new edge is inserted into the graph
MixedGraph * _graph
the graph to listen to
virtual void whenArcAdded(const void *src, NodeId from, NodeId to)=0
the action to take when a new arc is inserted into the graph
virtual void whenEdgeDeleted(const void *src, NodeId from, NodeId to)=0
the action to take when an edge has just been removed from the graph
virtual void whenNodeAdded(const void *src, NodeId id)=0
the action to take when a new node is inserted into the graph
MixedGraphListener(MixedGraph *g)
default constructor
#define GUM_CONNECT(sender, signal, receiver, target)
Definition: listener.h:98
virtual void whenNodeDeleted(const void *src, NodeId id)=0
the action to take when a node has just been removed from the graph
virtual void whenArcDeleted(const void *src, NodeId from, NodeId to)=0
the action to take when an arc has just been removed from the graph
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55
+ Here is the call graph for this function:

◆ ~MixedGraphListener()

gum::MixedGraphListener::~MixedGraphListener ( )

destructor

Definition at line 68 of file mixedGraphListener.cpp.

68 { GUM_DESTRUCTOR(MixedGraphListener); }
MixedGraphListener(MixedGraph *g)
default constructor

◆ MixedGraphListener() [2/2]

gum::MixedGraphListener::MixedGraphListener ( const MixedGraphListener d)
private

copy constructor (for the moment, this operation is forbidden)

Parameters
dthe MixedGraphListener to copy

Definition at line 37 of file mixedGraphListener.cpp.

References GUM_ERROR.

37  {
38  GUM_CONS_CPY(MixedGraphListener);
39  GUM_ERROR(OperationNotAllowed, "No copy constructor for MixedGraphListener");
40  }
MixedGraphListener(MixedGraph *g)
default constructor
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

Member Function Documentation

◆ attachSignal__()

INLINE void gum::Listener::attachSignal__ ( __sig__::ISignaler *  sender)
inherited

Definition at line 36 of file listener_inl.h.

References gum::Listener::__senders.

36  {
37  __senders.push_back(sender);
38  }
Senders_list __senders
Definition: listener.h:94

◆ detachSignal__()

INLINE void gum::Listener::detachSignal__ ( __sig__::ISignaler *  sender)
inherited

Definition at line 40 of file listener_inl.h.

References gum::Listener::__senders.

40  {
41  auto del = std::remove(__senders.begin(), __senders.end(), sender);
42 
43  if (del != __senders.end()) __senders.erase(del, __senders.end());
44  }
Senders_list __senders
Definition: listener.h:94

◆ operator=()

MixedGraphListener & gum::MixedGraphListener::operator= ( const MixedGraphListener d)
private

copy operator (for the moment, this operation is forbidden)

Parameters
dthe MixedGraphListener to copy

Definition at line 42 of file mixedGraphListener.cpp.

References GUM_ERROR.

42  {
43  GUM_OP_CPY(MixedGraphListener);
44  GUM_ERROR(OperationNotAllowed, "No copy operator for MixedGraphListener");
45  }
MixedGraphListener(MixedGraph *g)
default constructor
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ whenArcAdded()

virtual void gum::MixedGraphListener::whenArcAdded ( const void *  src,
NodeId  from,
NodeId  to 
)
pure virtual

the action to take when a new arc is inserted into the graph

Parameters
srcthe object that sent the signal
fromthe id of tail of the new arc inserted into the graph
tothe id of head of the new arc inserted into the graph

Referenced by MixedGraphListener().

+ Here is the caller graph for this function:

◆ whenArcDeleted()

virtual void gum::MixedGraphListener::whenArcDeleted ( const void *  src,
NodeId  from,
NodeId  to 
)
pure virtual

the action to take when an arc has just been removed from the graph

Parameters
srcthe object that sent the signal
fromthe id of tail of the arc removed from the graph
tothe id of head of the arc removed from the graph

Referenced by MixedGraphListener().

+ Here is the caller graph for this function:

◆ whenEdgeAdded()

virtual void gum::MixedGraphListener::whenEdgeAdded ( const void *  src,
NodeId  id1,
NodeId  id2 
)
pure virtual

the action to take when a new edge is inserted into the graph

Parameters
srcthe object that sent the signal
id1the id of one node of the edge inserted into the graph
id2the id of the other node of the edge inserted into the graph

Referenced by MixedGraphListener().

+ Here is the caller graph for this function:

◆ whenEdgeDeleted()

virtual void gum::MixedGraphListener::whenEdgeDeleted ( const void *  src,
NodeId  from,
NodeId  to 
)
pure virtual

the action to take when an edge has just been removed from the graph

Parameters
srcthe object that sent the signal
fromthe id of one node of the edge removed from the graph
tothe id of the other node of the edge removed from the graph

Referenced by MixedGraphListener().

+ Here is the caller graph for this function:

◆ whenNodeAdded()

virtual void gum::MixedGraphListener::whenNodeAdded ( const void *  src,
NodeId  id 
)
pure virtual

the action to take when a new node is inserted into the graph

Parameters
srcthe object that sent the signal
idthe id of the new node inserted into the graph

Referenced by MixedGraphListener().

+ Here is the caller graph for this function:

◆ whenNodeDeleted()

virtual void gum::MixedGraphListener::whenNodeDeleted ( const void *  src,
NodeId  id 
)
pure virtual

the action to take when a node has just been removed from the graph

Parameters
srcthe object that sent the signal
idthe id of the node has just been removed from the graph

Referenced by MixedGraphListener().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _graph

MixedGraph* gum::MixedGraphListener::_graph
protected

the graph to listen to

Definition at line 114 of file mixedGraphListener.h.

Referenced by MixedGraphListener().


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