9 #include "fwServices/IService.hpp" 16 template<
class DATATYPE >
19 FW_DEPRECATED(
"getObject()",
"getInput() or getInOut()",
"20.0");
21 SPTR(DATATYPE) castData = std::dynamic_pointer_cast<DATATYPE>( m_associatedObject.lock() );
29 template<
class DATATYPE >
32 CSPTR(DATATYPE) input;
34 auto iterator = m_inputsMap.find(key);
35 if(iterator != m_inputsMap.end())
37 input = std::dynamic_pointer_cast<
const DATATYPE>( iterator->second.lock() );
46 template<
class DATATYPE >
50 auto iterator = m_inOutsMap.find(key);
51 if(iterator != m_inOutsMap.end())
53 inout = std::dynamic_pointer_cast<DATATYPE>( iterator->second.lock() );
62 template<
class DATATYPE >
65 SPTR(DATATYPE) output;
66 auto iterator = m_outputsMap.find(key);
67 if(iterator != m_outputsMap.end())
69 output = std::dynamic_pointer_cast<DATATYPE>( iterator->second );
78 template<
class DATATYPE >
79 CSPTR(DATATYPE)
IService::getInput(const KeyType& keybase,
size_t index)
const 82 auto it = m_keyGroupSize.find(keybase);
84 SLM_ASSERT(
"Key group '" + keybase +
"' not found", it != m_keyGroupSize.end());
85 OSLM_ASSERT(
"Index overflow '" << index <<
" >= " << it->second <<
"' in key group '" << keybase <<
".",
87 return this->getInput< DATATYPE >(KEY_GROUP_NAME(keybase, index));
92 template<
class DATATYPE >
93 SPTR(DATATYPE)
IService::getInOut(const KeyType& keybase,
size_t index)
const 96 auto it = m_keyGroupSize.find(keybase);
98 SLM_ASSERT(
"Key group '" + keybase +
"' not found", it != m_keyGroupSize.end());
99 OSLM_ASSERT(
"Index overflow '" << index <<
" >= " << it->second <<
"' in key group '" << keybase <<
".",
101 return this->getInOut< DATATYPE >(KEY_GROUP_NAME(keybase, index));
105 template<
class DATATYPE >
106 SPTR(DATATYPE)
IService::getOutput(const KeyType& keybase,
size_t index)
const 109 auto it = m_keyGroupSize.find(keybase);
111 SLM_ASSERT(
"Key group '" + keybase +
"' not found", it != m_keyGroupSize.end());
112 OSLM_ASSERT(
"Index overflow '" << index <<
" >= " << it->second <<
"' in key group '" << keybase <<
".",
114 return this->getOutput< DATATYPE >(KEY_GROUP_NAME(keybase, index));
121 auto it = m_keyGroupSize.find(keybase);
122 if(it != m_keyGroupSize.end())
157 std::vector< ::fwData::Object::csptr > objectsVector;
158 if(!m_inputsMap.empty() || !m_inOutsMap.empty() || !m_outputsMap.empty())
160 for(
auto itObj : m_inputsMap)
162 objectsVector.push_back(itObj.second.lock());
164 for(
auto itObj : m_inOutsMap)
166 objectsVector.push_back(itObj.second.lock());
168 for(
auto itObj : m_outputsMap)
170 objectsVector.push_back(itObj.second);
178 return objectsVector;
Base class for all services.
FWSERVICES_API std::vector< ::fwData::Object::csptr > getObjects() const
Return the objects associated to service.
FWSERVICES_API const InOutMapType & getInOuts() const
Return the inouts map associated to service.
FWSERVICES_API const OutputMapType & getOutputs() const
Return the outouts map associated to service.
#define OSLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
Namespace fwServices is dedicated to (mimic) the dynamic affectation of methods to (pure data) object...
FWSERVICES_API const InputMapType & getInputs() const
Return the inputs map associated to service.
Type demangler. Use Demangler class to get a demangled string for the type T.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
size_t getKeyGroupSize(const KeyType &keybase) const
Return the number of key in a group of keys.
::fwData::Object::wptr m_associatedObject
associated object of service
#define FW_DEPRECATED(oldFnName, newFnName, version)
Use this macro when deprecating a function to warn the developer.