7 #include "fwServices/op/Add.hpp" 9 #include "fwServices/IService.hpp" 10 #include "fwServices/macros.hpp" 11 #include "fwServices/registry/ServiceFactory.hpp" 13 #include <fwTools/fwID.hpp> 15 #include <boost/lexical_cast.hpp> 24 ::fwServices::IService::sptr
add( ::fwData::Object::sptr _obj,
25 const std::string& _serviceType,
26 const std::string& _implType,
27 const std::string& _uid)
29 FW_DEPRECATED_MSG(
"'fwServices::add(object, srvType, srvImpl[,uid])' is deprecated.",
"20.0");
30 ::fwServices::IService::sptr srv;
32 FW_RAISE_IF(
"Failed to add " + _implType, !srv );
33 ::fwServices::OSR::registerService( _obj, srv );
36 SLM_ASSERT(
"Try to set ID: " + _uid +
" but already has an ID: " + srv->getID(), !srv->hasID() );
44 ::fwServices::IService::sptr
add(
const std::string& _implType,
const std::string& _uid)
46 ::fwServices::IService::sptr srv;
48 ::fwServices::OSR::registerService( srv );
49 FW_RAISE_IF(
"Failed to add " + _implType, !srv );
52 SLM_ASSERT(
"Try to set ID: " + _uid +
" but already has an ID: " + srv->getID(), !srv->hasID() );
Namespace fwServices is dedicated to (mimic) the dynamic affectation of methods to (pure data) object...
#define FW_DEPRECATED_MSG(message, version)
Use this macro when deprecating a function to warn the developer.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
static FWSERVICES_API ServiceFactory::sptr getDefault()
Return the unique Instance, create it if required at first access.
FWSERVICES_API::fwServices::IService::sptr add(::fwData::Object::sptr obj, const std::string &serviceType, const std::string &_implType, const std::string &_id="")
Create and attach to the object obj a service of type serviceType, implementation _implementationId w...