9 #include "fwServices/IService.hpp" 11 #include <fwCom/Signal.hxx> 24 template<
class SERVICE>
27 return ::fwServices::OSR::get()->getServices< SERVICE >();
32 template<
class SERVICE>
33 std::set< SPTR(SERVICE) >
getServices(::fwData::Object::sptr obj)
35 return ::fwServices::OSR::get()->getServices< SERVICE >(obj);
60 template<
class SERVICE>
61 std::set< SPTR(SERVICE) > ObjectService::getServices()
const 63 std::set< SPTR(SERVICE) > services;
64 const ServiceContainerType::right_map& right = m_container.right;
65 for(
const ServiceContainerType::right_map::value_type& elt: right)
67 SPTR(SERVICE) service = std::dynamic_pointer_cast< SERVICE >( elt.first );
70 services.insert( service );
79 template<
class SERVICE>
80 std::set< SPTR(SERVICE) > ObjectService::getServices(::fwData::Object::sptr obj)
const 84 std::set< SPTR(SERVICE) > services;
85 if(m_container.left.find(obj) != m_container.left.end())
87 ServiceContainerType::left_map::const_iterator iter;
88 ServiceContainerType::left_map::const_iterator firstElement = m_container.left.lower_bound(obj);
89 ServiceContainerType::left_map::const_iterator lastElement = m_container.left.upper_bound(obj);
90 for (iter = firstElement; iter != lastElement; ++iter)
92 SPTR(SERVICE) service = std::dynamic_pointer_cast< SERVICE >( iter->second );
95 services.insert( service );
104 template<
class SERVICE>
105 ObjectService::ObjectVectorType ObjectService::getObjects()
const 107 ObjectVectorType objects;
108 const ServiceContainerType::right_map& right = m_container.right;
109 for(
const ServiceContainerType::right_map::value_type& elt : right)
111 SPTR(SERVICE) service = std::dynamic_pointer_cast< SERVICE >( elt.first );
112 if ( service && std::find(objects.begin(), objects.end(), service->getObject()) == objects.end() )
114 objects.insert( service->getObject() );
117 SLM_WARN_IF(
"No object registered for the requested type of service", objects.empty() );
Contains fwAtomsFilter::registry details.
std::set< std::shared_ptr< SERVICE > > getServices()
Wraps ObjectService::getServices.
#define SLM_DEBUG_IF(message, cond)
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.
static FWSERVICES_APIconst::fwCom::Signals::SignalKeyType s_REGISTERED_SIG
Type of signal m_sigRenderRequested.
static FWSERVICES_APIconst::fwCom::Signals::SignalKeyType s_UNREGISTERED_SIG
Type of signal m_sigRenderRequested.
#define SLM_WARN_IF(message, cond)