7 #include "dataReg/parser/List.hpp" 9 #include <fwData/List.hpp> 11 #include <fwServices/macros.hpp> 13 #include <boost/foreach.hpp> 24 bool List::refObjectValidator( ::fwRuntime::ConfigurationElement::sptr _cfgElement )
29 configEltIter != _cfgElement->end();
32 std::string subElementName = (*configEltIter)->getName();
33 if( subElementName !=
"service" &&
34 subElementName !=
"serviceList" )
37 "xml subelement \""<< subElementName <<
38 "\" for element object is not supported for the moment when you use a reference on item List.");
50 SLM_FATAL(
"This method is deprecated, and thus shouldn't be used.");
55 void List::createConfig( ::fwTools::Object::sptr _obj )
58 const std::string OBJECT_BUILD_MODE =
"src";
59 const std::string BUILD_OBJECT =
"new";
60 const std::string GET_OBJECT =
"ref";
62 ::fwData::List::sptr dataList = ::fwData::List::dynamicCast(_obj);
63 SLM_ASSERT(
"The passed object must be a fwData::List", dataList);
65 for( ::fwRuntime::ConfigurationElement::csptr elem : m_cfg->getElements() )
67 if( elem->getName() ==
"item" )
71 std::string buildMode = BUILD_OBJECT;
73 if ( elem->hasAttribute( OBJECT_BUILD_MODE ) )
75 buildMode = elem->getExistingAttributeValue( OBJECT_BUILD_MODE );
76 OSLM_ASSERT(
"The buildMode \""<< buildMode <<
"\" is not supported, it should be either BUILD_OBJECT" 78 buildMode == BUILD_OBJECT || buildMode == GET_OBJECT );
81 if( buildMode == BUILD_OBJECT )
86 ctm->::fwServices::IAppConfigManager::setConfig( elem );
88 m_ctmContainer.push_back( ctm );
90 ::fwData::Object::sptr localObj = ctm->getConfigRoot();
93 SLM_ASSERT(
"A ::fwData::List can contain only ::fwData::Object", localObj );
94 dataList->getContainer().push_back( localObj );
107 void List::startConfig()
109 for( ::fwServices::IAppConfigManager::sptr ctm : m_ctmContainer )
117 void List::updateConfig()
119 for( ::fwServices::IAppConfigManager::sptr ctm : m_ctmContainer )
127 void List::stopConfig()
129 BOOST_REVERSE_FOREACH( ::fwServices::IAppConfigManager::sptr ctm, m_ctmContainer )
137 void List::destroyConfig()
139 BOOST_REVERSE_FOREACH( ::fwServices::IAppConfigManager::sptr ctm, m_ctmContainer )
143 m_ctmContainer.clear();
#define OSLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
The namespace dataReg (data registration) contains classes which allow to parse the xml configuration...
virtual DATAREG_API void updating() override
Updating method : create List object.
Specific service for the construction of a List and its associated services from an XML-based descrip...
#define SLM_FATAL(message)
#define OSLM_ERROR(message)
This class defines a list of objects.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
static FWSERVICES_API std::shared_ptr< IAppConfigManager > New()
Service type for the construction of an object and associated services from an XML-based description...
Container::iterator Iterator
Defines the configuration element container type.