aGrUM  0.14.2
diGraphListener.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
27 
28 #ifdef GUM_NO_INLINE
30 #endif // GUM_NOINLINE
31 
32 namespace gum {
33 
35  GUM_CONS_CPY(DiGraphListener);
36  GUM_ERROR(OperationNotAllowed, "No copy constructor for DiGraphListener");
37  }
38 
40  GUM_OP_CPY(DiGraphListener);
41  GUM_ERROR(OperationNotAllowed, "No copy operator for DiGraphListener");
42  }
43 
45  if (!g) {
46  GUM_ERROR(OperationNotAllowed, "A graph listener need a graph to listen to");
47  }
48 
49  GUM_CONSTRUCTOR(DiGraphListener);
50  _graph = const_cast< DiGraph* >(g);
51 
52  GUM_CONNECT((*_graph), onNodeAdded, (*this), DiGraphListener::whenNodeAdded);
54  (*_graph), onNodeDeleted, (*this), DiGraphListener::whenNodeDeleted);
55  GUM_CONNECT((*_graph), onArcAdded, (*this), DiGraphListener::whenArcAdded);
56  GUM_CONNECT((*_graph), onArcDeleted, (*this), DiGraphListener::whenArcDeleted);
57  }
58 
60 
61 } // namespace gum
Abstract Base class for all diGraph Listener.
DiGraphListener(const DiGraph *g)
default constructor
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 whenNodeDeleted(const void *src, NodeId id)=0
the action to take when a node has just been removed from the graph
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Base classes for oriented graph listeners.
Base class for all oriented graphs.
Definition: diGraph.h:108
DiGraphListener & operator=(const DiGraphListener &d)
copy operator (for the moment, this operation is forbidden)
#define GUM_CONNECT(sender, signal, receiver, target)
Definition: listener.h:96
Inline implementation fo base classes for oriented graphs listener.
~DiGraphListener()
destructor
virtual void whenNodeAdded(const void *src, NodeId id)=0
the action to take when a new node is inserted into the graph
DiGraph * _graph
the graph to listen to
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:52