7 #include "gui/action/SSlotCaller.hpp" 9 #include <fwCom/Slot.hpp> 10 #include <fwCom/Slot.hxx> 11 #include <fwCom/Slots.hpp> 12 #include <fwCom/Slots.hxx> 14 #include <fwCore/base.hpp> 16 #include <fwGui/dialog/MessageDialog.hpp> 18 #include <fwRuntime/Extension.hpp> 19 #include <fwRuntime/helper.hpp> 21 #include <fwServices/macros.hpp> 23 #include <fwTools/fwID.hpp> 25 #include <boost/regex.hpp> 67 _sstream <<
"Starter Action" << std::endl;
78 for(
const SlotInfoType&
info : m_slotInfos)
80 const HasSlotIDType& HasSlotId =
info.first;
81 const ::fwCom::Slots::SlotKeyType& slotKey =
info.second;
86 const ::fwCom::HasSlots::csptr hasSlots = std::dynamic_pointer_cast<
::fwCom::HasSlots >(obj);
87 SLM_ASSERT(
"Object with id " << HasSlotId <<
" is not a HasSlots", hasSlots);
89 const ::fwCom::SlotBase::csptr slot = hasSlots->slot(slotKey);
106 ConfigurationType cfg =
m_configuration->findConfigurationElement(
"slots");
110 ::boost::regex re(
"(.*)/(.*)");
111 ::boost::smatch match;
112 std::string src, uid, key;
114 for(ConfigurationType elem : slotCfgs.
getElements())
116 src = elem->getValue();
117 if( ::boost::regex_match(src, match, re) )
119 OSLM_ASSERT(
"Wrong value for attribute src: "<<src, match.size() >= 3);
120 uid.assign(match[1].first, match[1].second);
121 key.assign(match[2].first, match[2].second);
123 SLM_ASSERT(
"Missing hasSlotsId attribute", !uid.empty());
124 SLM_ASSERT(
"Missing slotKey attribute", !key.empty());
126 m_slotInfos.push_back( std::make_pair(uid, key) );
FWGUI_API bool confirmAction()
Confirm that the action must be executed.
virtual GUI_API ~SSlotCaller() noexcept
Destructor. Does nothing.
FWGUI_API void actionServiceStarting()
Method called when the action service is starting.
Run a slot given by HasSlot id and slot key.
#define OSLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
#define SLM_TRACE_FUNC()
Trace contextual function signature.
The namespace gui contains the basic services to build the application IHM.
FWGUI_API void actionServiceStopping()
Method called when the action service is stopping.
This class proposes a mapping between a SlotKeyType and a SlotBase.
FWRUNTIME_API ConfigurationElementContainer findAllConfigurationElement(const std::string &name) const
Retrieves the configurations corresponding to the specified name.
Defines the service interface managing the menu items.
GUI_API void configuring() override
This method is used to configure the service parameters: specifies which slots must be called...
virtual GUI_API void stopping() override
Uninitialize the service activity. The stop() method is always invoked before destroying a service...
#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.
::fwRuntime::ConfigurationElement::sptr m_configuration
Configuration element used to configure service internal state using a generic XML like structure TOD...
virtual GUI_API void info(std::ostream &_sstream) override
This method gives information about the class.
GUI_API void updating() override
This method run the specified slots.
Defines the generic configuration element container class.
FWRUNTIME_API const Container & getElements() const
Returns the configuration element container.
virtual GUI_API void starting() override
Initialize the service activity.
GUI_API SSlotCaller() noexcept
Constructor. Does nothing.