RTC Toolkit  2.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 
28 
29 namespace rtctk::rtcSupervisor {
30 
31 using namespace rtctk::componentFramework;
32 
34 
36  friend class RtcMonitor;
37 
38 public:
40 
41  RtcSupervisor(const std::string& comp_name, ServiceContainer& services);
42 
43  virtual ~RtcSupervisor();
44 
45  void ActivityStarting(StopToken st) override;
46  void ActivityRecovering(StopToken st) override;
47  void ActivityInitialising(StopToken st) override;
48  void ActivityEnabling(StopToken st) override;
49  void ActivityDisabling(StopToken st) override;
50  void ActivityGoingRunning(StopToken st) override;
51  void ActivityGoingIdle(StopToken st) override;
52  void ActivityRunning(StopToken st) override;
53  void ActivityUpdating(StopToken st, Payload args) override;
54  bool GuardUpdatingAllowed(Payload args) override;
55 
56  void InError(bool flag, const std::string why);
57 
58 protected:
63  std::mutex& GlobalMutex();
64  std::mutex m_global_mutex;
65 
69  void MonitorCycle();
70 
74  const std::string name;
75 
83 
88  std::shared_ptr<StateSubscriber> m_state_subscriber;
89 
93  void
94  OnStateEventReceived(const double timestamp, const std::string& name, const std::string& state);
95 
97  std::string m_disp_state;
98  std::string m_gstate;
99  std::string m_gsubstate;
100  bool m_gerror;
101  std::string m_gwho_is_in_error;
102  void PublishGState();
103 
108 
109  void PopulateRuntimeRepo();
110 
114  void LoadStaticConfig();
115  void LoadDynamicConfig();
116 
121 };
122 
123 } // namespace rtctk::rtcSupervisor
124 
125 #endif // RTCTK_RTCSUPERVISOR_RTCSUPERVISOR_HPP
serviceContainer.hpp
A container that can hold any type of service.
rtctk::rtcSupervisor
Definition: rtcCommandRequest.hpp:19
rtctk::rtcSupervisor::RtcSupervisor::m_init_alone
bool m_init_alone
Definition: rtcSupervisor.hpp:117
wscript.name
name
Definition: wscript:15
rtctk::rtcSupervisor::RtcSupervisor::svc
ServiceDiscovery & svc
Definition: rtcSupervisor.hpp:81
rtctk::componentFramework::Runnable::BizLogicIf
Definition: runnable.hpp:34
rtctk::rtcSupervisor::RtcSupervisor::services
ServiceContainer & services
access to services
Definition: rtcSupervisor.hpp:79
rtctk::rtcSupervisor::RtcSupervisor::m_gwho_is_in_error
std::string m_gwho_is_in_error
Definition: rtcSupervisor.hpp:101
rtctk::rtcSupervisor::RtcSupervisor::m_disp_state
std::string m_disp_state
currently evaluated global state etc
Definition: rtcSupervisor.hpp:97
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:88
rtctk::rtcSupervisor::Super
Runnable< RtcComponent > Super
Definition: rtcSupervisor.hpp:33
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:98
rtcObjectConfig.hpp
Config of objects and command lists.
rtctk::rtcSupervisor::RtcSupervisor::m_disable_alone
bool m_disable_alone
Definition: rtcSupervisor.hpp:120
rtctk::rtcSupervisor::RtcSupervisor::rtr
RuntimeRepoIf & rtr
Definition: rtcSupervisor.hpp:80
rtctk::rtcSupervisor::RtcSupervisor::m_enable_alone
bool m_enable_alone
Definition: rtcSupervisor.hpp:118
rtctk::rtcSupervisor::RtcSupervisor::oldb
OldbIf & oldb
Definition: rtcSupervisor.hpp:82
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:100
rtctk::rtcSupervisor::RtcSupervisor::m_mon
RtcMonitor m_mon
the monitor thread
Definition: rtcSupervisor.hpp:107
rtctk::rtcSupervisor::RtcSupervisor::m_global_mutex
std::mutex m_global_mutex
Definition: rtcSupervisor.hpp:64
rtctk::rtcSupervisor::RtcSupervisor
Definition: rtcSupervisor.hpp:35
rtctk::rtcSupervisor::RtcSupervisor::m_gsubstate
std::string m_gsubstate
Definition: rtcSupervisor.hpp:99
rtctk_ctrl_mon_tool.state
def state(ctx, str component)
Definition: rtctk_ctrl_mon_tool.py:158
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:119
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:87
rtctk::rtcSupervisor::RtcSupervisor::name
const std::string name
identity
Definition: rtcSupervisor.hpp:74
oldbIf.hpp
Header file for OldbIf, which defines the API for OldbAdapters.