RTC Toolkit  2.0.0
stdComponent.hpp
Go to the documentation of this file.
1 
12 #ifndef RTCTK_COMPONENTFRAMEWORK_STDCOMPONENT_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_STDCOMPONENT_HPP
14 
16 #include <rtctk/componentFramework/events.rad.hpp>
25 
26 #include <mal/Cii.hpp>
27 
28 #include <memory>
29 #include <string>
30 
31 namespace rtctk::componentFramework {
32 
33 class LogInfo : public stdif::LogInfo {
34 public:
35 
36  LogInfo() = default;
37 
38  LogInfo(std::string const& level, std::string const& logger="")
39  : m_logger(logger), m_level(level) {
40 
41  }
42 
43  std::string getLogger() const override {
44  return m_logger;
45  }
46 
47  void setLogger(std::string const& logger) override {
48  m_logger = logger;
49  }
50 
51  std::string getLevel() const override {
52  return m_level;
53  }
54 
55  void setLevel(std::string const& level) override {
56  m_level = level;
57  }
58 
59  bool hasKey() const override {
60  return false;
61  }
62 
63  bool keyEquals(stdif::LogInfo const& other) const override {
64  return false;
65  }
66 
67  std::unique_ptr<stdif::LogInfo> clone() const override {
68  return std::make_unique<LogInfo>(m_logger, m_level);
69  }
70 
71  std::unique_ptr<stdif::LogInfo> cloneKey() const override {
72  return std::make_unique<LogInfo>(m_logger, m_level);
73  }
74 
75 private:
76  std::string m_logger;
77  std::string m_level;
78 };
79 
81 
82 // this we reply over MAL for commands that succeeds
83 inline const std::string STD_OK_REPLY = "OK";
84 
86 
87 // High level excepiton types returned via MAL
88 
89 // somebody send a stop or abort command
90 class StdIfRequestAborted : public stdif::ExceptionErr {
91 public:
92  static constexpr int32_t ERROR_CODE = 11;
94  : stdif::ExceptionErr("Request aborted.", ERROR_CODE) {
95  }
96 };
97 
98 // command is not allowed in current state or guard
99 class StdIfRequestRejected : public stdif::ExceptionErr {
100 public:
104  static constexpr int32_t ERROR_CODE = 10;
105  StdIfRequestRejected(std::string const& request_id, std::string const& state_id)
106  : stdif::ExceptionErr("Request " + request_id + " rejected in state " + state_id,
107  ERROR_CODE) {
108  }
109 };
110 
111 // the command was accepted but the task to do failed
112 class StdIfRequestFailed : public stdif::ExceptionErr {
113 public:
117  static constexpr int32_t ERROR_CODE = 501;
118  StdIfRequestFailed(std::string const& message)
119  : stdif::ExceptionErr(message, ERROR_CODE) {
120  }
121 };
122 
124 RTCTK_DEFINE_OPTION(UseInitialising, Enabled);
127 
137 template <typename... Options>
138 struct StdComponent {
140  : RTCTK_APPLY_OPTION_ED(Options, UseStarting)
141  , RTCTK_APPLY_OPTION_ED(Options, UseInitialising)
142  , RTCTK_APPLY_OPTION_ED(Options, UseEnabling)
143  , RTCTK_APPLY_OPTION_ED(Options, UseDisabling) {
144  };
145 
147  RTCTK_ASSERT_OPTION_ED(UseInitialising);
149  RTCTK_ASSERT_OPTION_ED(UseDisabling);
150 
152  : public optional_base<IStarting, RTCTK_IS_OPTION(UseStarting, Enabled)>
153  , public optional_base<IInitialising, RTCTK_IS_OPTION(UseInitialising, Enabled)>
154  , public optional_base<IEnabling, RTCTK_IS_OPTION(UseEnabling, Enabled)>
155  , public optional_base<IDisabling, RTCTK_IS_OPTION(UseDisabling, Enabled)> {
156  };
157 
158  class InputStage {
159  public:
161  : m_replier(replier), m_engine(engine) {
162  // TODO should this also inject the events from the singal handler, e.g. SIGTERM
163  }
164 
165  virtual ~InputStage() = default;
166 
167  virtual void Start() {
169  }
170 
171  protected:
174  };
175 
176  class OutputStage {
177  public:
178 
180  // Handlers ###################################################################
181 
182  engine.RegisterRejectHandler<events::Init, StdIfRequestRejected>();
183  engine.RegisterRejectHandler<events::Stop, StdIfRequestRejected>();
185  engine.RegisterRejectHandler<events::Enable, StdIfRequestRejected>();
186  engine.RegisterRejectHandler<events::Disable, StdIfRequestRejected>();
187  engine.RegisterRejectHandler<events::GetState, StdIfRequestRejected>();
188  engine.RegisterRejectHandler<events::Exit, StdIfRequestRejected>();
189 
190  m_success_handler = [this] { m_engine.PostEvent(std::make_unique<events::Done>()); };
191 
192  m_error_handler = [this](std::exception_ptr eptr) {
193  m_engine.PostEvent(std::make_unique<events::Error>(eptr));
194  };
195 
196  // Reset ######################################################################
197 
198  if constexpr (RTCTK_IS_OPTION(UseStarting, Enabled)) {
199  engine.RegisterAction("ActionStartingEntry", [this](auto c) {
200  m_tmp_request = GetPayloadNothrow<events::Reset>(c);
201  });
202 
203  engine.RegisterAction("ActionStartingDone", [this](auto c) {
204  if (m_tmp_request) {
205  m_tmp_request->SetReplyValue(STD_OK_REPLY);
206  m_tmp_request = nullptr;
207  }
208  });
209  } else {
210  engine.RegisterAction("ActionStartingDone", [this](auto c) {
211  auto req = GetPayloadNothrow<events::Reset>(c);
212  if (req == nullptr) {
213  return;
214  }
215  req->SetReplyValue(STD_OK_REPLY);
216  });
217  }
218 
219  // Init ######################################################################
220 
221  if constexpr (RTCTK_IS_OPTION(UseInitialising, Enabled)) {
222  engine.RegisterAction("ActionInitialisingEntry", [this](auto c) {
223  m_tmp_request = GetPayloadNothrow<events::Init>(c);
224  });
225 
226  engine.RegisterAction("ActionInitialisingDone", [this](auto c) {
227  if (m_tmp_request) {
228  m_tmp_request->SetReplyValue(STD_OK_REPLY);
229  m_tmp_request = nullptr;
230  }
231  });
232 
233  engine.RegisterAction("ActionInitialisingFailed", [this](auto c) {
234  if(auto eptr = GetPayloadNothrow<events::Error>(c); eptr) {
235  if (m_tmp_request) {
236  m_tmp_request->SetException(
238  m_tmp_request = nullptr;
239  }
240  }
241  });
242 
243  engine.RegisterAction("ActionInitialisingStopped", [this](auto c) {
244  auto req = GetPayloadNothrow<events::Stop>(c);
245  if (req == nullptr) {
246  // no event or request
247  return;
248  }
249  if (m_tmp_request) {
250  m_tmp_request->SetException(StdIfRequestAborted());
251  m_tmp_request = nullptr;
252  }
253  req->SetReplyValue(STD_OK_REPLY);
254  });
255 
256  engine.RegisterAction("ActionInitialisingRestarted", [this](auto c) {
257  auto req = GetPayloadNothrow<events::Init>(c);
258  if (req == nullptr) {
259  // no event or request
260  return;
261  }
262  if (m_tmp_request) {
263  m_tmp_request->SetException(StdIfRequestAborted());
264  m_tmp_request = nullptr;
265  }
266  m_tmp_request = req;
267  });
268  } else {
269  engine.RegisterAction("ActionInitialisingDone", [this](auto c) {
270  auto req = GetPayloadNothrow<events::Init>(c);
271  if (req == nullptr) {
272  return;
273  }
274  req->SetReplyValue(STD_OK_REPLY);
275  });
276  }
277 
278  // Enable ######################################################################
279 
280  if constexpr (RTCTK_IS_OPTION(UseEnabling, Enabled)) {
281  engine.RegisterAction("ActionEnablingEntry", [this](auto c) {
282  m_tmp_request = GetPayloadNothrow<events::Enable>(c);
283  });
284 
285  engine.RegisterAction("ActionEnablingDone", [this](auto c) {
286  if (m_tmp_request) {
287  m_tmp_request->SetReplyValue(STD_OK_REPLY);
288  m_tmp_request = nullptr;
289  }
290  });
291 
292  engine.RegisterAction("ActionEnablingFailed", [this](auto c) {
293  if(auto eptr = GetPayloadNothrow<events::Error>(c); eptr) {
294  if (m_tmp_request) {
295  m_tmp_request->SetException(
297  m_tmp_request = nullptr;
298  }
299  }
300  });
301  } else {
302  engine.RegisterAction("ActionEnablingDone", [this](auto c) {
303  auto req = GetPayloadNothrow<events::Enable>(c);
304  if (req == nullptr) {
305  return;
306  }
307  req->SetReplyValue(STD_OK_REPLY);
308  });
309  }
310 
311  // Disable #####################################################################
312 
313  if constexpr (RTCTK_IS_OPTION(UseDisabling, Enabled)) {
314  engine.RegisterAction("ActionDisablingEntry", [this](auto c) {
315  m_tmp_request = GetPayloadNothrow<events::Disable>(c);
316  });
317 
318  engine.RegisterAction("ActionDisablingDone", [this](auto c) {
319  if (m_tmp_request) {
320  m_tmp_request->SetReplyValue(STD_OK_REPLY);
321  m_tmp_request = nullptr;
322  }
323  });
324 
325  engine.RegisterAction("ActionDisablingFailed", [this](auto c) {
326  if(auto eptr = GetPayloadNothrow<events::Error>(c); eptr) {
327  if (m_tmp_request) {
328  m_tmp_request->SetException(
330  m_tmp_request = nullptr;
331  }
332  }
333  });
334  } else {
335  engine.RegisterAction("ActionDisablingDone", [this](auto c) {
336  auto req = GetPayloadNothrow<events::Disable>(c);
337  if (req == nullptr) {
338  return;
339  }
340  req->SetReplyValue(STD_OK_REPLY);
341  });
342  }
343 
344  // Exit #####################################################################
345 
346  engine.RegisterAction("ActionExit", [this](auto c) {
347  auto req = GetPayloadNothrow<events::Exit>(c);
348  if (req == nullptr) {
349  // no event or request
350  return;
351  }
352  req->SetReplyValue(STD_OK_REPLY);
353  m_engine.Stop();
354  });
355 
356  // GetState #####################################################################
357 
358  engine.RegisterAction("ActionGetState", [this](auto c) {
359  auto req = GetPayloadNothrow<events::GetState>(c);
360  if (req == nullptr) {
361  // no event or request
362  return;
363  }
364  req->SetReplyValue(m_engine.GetState());
365  });
366 
367  // GetStatus #####################################################################
368 
369  engine.RegisterAction("ActionGetStatus", [this](auto c) {
370  auto req = GetPayloadNothrow<events::GetStatus>(c);
371  if (req == nullptr) {
372  // no event or request
373  return;
374  }
375  req->SetReplyValue(m_engine.GetState());
376  });
377 
378  // GetVersion #####################################################################
379 
380  engine.RegisterAction("ActionGetVersion", [this](auto c) {
381  auto req = GetPayloadNothrow<events::GetVersion>(c);
382  if (req == nullptr) {
383  // no event or request
384  return;
385  }
386  req->SetReplyValue(VERSION);
387  });
388 
389  // SetLogLevel #####################################################################
390 
391  engine.RegisterAction("ActionSetLogLevel", [this](auto c) {
392  auto req = GetPayloadNothrow<events::SetLogLevel>(c);
393  if (req == nullptr) {
394  // no event or request
395  return;
396  }
397  auto loginfo = req->GetRequestPayload();
398  auto selected_logger = loginfo->getLogger();
399  auto& logger = GetLogger(selected_logger);
400  log4cplus::LogLevelManager llm;
401  auto selected_ll = llm.fromString(loginfo->getLevel());
402  if(selected_ll == log4cplus::NOT_SET_LOG_LEVEL) {
403  req->SetException(StdIfRequestFailed("Invalid LogLevel specified"));
404  }else{
405  logger.setLogLevel(selected_ll);
406  LOG4CPLUS_INFO(GetLogger(),
407  "Log Level of logger '" << loginfo->getLogger() <<
408  "' set to '" << llm.toString(logger.getLogLevel()) << "'");
409  req->SetReplyValue(STD_OK_REPLY);
410  }
411  });
412 
413  // Activities #####################################################################
414 
415  if constexpr (RTCTK_IS_OPTION(UseStarting, Enabled)) {
416  m_engine.RegisterActivity("ActivityStarting",
417  [this](StopToken stop_token) {
418  m_logic.ActivityStarting(stop_token);
420  }
421 
422  if constexpr (RTCTK_IS_OPTION(UseInitialising, Enabled)) {
423  m_engine.RegisterActivity("ActivityInitialising",
424  [this](StopToken stop_token) {
425  m_logic.ActivityInitialising(stop_token);
427  }
428 
429  if constexpr (RTCTK_IS_OPTION(UseEnabling, Enabled)) {
430  m_engine.RegisterActivity("ActivityEnabling",
431  [this](StopToken stop_token) {
432  m_logic.ActivityEnabling(stop_token);
434  }
435 
436  if constexpr (RTCTK_IS_OPTION(UseDisabling, Enabled)) {
437  m_engine.RegisterActivity("ActivityDisabling",
438  [this](StopToken stop_token) {
439  m_logic.ActivityDisabling(stop_token);
441  }
442  }
443 
444  virtual ~OutputStage() = default;
445 
446  protected:
449  std::shared_ptr<rad::cii::Request<std::string, void>> m_tmp_request;
450  std::function<void()> m_success_handler;
451  std::function<void(std::exception_ptr)> m_error_handler;
452  };
453 
455  public:
457  RegisterLayer({"StdComponent",
458  {
459  {"use_starting" , RTCTK_IS_OPTION(UseStarting, Enabled)},
460  {"use_initialising" , RTCTK_IS_OPTION(UseInitialising, Enabled)},
461  {"use_enabling" , RTCTK_IS_OPTION(UseEnabling, Enabled)},
462  {"use_disabling" , RTCTK_IS_OPTION(UseDisabling, Enabled)},
463  }});
464 
465  mm.AddState(Initial, "Initial");
466  mm.AddState(Composite, "On");
467  mm.AddState(Final, "Off");
468 
469  mm.AddState(Initial, "On:Initial", "On");
470  mm.AddState(Composite, "On:NotOperational", "On");
471  mm.AddState(Simple, "On:Operational", "On");
472 
473  mm.AddState(Initial, "On:NotOperational:Initial", "On:NotOperational");
474  mm.AddState(Simple, "On:NotOperational:NotReady", "On:NotOperational");
475  mm.AddState(Simple, "On:NotOperational:Ready", "On:NotOperational");
476 
477  mm.AddTrans("Initial" , "On");
478  mm.AddTrans("On" , "Off" , "events.Exit", "" ,"ActionExit");
479  mm.AddTrans("On" , "" , "events.GetState", "" ,"ActionGetState");
480  mm.AddTrans("On" , "" , "events.GetStatus", "" ,"ActionGetStatus");
481  mm.AddTrans("On" , "" , "events.GetVersion", "" ,"ActionGetVersion");
482  mm.AddTrans("On" , "" , "events.SetLogLevel","" ,"ActionSetLogLevel");
483  mm.AddTrans("On" , "On" , "events.Reset");
484  mm.AddTrans("On:Initial" , "On:NotOperational");
485 
486  if constexpr (RTCTK_IS_OPTION(UseStarting, Enabled)) {
487  mm.AddState(Simple, "On:NotOperational:Starting", "On:NotOperational", "ActivityStarting" ,"ActionStartingEntry");
488 
489  mm.AddTrans("On:NotOperational:Initial" , "On:NotOperational:Starting");
490  mm.AddTrans("On:NotOperational:Starting" , "On:NotOperational:NotReady" , "events.Done", "" ,"ActionStartingDone");
491  } else {
492  mm.AddTrans("On:NotOperational:Initial" , "On:NotOperational:NotReady" , "", "" ,"ActionStartingDone");
493  }
494 
495  if constexpr (RTCTK_IS_OPTION(UseInitialising, Enabled)) {
496  mm.AddState(Simple, "On:NotOperational:Initialising", "On:NotOperational", "ActivityInitialising" ,"ActionInitialisingEntry");
497 
498  mm.AddTrans("On:NotOperational:NotReady" , "On:NotOperational:Initialising" , "events.Init");
499  mm.AddTrans("On:NotOperational:Initialising" , "On:NotOperational:Ready" , "events.Done", "" ,"ActionInitialisingDone");
500  mm.AddTrans("On:NotOperational:Initialising" , "On:NotOperational:NotReady" , "events.Error", "" ,"ActionInitialisingFailed");
501  mm.AddTrans("On:NotOperational:Initialising" , "On:NotOperational:NotReady" , "events.Stop", "" ,"ActionInitialisingStopped");
502  mm.AddTrans("On:NotOperational:Initialising" , "On:NotOperational:Initialising" , "events.Init", "" ,"ActionInitialisingRestarted");
503  mm.AddTrans("On:NotOperational:Ready" , "On:NotOperational:Initialising" , "events.Init");
504  } else {
505  mm.AddTrans("On:NotOperational:NotReady" , "On:NotOperational:Ready" , "events.Init", "" ,"ActionInitialisingDone");
506  }
507 
508  if constexpr (RTCTK_IS_OPTION(UseEnabling, Enabled)) {
509  mm.AddState(Simple, "On:NotOperational:Enabling", "On:NotOperational", "ActivityEnabling" ,"ActionEnablingEntry");
510 
511  mm.AddTrans("On:NotOperational:Ready" , "On:NotOperational:Enabling" , "events.Enable");
512  mm.AddTrans("On:NotOperational:Enabling" , "On:Operational" , "events.Done", "" ,"ActionEnablingDone");
513  mm.AddTrans("On:NotOperational:Enabling" , "On:NotOperational:Ready" , "events.Error", "" ,"ActionEnablingFailed");
514  // TODO, do we want enabling to be stopable?
515  //mm.AddTrans("On:NotOperational:Enabling" , "On:NotOperational:Ready" , "events.Stop" );
516  } else {
517  mm.AddTrans("On:NotOperational:Ready" , "On:Operational" , "events.Enable", "" ,"ActionEnablingDone");
518  }
519 
520  if constexpr (RTCTK_IS_OPTION(UseDisabling, Enabled)) {
521  mm.AddState(Simple, "On:NotOperational:Disabling", "On:NotOperational", "ActivityDisabling" ,"ActionDisablingEntry");
522  mm.AddTrans("On:Operational" , "On:NotOperational:Disabling" , "events.Disable");
523  mm.AddTrans("On:NotOperational:Disabling" , "On:NotOperational:Ready" , "events.Done", "" ,"ActionDisablingDone");
524  mm.AddTrans("On:NotOperational:Disabling" , "On:NotOperational:Ready" , "events.Error", "" ,"ActionDisablingFailed");
525  } else {
526  mm.AddTrans("On:Operational" , "On:NotOperational:Ready" , "events.Disable", "" ,"ActionDisablingDone");
527  }
528  }
529  };
530 };
531 
532 } // namespace rtctk::componentFramework
533 
534 #endif // RTCTK_COMPONENTFRAMEWORK_STDCOMPONENT_HPP
serviceContainer.hpp
A container that can hold any type of service.
rtctk::componentFramework::StdComponent::RTCTK_ASSERT_OPTION_ED
RTCTK_ASSERT_OPTION_ED(UseDisabling)
rtctk::componentFramework::LogInfo::clone
std::unique_ptr< stdif::LogInfo > clone() const override
Definition: stdComponent.hpp:67
rtctk::componentFramework::StdIfRequestAborted
Definition: stdComponent.hpp:90
rtctk::componentFramework::Simple
@ Simple
Definition: model.hpp:23
commandReplier.hpp
Receive commands via MAL.
rtctk::componentFramework::StdComponent::RTCTK_ASSERT_OPTION_ED
RTCTK_ASSERT_OPTION_ED(UseEnabling)
exceptions.hpp
Provides macros and utilities for exception handling.
rtctk::componentFramework::StdIfRequestFailed::ERROR_CODE
static constexpr int32_t ERROR_CODE
Definition: stdComponent.hpp:117
stateMachineEngine.hpp
Wrapper around the SCXML State Machine Engine.
rtctk::componentFramework::StdComponent::OutputStage::~OutputStage
virtual ~OutputStage()=default
rtctk::componentFramework::LogInfo::LogInfo
LogInfo(std::string const &level, std::string const &logger="")
Definition: stdComponent.hpp:38
rtctk::componentFramework::StdComponent::OutputStage::m_tmp_request
std::shared_ptr< rad::cii::Request< std::string, void > > m_tmp_request
Definition: stdComponent.hpp:449
stdCmdsImpl.hpp
Implementation of MAL commands for layer 'StdComponent'.
rtctk::dataTask::detail::Reset
std::error_code Reset(ReaderType &reader)
helper function to reset the ipcq.reader to latest sample
Definition: readerHelpers.hpp:157
rtctk::componentFramework::StdComponent::RTCTK_ASSERT_OPTION_ED
RTCTK_ASSERT_OPTION_ED(UseInitialising)
utils.hpp
Various utilities for Life Cycle Extension.
rtctk::componentFramework::ModelManipulator::AddTrans
void AddTrans(std::string const &source_id, std::string const &target_id, std::string const &event_id="", std::string const &guard_id="", std::string const &action_id="")
Adds a new transition.
Definition: modelManipulator.cpp:227
rtctk::componentFramework::StdComponent::OutputStage::m_error_handler
std::function< void(std::exception_ptr)> m_error_handler
Definition: stdComponent.hpp:451
rtctk::componentFramework::StdComponent::InputStage::m_replier
CommandReplier & m_replier
Definition: stdComponent.hpp:172
rtctk::componentFramework::ModelBuilderBase::mm
ModelManipulator mm
Definition: modelBuilderBase.hpp:86
rtctk::componentFramework::StdIfRequestFailed::StdIfRequestFailed
StdIfRequestFailed(std::string const &message)
Definition: stdComponent.hpp:118
rtctk::componentFramework::StdComponent::InputStage::m_engine
StateMachineEngine & m_engine
Definition: stdComponent.hpp:173
rtctk::componentFramework
Definition: commandReplier.cpp:20
rtctk::componentFramework::RTCTK_DEFINE_OPTION
RTCTK_DEFINE_OPTION(UseStarting, Disabled)
rtctk::componentFramework::StdIfRequestRejected
Definition: stdComponent.hpp:99
rtctk::componentFramework::LogInfo::keyEquals
bool keyEquals(stdif::LogInfo const &other) const override
Definition: stdComponent.hpp:63
rtctk::componentFramework::StdComponent::InputStage
Definition: stdComponent.hpp:158
rtctk::componentFramework::STD_OK_REPLY
const std::string STD_OK_REPLY
Definition: stdComponent.hpp:83
rtctk::componentFramework::StopToken
rad::StopToken StopToken
Definition: stopToken.hpp:19
rtctk::componentFramework::StateMachineEngine
Definition: stateMachineEngine.hpp:31
rtctk::componentFramework::StdComponent
Basic life cycle for StdComponent.
Definition: stdComponent.hpp:138
rtctk::componentFramework::LogInfo::cloneKey
std::unique_ptr< stdif::LogInfo > cloneKey() const override
Definition: stdComponent.hpp:71
rtctk::componentFramework::optional_base
std::conditional_t< Condition, T, empty_base< T > > optional_base
Definition: utils.hpp:90
rtctk::componentFramework::NestedExceptionPrinter
Adapter object intended to be used in contexts without direct access to the output-stream object.
Definition: exceptions.hpp:157
rtctk::componentFramework::StdComponent::OutputStage::m_success_handler
std::function< void()> m_success_handler
Definition: stdComponent.hpp:450
rtctk::componentFramework::ModelBuilderBase
Base class of the ModelBuilder.
Definition: modelBuilderBase.hpp:32
rtctk::componentFramework::StdIfRequestRejected::StdIfRequestRejected
StdIfRequestRejected(std::string const &request_id, std::string const &state_id)
Definition: stdComponent.hpp:105
rtctk::componentFramework::StdIfRequestRejected::ERROR_CODE
static constexpr int32_t ERROR_CODE
Definition: stdComponent.hpp:104
rtctk::componentFramework::StateMachineEngine::RegisterAction
void RegisterAction(std::string const &id, ActionMethod action)
Register action.
Definition: stateMachineEngine.cpp:65
rtctk::componentFramework::StdComponent::InputStage::~InputStage
virtual ~InputStage()=default
stdBizLogicIf.hpp
Business Logic Interfaces with methods to be implemented in layer 'StdComponent'.
modelBuilderBase.hpp
Base class of the ModelBuilder.
rtctk::componentFramework::GetLogger
log4cplus::Logger & GetLogger(const std::string &name="")
Get handle to a specific logger (used with logging macros)
rtctk_config_tool.message
message
Definition: rtctk_config_tool.py:42
RTCTK_IS_OPTION
#define RTCTK_IS_OPTION(Name, Value)
Definition: utils.hpp:32
rtctk::componentFramework::StdComponent::InputStage::InputStage
InputStage(CommandReplier &replier, StateMachineEngine &engine)
Definition: stdComponent.hpp:160
rtctk::componentFramework::StdComponent::OutputStage::m_engine
StateMachineEngine & m_engine
Definition: stdComponent.hpp:447
rtctk::componentFramework::LogInfo::getLevel
std::string getLevel() const override
Definition: stdComponent.hpp:51
rtctk::componentFramework::NestedExceptionPrinter::Str
std::string Str() const
Convenience function for constructing a std::string from the exception.
Definition: exceptions.hpp:175
rtctk::componentFramework::StdComponent::OutputStage::OutputStage
OutputStage(StateMachineEngine &engine, BizLogicIf &bl)
Definition: stdComponent.hpp:179
rtctk::componentFramework::StateMachineEngine::RegisterRejectHandler
void RegisterRejectHandler(std::string const &id, RejectMethod reject)
Register reject handler.
Definition: stateMachineEngine.cpp:98
rtctk::componentFramework::ModelManipulator::AddState
void AddState(StateType type, std::string const &id, std::string const &parent_id="", std::string const &activity_id="", std::string const &entry_action_id="", std::string const &exit_action_id="")
Adds a new state.
Definition: modelManipulator.cpp:29
rtctk::componentFramework::ModelBuilderBase::RegisterLayer
void RegisterLayer(Layer layer)
Definition: modelBuilderBase.hpp:74
rtctk::componentFramework::StdIfRequestAborted::ERROR_CODE
static constexpr int32_t ERROR_CODE
Definition: stdComponent.hpp:92
RTCTK_APPLY_OPTION_ED
#define RTCTK_APPLY_OPTION_ED(Options, Name)
Definition: utils.hpp:25
rtctk::componentFramework::CommandReplier
Class that handles reception of commands using MAL.
Definition: commandReplier.hpp:26
rtctk::componentFramework::Initial
@ Initial
Definition: model.hpp:26
rtctk::componentFramework::StdComponent::BizLogicIf
Definition: stdComponent.hpp:155
rtctk::componentFramework::StdComponent::ModelBuilder
Definition: stdComponent.hpp:454
rtctk::componentFramework::StdComponent::RTCTK_ASSERT_OPTION_ED
RTCTK_ASSERT_OPTION_ED(UseStarting)
stdif
Definition: statePublisher.hpp:24
rtctk::componentFramework::Final
@ Final
Definition: model.hpp:27
rtctk::componentFramework::LogInfo
Definition: stdComponent.hpp:33
logger.hpp
Logging Support Library based on log4cplus.
rtctk::componentFramework::LogInfo::LogInfo
LogInfo()=default
mudpi::int32_t
int int32_t
Definition: mudpi.h:17
rtctk::componentFramework::LogInfo::getLogger
std::string getLogger() const override
Definition: stdComponent.hpp:43
rtctk::componentFramework::StateMachineEngine::GetState
std::string GetState()
Queries the current state.
Definition: stateMachineEngine.cpp:129
rtctk::componentFramework::StdComponent::ModelBuilder::ModelBuilder
ModelBuilder(StateMachineEngine &engine)
Definition: stdComponent.hpp:456
rtctk::componentFramework::StdComponent::OutputStage
Definition: stdComponent.hpp:176
rtctk::componentFramework::StdComponent::AppliedOptions
Definition: stdComponent.hpp:143
rtctk::componentFramework::Disabled
std::false_type Disabled
Definition: utils.hpp:47
rtctk::componentFramework::StdComponent::OutputStage::m_logic
BizLogicIf & m_logic
Definition: stdComponent.hpp:448
rtctk::componentFramework::StateMachineEngine::PostEvent
void PostEvent(rad::SharedEvent s)
Injects a new event into the state machine engine.
Definition: stateMachineEngine.cpp:124
rtctk::componentFramework::StdIfRequestFailed
Definition: stdComponent.hpp:112
rtctk::componentFramework::Composite
@ Composite
Definition: model.hpp:25
rtctk::componentFramework::LogInfo::hasKey
bool hasKey() const override
Definition: stdComponent.hpp:59
rtctk::componentFramework::LogInfo::setLevel
void setLevel(std::string const &level) override
Definition: stdComponent.hpp:55
rtctk::componentFramework::StdIfRequestAborted::StdIfRequestAborted
StdIfRequestAborted()
Definition: stdComponent.hpp:93
rtctk::componentFramework::LogInfo::setLogger
void setLogger(std::string const &logger) override
Definition: stdComponent.hpp:47
rtctk::componentFramework::StateMachineEngine::Stop
void Stop()
Stops execution of the state machine event loop.
Definition: stateMachineEngine.cpp:155
rtctk::componentFramework::StateMachineEngine::RegisterActivity
void RegisterActivity(std::string const &id, ActivityMethod activity, SuccessMethod on_success, FailureMethod on_failure)
Register activity.
Definition: stateMachineEngine.cpp:90
rtctk::componentFramework::StdComponent::InputStage::Start
virtual void Start()
Definition: stdComponent.hpp:167
rtctk::componentFramework::Enabled
std::true_type Enabled
Definition: utils.hpp:46
rtctk::componentFramework::StdCmdsImpl::Register
static void Register(CommandReplier &replier, StateMachineEngine &engine)
Definition: stdCmdsImpl.hpp:34