Go to the documentation of this file.
12 #ifndef RTCTK_COMPONENTFRAMEWORK_SUSPENDABLE_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_SUSPENDABLE_HPP
26 template <
typename Super>
28 static_assert(is_base_of_template_v<Loopaware, Super>,
"'Suspendable' requires 'Loopaware'");
39 using Super::InputStage::InputStage;
42 Super::InputStage::Start();
58 this->m_no_disable_in_states.push_back(
"On:Operational:Suspending");
59 this->m_no_disable_in_states.push_back(
"On:Operational:Resuming");
60 this->m_no_disable_in_states.push_back(
"On:Operational:Suspended");
64 this->m_no_update_in_states.push_back(
"On:Operational:Suspending");
65 this->m_no_update_in_states.push_back(
"On:Operational:Resuming");
70 this->m_tmp_request = GetPayloadNothrow<events::Suspend>(c);
74 if (this->m_tmp_request) {
76 this->m_tmp_request =
nullptr;
81 this->m_tmp_request = GetPayloadNothrow<events::Resume>(c);
85 if (this->m_tmp_request) {
87 this->m_tmp_request =
nullptr;
95 static_cast<BizLogicIf&
>(this->m_logic).ActivitySuspending(stop_token);
96 }, this->m_success_handler, this->m_error_handler);
100 static_cast<BizLogicIf&
>(this->m_logic).ActivityResuming(stop_token);
101 }, this->m_success_handler, this->m_error_handler);
105 static_cast<BizLogicIf&
>(this->m_logic).ActivitySuspended(stop_token);
106 }, {}, this->m_error_handler);
113 this->RegisterLayer({
"Suspendable", {}});
115 std::string parent_region = this->mm.GetParentId(
"On:Operational:Closed");
117 this->mm.AddState(
Simple,
"On:Operational:Suspended" ,parent_region ,
"ActivitySuspended");
118 this->mm.AddState(
Simple,
"On:Operational:Suspending" ,parent_region ,
"ActivitySuspending" ,
"ActionSuspendingEntry");
119 this->mm.AddState(
Simple,
"On:Operational:Resuming" ,parent_region ,
"ActivityResuming" ,
"ActionResumingEntry" );
121 this->mm.AddTrans(
"On:Operational:Closed" ,
"On:Operational:Suspending" ,
"events.Suspend");
122 this->mm.AddTrans(
"On:Operational:Suspending" ,
"On:Operational:Suspended" ,
"events.Done",
"" ,
"ActionSuspendingDone");
123 this->mm.AddTrans(
"On:Operational:Suspended" ,
"On:Operational:Resuming" ,
"events.Resume");
124 this->mm.AddTrans(
"On:Operational:Resuming" ,
"On:Operational:Closed" ,
"events.Done",
"" ,
"ActionResumingDone");
125 this->mm.AddTrans(
"On:Operational:Suspended" ,
"On:Operational:Opening" ,
"events.Open");
132 #endif // RTCTK_COMPONENTFRAMEWORK_SUSPENDABLE_HPP
@ Simple
Definition: model.hpp:23
Definition: rtcComponent.hpp:34
Life cycle extension to make Loopaware RtcComponent Suspendable.
Definition: suspendable.hpp:27
virtual void ActivitySuspended(StopToken st)
Definition: suspendable.hpp:34
Lifecycle Extension that makes an RTC Component 'Loopaware'.
ModelBuilder(StateMachineEngine &engine)
Definition: suspendable.hpp:112
Definition: commandReplier.cpp:20
Runnable< RtcComponent > Super
Definition: rtcSupervisor.hpp:33
Definition: suspendable.hpp:110
const std::string STD_OK_REPLY
Definition: stdComponent.hpp:83
virtual void ActivitySuspending(StopToken st)
Definition: suspendable.hpp:32
rad::StopToken StopToken
Definition: stopToken.hpp:19
Definition: stateMachineEngine.hpp:31
void RegisterAction(std::string const &id, ActionMethod action)
Register action.
Definition: stateMachineEngine.cpp:65
Definition: suspendable.hpp:30
OutputStage(StateMachineEngine &engine, BizLogicIf &bl)
Definition: suspendable.hpp:50
static void Register(CommandReplier &replier, StateMachineEngine &engine)
Definition: suspCmdsImpl.hpp:34
Definition: suspendable.hpp:48
void RegisterRejectHandler(std::string const &id, RejectMethod reject)
Register reject handler.
Definition: stateMachineEngine.cpp:98
virtual void ActivityResuming(StopToken st)
Definition: suspendable.hpp:33
Implementation of MAL commands for layer 'Suspendable'.
void RegisterActivity(std::string const &id, ActivityMethod activity, SuccessMethod on_success, FailureMethod on_failure)
Register activity.
Definition: stateMachineEngine.cpp:90