7 #include "uiIO/action/SSeriesDBMerger.hpp" 9 #include <fwCom/Signal.hxx> 10 #include <fwCom/Slots.hpp> 11 #include <fwCom/Slots.hxx> 13 #include <fwGui/Cursor.hpp> 15 #include <fwIO/ioTypes.hpp> 17 #include <fwJobs/IJob.hpp> 19 #include <fwMedData/Series.hpp> 21 #include <fwMedDataTools/helper/SeriesDB.hpp> 23 #include <fwServices/macros.hpp> 24 #include <fwServices/op/Add.hpp> 25 #include <fwServices/registry/ServiceConfig.hpp> 34 static const ::fwCom::Signals::SignalKeyType JOB_CREATED_SIGNAL =
"jobCreated";
35 static const ::fwCom::Slots::SlotKeyType FORWARD_JOB_SLOT =
"forwardJob";
37 static const ::fwServices::IService::KeyType s_SERIES_INOUT =
"seriesDB";
41 SSeriesDBMerger::SSeriesDBMerger( ) noexcept :
42 m_ioSelectorSrvConfig("IOSelectorServiceConfigVRRenderReader")
44 m_sigJobCreated = newSignal< JobCreatedSignalType >( JOB_CREATED_SIGNAL );
45 m_slotForwardJob = newSlot( FORWARD_JOB_SLOT, &SSeriesDBMerger::forwardJob,
this );
50 SSeriesDBMerger::~SSeriesDBMerger() noexcept
58 _sstream <<
"Action for add SeriesDB" << std::endl;
68 std::vector < ConfigurationType > vectConfig =
m_configuration->find(
"IOSelectorSrvConfig");
69 if(!vectConfig.empty())
71 ConfigurationType selectorConfig = vectConfig.at(0);
72 SLM_ASSERT(
"Missing 'name' attribute", selectorConfig->hasAttribute(
"name"));
73 m_ioSelectorSrvConfig = selectorConfig->getAttributeValue(
"name");
84 ::fwMedData::SeriesDB::sptr seriesDB = this->getInOut< ::fwMedData::SeriesDB >(s_SERIES_INOUT);
87 seriesDB = this->getObject< ::fwMedData::SeriesDB >();
90 SLM_ASSERT(
"SeriesDB not instanced", seriesDB);
93 ::fwMedData::SeriesDB::sptr localSeriesDB = ::fwMedData::SeriesDB::New();
98 ::fwRuntime::ConfigurationElement::csptr ioCfg;
100 "::uiIO::editor::SIOSelector");
101 SLM_ASSERT(
"There is no service configuration " 102 << m_ioSelectorSrvConfig
103 <<
" for ::uiIO::editor::SIOSelector", ioCfg);
106 ::fwServices::IService::sptr ioSelectorSrv;
107 ioSelectorSrv = ::fwServices::add(
"::uiIO::editor::SIOSelector");
108 ioSelectorSrv->registerInOut(localSeriesDB, ::fwIO::s_DATA_KEY);
111 auto jobCreatedSignal = ioSelectorSrv->signal(
"jobCreated");
114 jobCreatedSignal->connect(m_slotForwardJob);
117 ioSelectorSrv->setConfiguration( ::fwRuntime::ConfigurationElement::constCast(ioCfg) );
118 ioSelectorSrv->configure();
119 ioSelectorSrv->start();
120 ioSelectorSrv->update();
121 ioSelectorSrv->stop();
122 ::fwServices::OSR::unregisterService( ioSelectorSrv );
125 sDBhelper.
merge(localSeriesDB);
147 m_sigJobCreated->emit(iJob);
#define FW_DEPRECATED_KEY(newKey, access, version)
Use this macro when deprecating a service key to warn the developer.
void stopping() override
Stop action.
FWGUI_API void actionServiceStarting()
Method called when the action service is starting.
#define SLM_TRACE_FUNC()
Trace contextual function signature.
FWGUI_API void actionServiceStopping()
Method called when the action service is stopping.
void updating() override
Show the SeriesDB reader selector, load the new SeriesDB and merge it the the current SeriesDB...
std::shared_ptr< ::fwJobs::IJob > sptr
Cancel request callback type.
Defines the service interface managing the menu items.
void info(std::ostream &_sstream) override
Write information in a stream.
void starting() override
Start action.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
FWGUI_API void initialize()
Initialize the action.
This action allows to load a new SeriesDB and merge it with the current SeriesDB. ...
::fwRuntime::ConfigurationElement::sptr m_configuration
Configuration element used to configure service internal state using a generic XML like structure TOD...
std::shared_ptr< ::fwThread::Worker > m_associatedWorker
Associated worker.
static FWSERVICES_API ServiceConfig::sptr getDefault()
Return the default global instance of ServiceConfig.
void configuring() override
Configure action. Retrieves the IOSelector config.
The namespace uiIO contains a simple service to manipulate IO with IHM..