9 #include "fwServices/config.hpp" 10 #include "fwServices/helper/Config.hpp" 11 #include "fwServices/helper/ProxyConnections.hpp" 12 #include "fwServices/IAppConfigManager.hpp" 13 #include "fwServices/IService.hpp" 14 #include "fwServices/IXMLParser.hpp" 15 #include "fwServices/registry/AppConfig.hpp" 17 #include <fwCom/HasSlots.hpp> 18 #include <fwCom/helper/SigSlotConnection.hpp> 21 #include <unordered_map> 22 #include <unordered_set> 42 std::make_shared< AppConfigManager >)
49 FWSERVICES_API virtual ~AppConfigManager();
55 FWSERVICES_API virtual
void setConfig(const
std::
string& configId,
56 const FieldAdaptorType& replaceFields = FieldAdaptorType()) override;
57 FWSERVICES_API virtual
void setConfig(const
std::
string& configId,
58 const ::
fwData::Composite::csptr& replaceFields) override;
59 FWSERVICES_API virtual ::
fwData::Object::sptr getConfigRoot() const override;
60 FWSERVICES_API virtual
void launch() override;
61 FWSERVICES_API virtual
void stopAndDestroy() override;
62 FWSERVICES_API virtual
void create() override;
63 FWSERVICES_API virtual
void start() override;
64 FWSERVICES_API virtual
void update() override;
65 FWSERVICES_API virtual
void stop() override;
66 FWSERVICES_API virtual
void destroy() override;
74 FWSERVICES_API virtual
void startBundle();
77 FWSERVICES_API
void setIsUnitTest(
bool isUnitTest);
81 typedef ::
std::pair<
std::
string,
bool > ConfigAttribute;
85 ::
fwData::Object::sptr findObject(const
std::
string& uid, const
std::
string& errMsgTail) const;
87 ::
fwData::Object::sptr getNewObject(ConfigAttribute type, const
std::
string& uid) const;
89 ::
fwData::Object::sptr getNewObject(ConfigAttribute type,
90 ConfigAttribute uid = ConfigAttribute("", false)) const;
92 ::
fwData::Object::sptr getObject(ConfigAttribute type, const
std::
string& uid) const;
96 void stopStartedServices();
97 void destroyCreatedServices();
99 void processStartItems();
100 void processUpdateItems();
103 void createObjects(::
fwRuntime::ConfigurationElement::csptr cfgElem);
106 void createServices(::
fwRuntime::ConfigurationElement::csptr cfgElem);
112 void createConnections();
115 std::
string msgHead() const;
118 void addObjects(::
fwData::Object::sptr obj, const
std::
string&
id);
121 void removeObjects(::
fwData::Object::sptr obj, const
std::
string&
id);
124 void connectProxy(const
std::
string& channel, const ProxyConnections& connectCfg);
126 void destroyProxy(const
std::
string& channel, const ProxyConnections& proxyCfg, const
std::
string& key = "",
127 fwData::Object::csptr hintObj =
nullptr);
128 void destroyProxies();
131 static
std::
string getUIDListAsString(const
std::vector<
std::
string>& uidList);
135 std::unordered_map<
std::
string, CreatedObjectType> m_createdObjects;
137 struct DeferredObjectType
139 std::vector< ServiceConfig > m_servicesCfg;
140 std::unordered_map< std::string, ProxyConnections > m_proxyCnt;
142 ::fwData::Object::sptr m_object;
146 std::unordered_map<std::string, DeferredObjectType > m_deferredObjects;
149 std::unordered_set<std::string> m_deferredServices;
152 std::unordered_map<std::string, ProxyConnections> m_createdObjectsProxies;
154 struct ServiceProxyType
156 std::unordered_map< std::string, ProxyConnections > m_proxyCnt;
158 std::unordered_map< std::string, ServiceProxyType > m_servicesProxies;
161 std::string m_configId;
163 typedef std::vector< ::fwServices::IService::wptr > ServiceContainer;
166 ServiceContainer m_createdSrv;
169 ServiceContainer m_startedSrv;
172 std::vector<std::string> m_deferredStartSrv;
175 std::vector<std::string> m_deferredUpdateSrv;
180 ::fwData::Composite::sptr m_tmpRootObject;
183 unsigned int m_proxyID;
194 inline std::string AppConfigManager::msgHead()
const 196 return "[" + m_configId +
"] ";
Base class for all services.
Namespace fwServices is dedicated to (mimic) the dynamic affectation of methods to (pure data) object...
This class provides an API to manage config template.
This class proposes a mapping between a SlotKeyType and a SlotBase.
Class managing Signal-Slot connections.
The namespace fwRuntime contains classes to manage bundle, configuration element, extension point in ...
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
Helper class to register proxy connections.
#define fwCoreAllowSharedFromThis()
Generate getSptr and getConstSptr methods.
Contains the representation of the data objects used in the framework.
Service type for the construction of an object and associated services from an XML-based description...
This class provides an interface to manage configurations template.
Used to store a service configuration.