fw4spl
SStarter.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #pragma once
8 
9 #include "gui/config.hpp"
10 
11 #include <fwGui/IActionSrv.hpp>
12 
13 #include <fwServices/IService.hpp>
14 
15 #include <vector>
16 
17 namespace gui
18 {
19 namespace action
20 {
21 
89 class GUI_CLASS_API SStarter : public ::fwGui::IActionSrv
90 {
91 
92 public:
93 
95  typedef ::fwRuntime::ConfigurationElement::sptr ConfigurationType;
96 
100  GUI_API SStarter() noexcept;
101 
105  GUI_API virtual ~SStarter() noexcept;
106 
107 protected:
108 
109  enum ActionType
110  {
111  START,
112  STOP,
113  START_OR_STOP,
114  START_IF_EXISTS,
115  START_ONLY,
116  START_ONLY_OR_STOP,
117  STOP_IF_EXISTS,
118  DO_NOTHING
119  };
120 
124  GUI_API virtual void info(std::ostream& _sstream ) override;
125 
129  GUI_API void updating() override;
130 
135  GUI_API void configuring() override;
136 
137  GUI_API virtual void starting() override;
138 
143  GUI_API virtual void stopping() override;
144 
145 private:
146  typedef ::fwTools::fwID::IDType IDSrvType;
147  typedef std::pair< IDSrvType, ActionType > PairIDActionType;
148  typedef std::vector<PairIDActionType> VectPairIDActionType;
149  typedef std::set<IDSrvType> SetIDSrvType;
150 
151  // vector representing uuid's services that must be started (true) or stopped (false)
152  VectPairIDActionType m_uuidServices;
153  SetIDSrvType m_idStartedSrvSet;
154 };
155 
156 } // namespace action
157 } // namespace gui
The namespace gui contains the basic services to build the application IHM.
Defines the service interface managing the menu items.
Definition: IActionSrv.hpp:24
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
Apply an action (start, stop, ...) on a service specify by uid.
Definition: SStarter.hpp:89