aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::UndiGraphListener Class Referenceabstract

Abstract Base class for all undiGraph Listener. More...

#include <undiGraphListener.h>

+ Inheritance diagram for gum::UndiGraphListener:
+ Collaboration diagram for gum::UndiGraphListener:

Public Member Functions

void _attachSignal_ (__sig__::ISignaler *sender)
 
void _detachSignal_ (__sig__::ISignaler *sender)
 
Constructors / Destructors
 UndiGraphListener (UndiGraph *g)
 default constructor More...
 
 ~UndiGraphListener ()
 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 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

UndiGraphgraph_
 the graph to listen to More...
 

Detailed Description

Abstract Base class for all undiGraph Listener.

This is the virtual base class for not-oriented graphs meta-listener.

An UndiGraphListener will have to implement following pure methods :

Definition at line 48 of file undiGraphListener.h.

Constructor & Destructor Documentation

◆ UndiGraphListener() [1/2]

gum::UndiGraphListener::UndiGraphListener ( UndiGraph 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 46 of file undiGraphListener.cpp.

References gum::Set< Key, Alloc >::emplace().

46  {
47  if (!g) { GUM_ERROR(OperationNotAllowed, "A graph listener need a graph to listen to") }
48 
49  GUM_CONSTRUCTOR(UndiGraphListener);
50  graph_ = g;
51 
52  GUM_CONNECT((*graph_), onNodeAdded, (*this), UndiGraphListener::whenNodeAdded);
53  GUM_CONNECT((*graph_), onNodeDeleted, (*this), UndiGraphListener::whenNodeDeleted);
54  GUM_CONNECT((*graph_), onEdgeAdded, (*this), UndiGraphListener::whenEdgeAdded);
55  GUM_CONNECT((*graph_), onEdgeDeleted, (*this), UndiGraphListener::whenEdgeDeleted);
56  }
UndiGraphListener(UndiGraph *g)
default constructor
virtual void whenEdgeAdded(const void *src, NodeId id1, NodeId id2)=0
the action to take when a new edge is inserted into the graph
UndiGraph * graph_
the graph to listen to
virtual void whenNodeDeleted(const void *src, NodeId id)=0
the action to take when a node has just been removed from the graph
#define GUM_CONNECT(sender, signal, receiver, target)
Definition: listener.h:96
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
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ ~UndiGraphListener()

gum::UndiGraphListener::~UndiGraphListener ( )

destructor

Definition at line 58 of file undiGraphListener.cpp.

References gum::Set< Key, Alloc >::emplace().

58  {
59  GUM_DESTRUCTOR(UndiGraphListener);
60  ;
61  }
UndiGraphListener(UndiGraph *g)
default constructor
+ Here is the call graph for this function:

◆ UndiGraphListener() [2/2]

gum::UndiGraphListener::UndiGraphListener ( const UndiGraphListener d)
private

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

Parameters
dthe UndiGraphListener to copy

Definition at line 36 of file undiGraphListener.cpp.

References gum::Set< Key, Alloc >::emplace().

36  {
37  GUM_CONS_CPY(UndiGraphListener);
38  GUM_ERROR(OperationNotAllowed, "No copy constructor for UndiGraphListener")
39  }
UndiGraphListener(UndiGraph *g)
default constructor
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

Member Function Documentation

◆ _attachSignal_()

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

Definition at line 35 of file listener_inl.h.

References gum::Set< Key, Alloc >::emplace().

35 { _senders_.push_back(sender); }
Senders_list _senders_
Definition: listener.h:92
+ Here is the call graph for this function:

◆ _detachSignal_()

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

Definition at line 37 of file listener_inl.h.

References gum::Set< Key, Alloc >::emplace().

37  {
38  auto del = std::remove(_senders_.begin(), _senders_.end(), sender);
39 
40  if (del != _senders_.end()) _senders_.erase(del, _senders_.end());
41  }
Senders_list _senders_
Definition: listener.h:92
+ Here is the call graph for this function:

◆ operator=()

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

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

Parameters
dthe UndiGraphListener to copy

Definition at line 41 of file undiGraphListener.cpp.

References gum::Set< Key, Alloc >::emplace().

41  {
42  GUM_OP_CPY(UndiGraphListener);
43  GUM_ERROR(OperationNotAllowed, "No copy operator for UndiGraphListener")
44  }
UndiGraphListener(UndiGraph *g)
default constructor
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ whenEdgeAdded()

virtual void gum::UndiGraphListener::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

◆ whenEdgeDeleted()

virtual void gum::UndiGraphListener::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

◆ whenNodeAdded()

virtual void gum::UndiGraphListener::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

◆ whenNodeDeleted()

virtual void gum::UndiGraphListener::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

Member Data Documentation

◆ graph_

UndiGraph* gum::UndiGraphListener::graph_
protected

the graph to listen to

Definition at line 99 of file undiGraphListener.h.


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