7 #include "uiIO/action/SExportWithSeriesDB.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> 20 #include <fwMedData/SeriesDB.hpp> 22 #include <fwServices/macros.hpp> 23 #include <fwServices/op/Add.hpp> 24 #include <fwServices/registry/ServiceConfig.hpp> 33 static const ::fwCom::Signals::SignalKeyType JOB_CREATED_SIGNAL =
"jobCreated";
34 static const ::fwCom::Slots::SlotKeyType FORWARD_JOB_SLOT =
"forwardJob";
36 static const ::fwServices::IService::KeyType s_SERIES_INOUT =
"series";
40 SExportWithSeriesDB::SExportWithSeriesDB( ) noexcept :
41 m_ioSelectorSrvConfig("IOSelectorServiceConfigVRRenderReader")
43 m_sigJobCreated = newSignal< JobCreatedSignalType >( JOB_CREATED_SIGNAL );
44 m_slotForwardJob = newSlot( FORWARD_JOB_SLOT, &SExportWithSeriesDB::forwardJob,
this );
49 SExportWithSeriesDB::~SExportWithSeriesDB() noexcept
57 _sstream <<
"Action for add SeriesDB" << std::endl;
65 std::vector < ConfigurationType > vectConfig =
m_configuration->find(
"IOSelectorSrvConfig");
66 if(!vectConfig.empty())
68 ConfigurationType selectorConfig = vectConfig.at(0);
69 SLM_ASSERT(
"Missing 'name' attribute", selectorConfig->hasAttribute(
"name"));
70 m_ioSelectorSrvConfig = selectorConfig->getAttributeValue(
"name");
80 ::fwMedData::Series::sptr series = this->getInOut< ::fwMedData::Series >(s_SERIES_INOUT);
85 series = this->getObject< ::fwMedData::Series >();
88 ::fwMedData::SeriesDB::sptr localSeriesDB = ::fwMedData::SeriesDB::New();
89 localSeriesDB->getContainer().push_back(series);
94 ::fwRuntime::ConfigurationElement::csptr ioCfg;
96 "::uiIO::editor::SIOSelector");
97 SLM_ASSERT(
"There is no service configuration " 98 << m_ioSelectorSrvConfig
99 <<
" for ::uiIO::editor::SIOSelector", ioCfg);
102 ::fwServices::IService::sptr ioSelectorSrv;
103 ioSelectorSrv = ::fwServices::add(
"::uiIO::editor::SIOSelector");
104 ioSelectorSrv->registerInOut(localSeriesDB, ::fwIO::s_DATA_KEY);
108 auto jobCreatedSignal = ioSelectorSrv->signal(
"jobCreated");
111 jobCreatedSignal->connect(m_slotForwardJob);
114 ioSelectorSrv->setConfiguration( ::fwRuntime::ConfigurationElement::constCast(ioCfg) );
115 ioSelectorSrv->configure();
116 ioSelectorSrv->start();
117 ioSelectorSrv->update();
118 ioSelectorSrv->stop();
119 ::fwServices::OSR::unregisterService( ioSelectorSrv );
128 ::fwMedData::Series::sptr series = this->getInOut< ::fwMedData::Series >(s_SERIES_INOUT);
133 series = this->getObject< ::fwMedData::Series >();
135 SLM_FATAL_IF(
"The associated object must be a ::fwMedData::Series.", !series);
149 m_sigJobCreated->emit(iJob);
#define FW_DEPRECATED_KEY(newKey, access, version)
Use this macro when deprecating a service key to warn the developer.
FWGUI_API void actionServiceStarting()
Method called when the action service is starting.
void configuring() override
Configure action. Retrieves the IOSelector config.
FWGUI_API void actionServiceStopping()
Method called when the action service is stopping.
This action allows to export the current series using a temporary seriesDB.
std::shared_ptr< ::fwJobs::IJob > sptr
Cancel request callback type.
Defines the service interface managing the menu items.
void starting() override
Start action.
void stopping() override
Stop action.
void info(std::ostream &_sstream) override
Write information in a stream.
void updating() override
Show the SeriesDB reader selector, load the new SeriesDB and merge it the the current SeriesDB...
#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.
Base class for each data object.
::fwRuntime::ConfigurationElement::sptr m_configuration
Configuration element used to configure service internal state using a generic XML like structure TOD...
#define SLM_FATAL_IF(message, cond)
std::shared_ptr< ::fwThread::Worker > m_associatedWorker
Associated worker.
static FWSERVICES_API ServiceConfig::sptr getDefault()
Return the default global instance of ServiceConfig.
The namespace uiIO contains a simple service to manipulate IO with IHM..