RTC Toolkit  1.0.0
rtcSupervisor.hpp
Go to the documentation of this file.
1 
12 #ifndef RTCTK_RTCSUPERVISOR_RTCSUPERVISOR_HPP
13 #define RTCTK_RTCSUPERVISOR_RTCSUPERVISOR_HPP
14 
15 #include <mutex>
16 
23 
24 #include <rtcMonitor.hpp>
26 
27 using namespace rtctk::componentFramework;
28 
29 namespace rtctk::rtcSupervisor {
30 
32 
34  friend class RtcMonitor;
35 
36 public:
38 
39  RtcSupervisor(const std::string& comp_name, ServiceContainer& services);
40 
41  virtual ~RtcSupervisor();
42 
43  void ActivityStarting(StopToken st) override;
44  void ActivityRecovering(StopToken st) override;
45  void ActivityInitialising(StopToken st) override;
46  void ActivityEnabling(StopToken st) override;
47  void ActivityDisabling(StopToken st) override;
48  void ActivityGoingRunning(StopToken st) override;
49  void ActivityGoingIdle(StopToken st) override;
50  void ActivityRunning(StopToken st) override;
51  void ActivityUpdating(StopToken st, Payload args) override;
52  bool GuardUpdatingAllowed(Payload args) override;
53 
54  void InError(bool flag, const std::string why);
55 
56 protected:
61  std::mutex& GlobalMutex();
62  std::mutex m_global_mutex;
63 
67  void MonitorCycle();
68 
72  const std::string name;
73 
81 
86  std::shared_ptr<StateSubscriber> m_state_subscriber;
87 
91  void
92  OnStateEventReceived(const double timestamp, const std::string& name, const std::string& state);
93 
95  std::string m_disp_state;
96  std::string m_gstate;
97  std::string m_gsubstate;
98  bool m_gerror;
99  std::string m_gwho_is_in_error;
100  void PublishGState();
101 
106 
107  void PopulateRuntimeRepo();
108 
112  void LoadStaticConfig();
113  void LoadDynamicConfig();
114 
119 };
120 
121 } // namespace rtctk::rtcSupervisor
122 
123 #endif // RTCTK_RTCSUPERVISOR_RTCSUPERVISOR_HPP
serviceContainer.hpp
A container that can hold any type of service.
rtctk::rtcSupervisor
Definition: rtcCommandRequest.hpp:18
rtctk::rtcSupervisor::RtcSupervisor::m_init_alone
bool m_init_alone
Definition: rtcSupervisor.hpp:115
wscript.name
name
Definition: wscript:15
rtctk::rtcSupervisor::RtcSupervisor::svc
ServiceDiscovery & svc
Definition: rtcSupervisor.hpp:79
rtctk::componentFramework::Runnable::BizLogicIf
Definition: runnable.hpp:34
rtctk::rtcSupervisor::RtcSupervisor::services
ServiceContainer & services
access to services
Definition: rtcSupervisor.hpp:77
rtctk::rtcSupervisor::RtcSupervisor::m_gwho_is_in_error
std::string m_gwho_is_in_error
Definition: rtcSupervisor.hpp:99
rtctk::rtcSupervisor::RtcSupervisor::m_disp_state
std::string m_disp_state
currently evaluated global state etc
Definition: rtcSupervisor.hpp:95
rtcMonitor.hpp
Holds monitor thread for asynch ping of supervised objects.
rtctk::componentFramework
Definition: commandReplier.cpp:20
serviceDiscovery.hpp
Class that implements a very basic service discover mechanism.
rtctk::rtcSupervisor::RtcSupervisor::m_state_subscriber
std::shared_ptr< StateSubscriber > m_state_subscriber
Definition: rtcSupervisor.hpp:86
rtctk::rtcSupervisor::Super
Runnable< RtcComponent > Super
Definition: rtcSupervisor.hpp:31
rtctk::componentFramework::ServiceDiscovery
Class that implements a very basic service discovery mechanism.
Definition: serviceDiscovery.hpp:29
rtctk::componentFramework::StopToken
rad::StopToken StopToken
Definition: stopToken.hpp:19
rtctk::rtcSupervisor::RtcSupervisor::m_gstate
std::string m_gstate
Definition: rtcSupervisor.hpp:96
rtcObjectConfig.hpp
Config of objects and command lists.
rtctk::rtcSupervisor::RtcSupervisor::m_disable_alone
bool m_disable_alone
Definition: rtcSupervisor.hpp:118
rtctk::rtcSupervisor::RtcSupervisor::rtr
RuntimeRepoIf & rtr
Definition: rtcSupervisor.hpp:78
rtctk::rtcSupervisor::RtcSupervisor::m_enable_alone
bool m_enable_alone
Definition: rtcSupervisor.hpp:116
rtctk::rtcSupervisor::RtcSupervisor::oldb
OldbIf & oldb
Definition: rtcSupervisor.hpp:80
runnable.hpp
Lifecycle Extension that makes an RTC Component 'Runnable'.
rtctk::rtcSupervisor::RtcObjectConfig
Definition: rtcObjectConfig.hpp:54
rtctk::componentFramework::Payload
std::string Payload
Definition: payload.hpp:19
rtctk::componentFramework::ServiceContainer
Container class that holds services of any type.
Definition: serviceContainer.hpp:35
rtctk::rtcSupervisor::RtcSupervisor::m_gerror
bool m_gerror
Definition: rtcSupervisor.hpp:98
rtctk::rtcSupervisor::RtcSupervisor::m_mon
RtcMonitor m_mon
the monitor thread
Definition: rtcSupervisor.hpp:105
rtctk::rtcSupervisor::RtcSupervisor::m_global_mutex
std::mutex m_global_mutex
Definition: rtcSupervisor.hpp:62
rtctk::rtcSupervisor::RtcSupervisor
Definition: rtcSupervisor.hpp:33
rtctk::rtcSupervisor::RtcSupervisor::m_gsubstate
std::string m_gsubstate
Definition: rtcSupervisor.hpp:97
rtctk::componentFramework::OldbIf
Definition: oldbIf.hpp:20
rtctk::componentFramework::RuntimeRepoIf
Definition: runtimeRepoIf.hpp:20
stateSubscriber.hpp
Subscribes to stdif state topic via MAL.
rtctk::rtcSupervisor::RtcSupervisor::m_update_alone
bool m_update_alone
Definition: rtcSupervisor.hpp:117
rtctk::componentFramework::Runnable
Life cycle extension to make RtcComponent Runnable.
Definition: runnable.hpp:30
runtimeRepoIf.hpp
Header file for RuntimeRepoIf, which defines the API for RuntimeRepoAdapters.
rtctk::rtcSupervisor::RtcMonitor
Definition: rtcMonitor.hpp:23
rtctk::rtcSupervisor::RtcSupervisor::m_object_config
RtcObjectConfig m_object_config
The Object Config constructed from list of deployed objects.
Definition: rtcSupervisor.hpp:85
rtctk::rtcSupervisor::RtcSupervisor::name
const std::string name
identity
Definition: rtcSupervisor.hpp:72
oldbIf.hpp
Header file for OldbIf, which defines the API for OldbAdapters.