fw4spl
SignalBase.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 #ifndef __FWCOM_SIGNALBASE_HPP__
7 #define __FWCOM_SIGNALBASE_HPP__
8 
9 #include <fwCore/BaseObject.hpp>
10 
11 #include "fwCom/config.hpp"
12 
13 #include "fwCom/Connection.hpp"
14 
15 namespace fwCom
16 {
17 
18 struct SlotBase;
19 
24 {
28  typedef SPTR ( SignalBase ) sptr;
29  typedef WPTR ( SignalBase ) wptr;
32  SignalBase()
33  {
34  }
35 
36  virtual ~SignalBase()
37  {
38  }
39 
44  virtual Connection connect ( SPTR( SlotBase ) slot ) = 0;
45 
50  virtual void disconnect ( SPTR( SlotBase ) slot ) = 0;
51 
53  virtual size_t getNumberOfConnections() const = 0;
54 
55  protected:
57  SignalBase( const SignalBase& );
58 
60  SignalBase& operator=( const SignalBase& );
61 };
62 
63 } // namespace fwCom
64 
65 #endif /* __FWCOM_SIGNALBASE_HPP__ */
66 
#define SPTR(_cls_)
Base class for all FW4SPL&#39;s classes.
Definition: BaseObject.hpp:22
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
#define WPTR(_cls_)
virtual size_t getNumberOfConnections() const =0
Returns number of connections.
SignalBase & operator=(const SignalBase &)
Copy operator forbiden.
virtual void disconnect(std::shared_ptr< SlotBase > slot)=0
Disconnects the given slot.
Class managing Signal-Slot connections.
Definition: Connection.hpp:17
virtual Connection connect(std::shared_ptr< SlotBase > slot)=0
Connects the given slot.
Signal base class.
Definition: SignalBase.hpp:23
Base class for Slot implementations.
Definition: SlotBase.hpp:46