fw4spl
ProxyConnections.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 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 __FWSERVICES_HELPER_PROXYCONNECTIONS_HPP__
8 #define __FWSERVICES_HELPER_PROXYCONNECTIONS_HPP__
9 
10 #include "fwServices/config.hpp"
11 
12 #include <fwCom/Signals.hpp>
13 #include <fwCom/Slots.hpp>
14 
15 namespace fwServices
16 {
17 
18 namespace helper
19 {
20 
23 {
24  typedef std::pair< std::string, ::fwCom::Signals::SignalKeyType > SignalInfoType;
25  typedef std::pair< std::string, ::fwCom::Slots::SlotKeyType > SlotInfoType;
26  typedef std::vector< SlotInfoType > SlotInfoContainerType;
27  typedef std::string UIDType;
28  typedef std::string KeyType;
29  typedef std::pair<UIDType, KeyType> ProxyEltType;
30  typedef std::vector<ProxyEltType> ProxyEltVectType;
31 
32  std::string m_channel;
33  ProxyEltVectType m_slots;
34  ProxyEltVectType m_signals;
35 
36  ProxyConnections() : m_channel("undefined")
37  {
38  }
39 
40  ProxyConnections(const std::string& channel) : m_channel(channel)
41  {
42  }
43 
45  {
46  }
47 
48  void addSignalConnection(UIDType uid, KeyType key)
49  {
50  m_signals.push_back(std::make_pair(uid, key));
51  }
52  void addSignalConnection(const SignalInfoType& pair)
53  {
54  m_signals.push_back(pair);
55  }
56  void addSlotConnection(UIDType uid, KeyType key)
57  {
58  m_slots.push_back(std::make_pair(uid, key));
59  }
60  void addSlotConnection(const SlotInfoType& pair)
61  {
62  m_slots.push_back(pair);
63  }
64  bool empty() const
65  {
66  return m_slots.empty() && m_signals.empty();
67  }
68 };
69 
70 } // namespace helper
71 
72 } // namespace fwServices
73 
74 #endif // __FWSERVICES_HELPER_PROXYCONNECTIONS_HPP__
Namespace fwServices is dedicated to (mimic) the dynamic affectation of methods to (pure data) object...
Helper class to register proxy connections.