fw4spl
SigSlotConnection.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2016.
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 
7 #ifndef __FWCOM_HELPER_SIGSLOTCONNECTION_HPP__
8 #define __FWCOM_HELPER_SIGSLOTCONNECTION_HPP__
9 
10 #include "fwCom/config.hpp"
11 #include <fwCom/Connection.hpp>
12 #include <fwCom/HasSignals.hpp>
13 #include <fwCom/HasSlots.hpp>
14 
15 #include <list>
16 #include <utility>
17 #include <vector>
18 
19 
20 namespace fwCom
21 {
22 namespace helper
23 {
24 
28 class FWCOM_CLASS_API SigSlotConnection
29 {
30 
31 public:
32 
33  typedef std::list< ::fwCom::Connection > ConnectionContainerType;
34 
35  typedef std::pair< ::fwCom::Signals::SignalKeyType, ::fwCom::Slots::SlotKeyType > KeyConnectionType;
36 
37  typedef std::vector< KeyConnectionType > KeyConnectionsType;
38 
40  FWCOM_API SigSlotConnection();
41 
43  FWCOM_API virtual ~SigSlotConnection();
44 
46  FWCOM_API void connect(const ::fwCom::HasSignals::csptr& hasSignals, ::fwCom::Signals::SignalKeyType signalKey,
47  const ::fwCom::HasSlots::csptr& hasSlots, ::fwCom::Slots::SlotKeyType slotKey );
48 
50  FWCOM_API void connect(const ::fwCom::HasSignals::csptr& hasSignals, const ::fwCom::HasSlots::csptr& hasSlots,
51  const KeyConnectionsType& keyConnections );
52 
54  FWCOM_API void addConnection( ::fwCom::Connection connection );
55 
57  FWCOM_API void disconnect();
58 
59 protected:
60 
62  ConnectionContainerType m_connections;
63 };
64 
65 } // end namespace helper
66 } // end namespace fwCom
67 
68 #endif // __FWCOM_HELPER_SIGSLOTCONNECTION_HPP__
ConnectionContainerType m_connections
Connections storage.
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
Class managing Signal-Slot connections.
Definition: Connection.hpp:17
This class provides few tools to ease connect/disconnect between a signal emitter and a slot receiver...