fw4spl
IManagerSrv.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
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 #include "ctrlSelection/IManagerSrv.hpp"
8 
9 #include <fwServices/helper/Config.hpp>
10 #include <fwServices/registry/Proxy.hpp>
11 
12 #include <boost/regex.hpp>
13 
14 namespace ctrlSelection
15 {
16 
17 //-----------------------------------------------------------------------------
18 
20 {
21  FW_DEPRECATED_MSG("The IManagerSrv type of service is deprecated.", "18.0.");
22 }
23 
24 //-----------------------------------------------------------------------------
25 
27 {
28 }
29 
30 //-----------------------------------------------------------------------------
31 
33 {
34  this->stopping();
35  this->starting();
36 }
37 
38 //-----------------------------------------------------------------------------
39 
40 void IManagerSrv::manageConnections(const std::string& objectId, ::fwData::Object::sptr object,
41  ConfigurationType config)
42 {
43  for(ConfigurationType connectCfg : config->find("connect"))
44  {
45  this->manageConnection(objectId, object, connectCfg);
46  }
47 }
48 
49 //-----------------------------------------------------------------------------
50 
51 void IManagerSrv::manageConnection(const std::string& objectId, ::fwData::Object::sptr object, ConfigurationType config)
52 {
54 }
55 
56 //-----------------------------------------------------------------------------
57 
58 void IManagerSrv::removeConnections(const std::string& objectId)
59 {
60  ObjectConnectionsMapType::iterator iter = m_objectConnections.find(objectId);
61  if (iter != m_objectConnections.end())
62  {
63  ::fwCom::helper::SigSlotConnection& connection = iter->second;
64  connection.disconnect();
65  }
66  m_objectConnections.erase(objectId);
67 }
68 
69 //-----------------------------------------------------------------------------
70 
71 void IManagerSrv::manageProxies(const std::string& objectId, ::fwData::Object::sptr object, ConfigurationType config)
72 {
73  for(ConfigurationType proxyCfg : config->find("proxy"))
74  {
75  ::fwServices::helper::Config::createProxy(objectId, proxyCfg, m_proxyCtns, object);
76  }
77 }
78 
79 //-----------------------------------------------------------------------------
80 
81 void IManagerSrv::disconnectProxies(const std::string& objectId)
82 {
84 }
85 
86 //-----------------------------------------------------------------------------
87 
88 }
virtual FWSERVICES_API void starting()=0
Initialize the service activity.
FWCOM_API void disconnect()
Disconnect all registered connections and clear m_connections.
void manageProxies(const std::string &objectId,::fwData::Object::sptr object, ConfigurationType config)
Manages all proxies connections define in config associated to object Call manageProxy() ...
Definition: IManagerSrv.cpp:71
virtual FWSERVICES_API void stopping()=0
Uninitialize the service activity. The stop() method is always invoked before destroying a service...
#define FW_DEPRECATED_MSG(message, version)
Use this macro when deprecating a function to warn the developer.
Definition: spyLog.hpp:360
This class provides few tools to ease connect/disconnect between a signal emitter and a slot receiver...
CTRLSELECTION_API IManagerSrv()
IManagerSrv constructor. Do nothing.
Definition: IManagerSrv.cpp:19
virtual CTRLSELECTION_API ~IManagerSrv()
IManagerSrv destructor. Do nothing.
Definition: IManagerSrv.cpp:26
static FWSERVICES_API void createProxy(const std::string &objectKey, const std::shared_ptr< const ::fwRuntime::ConfigurationElement > &cfg, ProxyConnectionsMapType &proxyMap, const std::shared_ptr< const ::fwData::Object > &obj=std::shared_ptr< const ::fwData::Object >())
Parses "<proxy>" tags from given configuration to connect signals and slots using proxies...
Definition: Config.cpp:170
void disconnectProxies(const std::string &objectId)
Disconnects all proxies associated to objectId;.
Definition: IManagerSrv.cpp:81
ObjectConnectionsMapType m_objectConnections
Registers connection associated to an object. Connections are connected/disconnected when the object ...
Definition: IManagerSrv.hpp:84
virtual CTRLSELECTION_API void swapping() override
Swaps the service from associated object to another object. Stops and starts this service...
Definition: IManagerSrv.cpp:32
static FWSERVICES_API void createConnections(const std::shared_ptr< const ::fwRuntime::ConfigurationElement > &cfg,::fwCom::helper::SigSlotConnection &helper, const std::shared_ptr< const ::fwTools::Object > &obj=std::shared_ptr< const ::fwTools::Object >())
Parses "<connect>" tags from given configuration to connect signals and slots using given helper...
Definition: Config.cpp:38
void manageConnections(const std::string &objectId,::fwData::Object::sptr object, ConfigurationType config)
Manages all connections define in config associated to object. Call manageConnection() ...
Definition: IManagerSrv.cpp:40
::fwServices::helper::Config::ProxyConnectionsMapType m_proxyCtns
Proxy connection information map : used to properly disconnect proxies.
Definition: IManagerSrv.hpp:87
The namespace ctrlSelection contains several interfaces for manager, updater and wrapper.
Definition: BookmarkSrv.hpp:15
void manageConnection(const std::string &objectId,::fwData::Object::sptr object, ConfigurationType config)
Manages a connection define in config associated to object.
Definition: IManagerSrv.cpp:51
static FWSERVICES_API void disconnectProxies(const std::string &objectKey, Config::ProxyConnectionsMapType &proxyMap)
Disconnects all proxies associated to objectKey.
Definition: Config.cpp:229
void removeConnections(const std::string &objectId)
Disconnects all registred connection for objectId.
Definition: IManagerSrv.cpp:58