7 #include "activities/SSeriesSignal.hpp" 9 #include <fwCom/Signal.hpp> 10 #include <fwCom/Signal.hxx> 11 #include <fwCom/Slot.hpp> 12 #include <fwCom/Slots.hpp> 13 #include <fwCom/Slots.hxx> 15 #include <fwMedData/ActivitySeries.hpp> 17 #include <fwRuntime/Convert.hpp> 18 #include <fwRuntime/operations.hpp> 20 #include <fwServices/macros.hpp> 22 #include <boost/foreach.hpp> 33 const ::fwCom::Slots::SlotKeyType SSeriesSignal::s_REPORT_SERIES_SLOT =
"reportSeries";
34 const ::fwCom::Signals::SignalKeyType SSeriesSignal::s_SERIES_ADDED_SIG =
"seriesAdded";
40 m_sigSeriesAdded = newSignal< SeriesAddedSignalType >(s_SERIES_ADDED_SIG);
42 newSlot(s_REPORT_SERIES_SLOT, &SSeriesSignal::reportSeries,
this);
68 const ::fwServices::IService::ConfigType srvconfig = this->
getConfigTree();
70 if(srvconfig.count(
"filter") == 1 )
72 const ::fwServices::IService::ConfigType& configFilter = srvconfig.get_child(
"filter");
73 SLM_ASSERT(
"A maximum of 1 <mode> tag is allowed", configFilter.count(
"mode") < 2);
75 const std::string mode = configFilter.get< std::string >(
"mode");
76 SLM_ASSERT(
"'" + mode +
"' value for <mode> tag isn't valid. Allowed values are : 'include', 'exclude'.",
77 mode ==
"include" || mode ==
"exclude");
80 BOOST_FOREACH(
const ConfigType::value_type& v, configFilter.equal_range(
"type") )
82 m_types.push_back(v.second.get<std::string>(
""));
85 SLM_ASSERT(
"A maximum of 1 <filter> tag is allowed", srvconfig.count(
"filter") < 2);
90 void SSeriesSignal::reportSeries(::fwMedData::SeriesDB::ContainerType addedSeries)
92 for(const ::fwMedData::Series::sptr& series : addedSeries)
94 const bool isIncludeMode = m_filterMode ==
"include";
96 std::string
classname = series->getClassname();
97 TypesType::iterator keyIt = std::find(m_types.begin(), m_types.end(),
classname);
99 if(keyIt != m_types.end() && isIncludeMode)
101 m_sigSeriesAdded->asyncEmit(series);
103 else if(keyIt == m_types.end() && !isIncludeMode)
105 m_sigSeriesAdded->asyncEmit(series);
133 if (!this->getInput< ::fwMedData::SeriesDB >(
"seriesDB"))
ACTIVITIES_API SSeriesSignal() noexcept
Constructor. Do nothing.
#define FW_DEPRECATED_KEY(newKey, access, version)
Use this macro when deprecating a service key to warn the developer.
This class is a helper to define the connections of a service and its data.
virtual void configuring() override
Parse XML configuration.
This service emits a signal for each added series (the signal contains the added series) ...
static const std::string & classname()
return object's classname without its namespace, i.e. BaseObject
virtual ACTIVITIES_API ~SSeriesSignal() noexcept
Destructor. Do nothing.
static FWMEDDATA_APIconst::fwCom::Signals::SignalKeyType s_ADDED_SERIES_SIG
Type of signal when series are added.
ACTIVITIES_API KeyConnectionsMap getAutoConnections() const override
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
This interface defines control service API. Does nothing particularly, can be considered as a default...
virtual ACTIVITIES_API KeyConnectionsType getObjSrvConnections() const override
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
virtual void stopping() override
Do nothing.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
The namespace activities contains helpers and services allowing to launch activities.
::fwCom::helper::SigSlotConnection::KeyConnectionsType KeyConnectionsType
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
virtual void updating() override
Do nothing.
virtual void starting() override
Do nothing.
FWSERVICES_API ConfigType getConfigTree() const
Return the configuration, in an boost property tree.