OpenDaVINCI  4.16.0
RuntimeControl.h
Go to the documentation of this file.
1 
20 #ifndef CONTEXT_BASE_RUNTIMECONTROL_H_
21 #define CONTEXT_BASE_RUNTIMECONTROL_H_
22 
23 #include <vector>
24 
26 #include <memory>
30 
31 namespace odcore { namespace wrapper { class Time; } }
32 
33 namespace odcontext {
34  namespace base {
35 
36 class ControlledContainerConferenceFactory;
37 class ControlledTimeFactory;
38 class RuntimeControlInterface;
39 class RuntimeEnvironment;
40 class SuperComponent;
41 class TimeTriggeredConferenceClientModuleRunner;
42 
43  using namespace std;
44 
49  public:
54  };
55 
56  enum ERRORCODES {
65  };
66 
67  private:
74 
80  RuntimeControl& operator=(const RuntimeControl&);
81 
82  public:
89 
90  virtual ~RuntimeControl();
91 
100  void setup(const enum RUNTIMECONTROL &takeControl);
101 
107  enum ERRORCODES run();
108 
119  enum ERRORCODES run(RuntimeEnvironment &rte, const uint32_t &maxRunningTimeInSeconds);
120 
124  void tearDown();
125 
126  protected:
134  virtual enum ERRORCODES runStandalone();
135 
143  void setupSystemContextComponents(RuntimeEnvironment &rte);
144 
152  void tearDownSystemContextComponents(RuntimeEnvironment &rte);
153 
154  private:
155  // This method comes from AbstractModule and will be simply disabled.
156  virtual void waitForNextFullSecond(const uint32_t &secondsIncrement);
157 
165  void setupSystemContext(RuntimeEnvironment &rte);
166 
174  void setupSystemReportingComponents(RuntimeEnvironment &rte);
175 
179  void removeExistingContainerConferenceFactory();
180 
184  void removeExistingTimeFactory();
185 
193  void registerSystemContextComponentsAddControlledContainerConferenceFactory(RuntimeEnvironment &rte);
194 
202  vector<std::shared_ptr<TimeTriggeredConferenceClientModuleRunner> > createListOfTimeTriggeredConferenceClientModuleRunners(RuntimeEnvironment &rte);
203 
209  void doReporting(RuntimeEnvironment &rte, const odcore::wrapper::Time &time);
210 
211  public:
216  public:
217  void disable();
218 
219  virtual std::shared_ptr<odcore::wrapper::Time> now();
220  };
221 
222  private:
223  odcore::base::Mutex m_controlMutex;
224  enum RUNTIMECONTROL m_control;
225  bool m_tearDownCalled;
226  const RuntimeControlInterface &m_runtimeControlInterface;
227  SuperComponent *m_superComponent;
228  ControlledContainerConferenceFactory *m_controlledContainerConferenceFactory;
229  ControlledTimeFactory *m_controlledTimeFactory;
230  };
231 
232  }
233 } // odcontext::base
234 
235 #endif /*CONTEXT_BASE_RUNTIMECONTROL_H_*/
Definition: RuntimeControl.h:51
Definition: RuntimeControlInterface.h:36
Definition: base/Mutex.h:49
Definition: SuperComponent.h:53
ERRORCODES
Definition: RuntimeControl.h:56
Definition: Time.h:34
#define OPENDAVINCI_API
Definition: opendavinci.h:67
Definition: RuntimeControl.h:48
Definition: ControlledTimeFactory.h:39
Definition: ControlledContainerConferenceFactory.h:47
Definition: TimeFactory.h:59
Definition: RuntimeControl.h:53
Definition: AbstractModule.h:41
Definition: RuntimeEnvironment.h:42
RUNTIMECONTROL
Definition: RuntimeControl.h:50