fw4spl
Config.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 __FWSERVICES_HELPER_CONFIG_HPP__
8 #define __FWSERVICES_HELPER_CONFIG_HPP__
9 
10 #include "fwServices/IService.hpp"
11 #include "fwServices/config.hpp"
12 #include "fwServices/helper/ProxyConnections.hpp"
13 
14 #include <fwCom/Signals.hpp>
15 #include <fwCom/Slots.hpp>
16 
17 #include <fwCore/base.hpp>
18 
19 #include <fwTools/Object.hpp>
20 
21 namespace fwTools
22 {
23 class Object;
24 }
25 
26 namespace fwData
27 {
28 class Object;
29 }
30 
31 namespace fwRuntime
32 {
33 struct ConfigurationElement;
34 }
35 
36 namespace fwServices
37 {
38 
39 namespace helper
40 {
41 
42 class SigSlotConnection;
43 
47 class Config
48 {
49 
50 public:
51 
52  typedef std::pair< std::string, ::fwCom::Signals::SignalKeyType > SignalInfoType;
53  typedef std::pair< std::string, ::fwCom::Slots::SlotKeyType > SlotInfoType;
54  typedef std::vector< SlotInfoType > SlotInfoContainerType;
55 
56  typedef std::string ObjectIdType;
57  typedef std::vector<ProxyConnections> ProxyConnectionsVectType;
58  typedef std::map< ObjectIdType, ProxyConnectionsVectType > ProxyConnectionsMapType;
59 
60 
62  {
63  SignalInfoType m_signal;
64  SlotInfoContainerType m_slots;
65  };
66 
74  FWSERVICES_API static ConnectionInfo parseConnections(const CSPTR(::fwRuntime::ConfigurationElement)& cfg,
75  const CSPTR(::fwTools::Object)& obj =
76  CSPTR(::fwTools::Object)());
77 
84  FWSERVICES_API static ProxyConnections parseConnections2(
85  const CSPTR(::fwRuntime::ConfigurationElement)& connectionCfg,
86  const std::string& errMsgHead,
87  std::function<std::string ()> generateChannelNameFn);
88 
96  FWSERVICES_API static void createConnections(
99  const CSPTR(::fwTools::Object)& obj = CSPTR(::fwTools::Object)());
100 
101 
110  FWSERVICES_API static void createProxy(
111  const std::string& objectKey,
113  ProxyConnectionsMapType& proxyMap,
114  const CSPTR(::fwData::Object)& obj = CSPTR(::fwData::Object)());
115 
116 
118  FWSERVICES_API static void disconnectProxies(const std::string& objectKey,
119  Config::ProxyConnectionsMapType& proxyMap);
120 
122  FWSERVICES_API static ::fwServices::IService::Config parseService(
123  const CSPTR(::fwRuntime::ConfigurationElement)& srvElem,
124  const std::string& errMsgHead);
125 };
126 
127 } // namespace helper
128 
129 } // namespace fwServices
130 
131 #endif // __FWSERVICES_HELPER_CONFIG_HPP__
#define CSPTR(_cls_)
The namespace fwTools contains several tools like UUID, factory, dispatche, stringizer, macros, helper.
Define Base class for FW4SPL objects and services.
Namespace fwServices is dedicated to (mimic) the dynamic affectation of methods to (pure data) object...
Defines the configuration element class.
The namespace fwRuntime contains classes to manage bundle, configuration element, extension point in ...
This class provides few tools to ease connect/disconnect between a signal emitter and a slot receiver...
Helper class to register proxy connections.
Base class for each data object.
Contains the representation of the data objects used in the framework.
Provides configuration element parsing tools.
Definition: Config.hpp:47