7 #include "memory/SDumpPolicy.hpp" 9 #include <fwCore/base.hpp> 11 #include <fwMemory/BufferManager.hpp> 12 #include <fwMemory/IPolicy.hpp> 14 #include <fwServices/macros.hpp> 23 SDumpPolicy::SDumpPolicy()
27 SDumpPolicy::~SDumpPolicy()
35 typedef ::fwRuntime::ConfigurationElement::sptr ConfigurationType;
36 std::vector < ConfigurationType > config =
m_configuration->find(
"config");
40 std::vector < ConfigurationType > policy = config.at(0)->find(
"policy");
41 std::vector < ConfigurationType > paramsElement = config.at(0)->find(
"params");
43 m_policyParams.clear();
48 m_policy = policy.at(0)->getValue();
51 if(!paramsElement.empty())
53 const ConfigurationType& params = paramsElement.at(0);
55 ::fwRuntime::ConfigurationElement::Container::const_iterator iter;
57 for (iter = params->begin(); iter != params->end(); ++iter)
59 m_policyParams.push_back( ParametersType::value_type((*iter)->getName(), (*iter)->getValue()));
72 ::fwMemory::IPolicy::sptr policy = ::fwMemory::policy::registry::get()->create(m_policy);
77 for(
const ParametersType::value_type& param : m_policyParams)
79 success = policy->setParam(param.first, param.second);
81 << param.first <<
"' parameter to " << param.second,
83 OSLM_INFO_IF(
"Set '" << param.first <<
"' policy parameter to " << param.second, success);
86 manager->setDumpPolicy(policy);
87 OSLM_INFO(
"Set dump policy to : " << m_policy);
89 OSLM_ERROR_IF(
"Unable to instantiate '" << m_policy <<
"' dump policy", !policy);
virtual MEMORY_API void configuring() override
virtual MEMORY_API void swapping() override
Overrides.
static FWMEMORY_API BufferManager::sptr getDefault()
Returns the current BufferManager instance.
#define OSLM_INFO_IF(message, cond)
#define OSLM_INFO(message)
::boost::unique_lock< ReadWriteMutex > WriteLock
Defines a lock of write type for read/write mutex.
virtual MEMORY_API void updating() override
Overrides.
This interface defines control service API. Does nothing particularly, can be considered as a default...
virtual MEMORY_API void starting() override
Overrides.
Base class for each data object.
::fwRuntime::ConfigurationElement::sptr m_configuration
Configuration element used to configure service internal state using a generic XML like structure TOD...
The namespace memory contains tools to manage memory. It is used for dump. It allows to define the bu...
virtual MEMORY_API void stopping() override
Overrides.
#define OSLM_ERROR_IF(message, cond)