Skip to content
Snippets Groups Projects
Commit f14dfcc0 authored by Nicolas Philipps's avatar Nicolas Philipps
Browse files

Updated Factory initializers API

--HG--
branch : fw4spl_0.7.7
parent 6d8385ca
Branches
Tags 7.7.1
No related merge requests found
......@@ -16,7 +16,7 @@ public :
fwCoreClassDefinitionsWithFactoryMacro((DynamicAttributesInitializer), (()), new DynamicAttributesInitializer );
FWDATA_API DynamicAttributesInitializer(){};
FWDATA_API virtual void init( ::fwTools::Object::wptr _obj);
FWDATA_API virtual void init( ::fwTools::Object::sptr _obj);
FWDATA_API virtual void uninit( ::fwCore::LogicStamp::csptr key );
};
......
......
......@@ -24,9 +24,9 @@ InitializerRegistrar::wptr reg = InitializerRegistrar::New();
namespace fwData
{
void DynamicAttributesInitializer::init( ::fwTools::Object::wptr _obj)
void DynamicAttributesInitializer::init( ::fwTools::Object::sptr _obj)
{
::fwData::Object::sptr obj = ::fwData::Object::dynamicCast(_obj.lock());
::fwData::Object::sptr obj = ::fwData::Object::dynamicCast(_obj);
if (obj)
{
obj->__FWTOOLS_ATTRIBUTES_REGISTER_FUNC_NAME();
......
......
......@@ -26,7 +26,7 @@ public :
FWMEMORY_API Initializer() {} ;
FWMEMORY_API ~Initializer() {} ;
FWMEMORY_API virtual void init( ::fwTools::Object::wptr _obj);
FWMEMORY_API virtual void init( ::fwTools::Object::sptr _obj);
FWMEMORY_API virtual void uninit( ::fwCore::LogicStamp::csptr key );
private:
......
......
......@@ -22,33 +22,33 @@ namespace fwMemory
//------------------------------------------------------------------------------
void Initializer::init( ::fwTools::Object::wptr _obj)
void Initializer::init( ::fwTools::Object::sptr _obj)
{
OSLM_TRACE("fwMemory::Initializer install and start MEMORY service for " + _obj.lock()->className() ) ;
if( ::fwServices::registry::ServiceFactory::getDefault()->support(_obj.lock()->getClassname(), "::fwMemory::IMemoryService") )
OSLM_TRACE("fwMemory::Initializer install and start MEMORY service for " + _obj->className() ) ;
if( ::fwServices::registry::ServiceFactory::getDefault()->support(_obj->getClassname(), "::fwMemory::IMemoryService") )
{
// To avoid invoking the IMemoryService::start() several times
if( ! ::fwServices::OSR::has(_obj.lock(), "::fwMemory::IMemoryService") )
if( ! ::fwServices::OSR::has(_obj, "::fwMemory::IMemoryService") )
{
std::string defaultImpl = ::fwServices::registry::ServiceFactory::getDefault()->getDefaultImplementationIdFromObjectAndType(_obj.lock()->getClassname(), "::fwMemory::IMemoryService");
::fwServices::IService::sptr srv = ::fwServices::add( _obj.lock(), "::fwMemory::IMemoryService", defaultImpl) ;
std::string defaultImpl = ::fwServices::registry::ServiceFactory::getDefault()->getDefaultImplementationIdFromObjectAndType(_obj->getClassname(), "::fwMemory::IMemoryService");
::fwServices::IService::sptr srv = ::fwServices::add( _obj, "::fwMemory::IMemoryService", defaultImpl) ;
srv->start();
m_container[_obj.lock()->getOSRKey()].push_back(srv);
m_container[_obj->getOSRKey()].push_back(srv);
}
}
OSLM_TRACE("fwMemory::Initializer install and start DUMP service if possible for " + _obj.lock()->className() ) ;
if( ::fwServices::registry::ServiceFactory::getDefault()->support(_obj.lock()->getClassname(), "::fwMemory::IDumpService") )
OSLM_TRACE("fwMemory::Initializer install and start DUMP service if possible for " + _obj->className() ) ;
if( ::fwServices::registry::ServiceFactory::getDefault()->support(_obj->getClassname(), "::fwMemory::IDumpService") )
{
OSLM_TRACE("Support DUMP service for " + _obj.lock()->className() ) ;
OSLM_TRACE("Support DUMP service for " + _obj->className() ) ;
// To avoid invoking the IDumpService::start() several times
if( ! ::fwServices::OSR::has(_obj.lock(), "::fwMemory::IDumpService") )
if( ! ::fwServices::OSR::has(_obj, "::fwMemory::IDumpService") )
{
OSLM_TRACE("Start DUMP service for " + _obj.lock()->className() ) ;
std::string defaultImpl = ::fwServices::registry::ServiceFactory::getDefault()->getDefaultImplementationIdFromObjectAndType(_obj.lock()->getClassname(), "::fwMemory::IDumpService");
::fwServices::IService::sptr srv = ::fwServices::add( _obj.lock(), "::fwMemory::IDumpService", defaultImpl) ;
OSLM_TRACE("Start DUMP service for " + _obj->className() ) ;
std::string defaultImpl = ::fwServices::registry::ServiceFactory::getDefault()->getDefaultImplementationIdFromObjectAndType(_obj->getClassname(), "::fwMemory::IDumpService");
::fwServices::IService::sptr srv = ::fwServices::add( _obj, "::fwMemory::IDumpService", defaultImpl) ;
srv->start();
m_container[_obj.lock()->getOSRKey()].push_back(srv);
m_container[_obj->getOSRKey()].push_back(srv);
}
}
}
......
......
......@@ -63,7 +63,7 @@ public :
* The Factory will process Initializer::init() on this object for all registered Initializers
* @param[in] _obj the object to be initialized (weak ptr)
*/
FWTOOLS_API virtual void init( ::fwTools::Object::wptr _obj ) = 0;
FWTOOLS_API virtual void init( ::fwTools::Object::sptr _obj ) = 0;
/**
* @brief Uninitializes data with the LogicStamp 'key'
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment