Go to the documentation of this file.
12 #ifndef RTCTK_COMPONENTFRAMEWORK_RTCCOMPONENT_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_RTCCOMPONENT_HPP
29 : rtctkif::ExceptionErr(
"Request aborted.",
ERROR_CODE) {
38 : rtctkif::ExceptionErr(
"Request " + request_id +
" rejected in state " + state_id,
58 UseInitialising<Enabled>,
60 UseDisabling<Enabled>>;
123 if(
auto eptr = GetPayloadNothrow<events::UpdateError>(c); eptr) {
134 engine.
RegisterGuard(
"GuardUpdatingAllowed", [
this](
auto c) {
135 auto req = GetPayloadNothrow<events::Update>(c);
136 if (req ==
nullptr) {
140 std::string args = req->GetRequestPayload();
145 if (act_state.find(s) != std::string::npos) {
152 engine.
RegisterGuard(
"GuardDisablingAllowed", [
this](
auto c) {
155 if (act_state.find(s) != std::string::npos) {
185 const std::string parent_region =
"On:Operational:RegionUpdate";
192 this->
mm.
AddState(
Simple,
"On:Operational:UpdateBusy", parent_region ,
"ActivityUpdating" ,
"ActionUpdatingEntry");
194 this->
mm.
AddTrans(
"On:Operational:UpdateInitial" ,
"On:Operational:UpdateIdle" );
195 this->
mm.
AddTrans(
"On:Operational:UpdateIdle" ,
"On:Operational:UpdateBusy" ,
"events.Update",
"GuardUpdatingAllowed");
196 this->
mm.
AddTrans(
"On:Operational:UpdateBusy" ,
"On:Operational:UpdateIdle" ,
"events.UpdateDone",
"" ,
"ActionUpdatingDone" );
197 this->
mm.
AddTrans(
"On:Operational:UpdateBusy" ,
"On:Operational:UpdateIdle" ,
"events.UpdateError",
"" ,
"ActionUpdatingFailed" );
199 this->
mm.
ModTransGuard(
"On:Operational",
"On:NotOperational:Disabling",
"events.Disable",
"",
"GuardDisablingAllowed");
206 #endif // RTCTK_COMPONENTFRAMEWORK_RTCCOMPONENT_HPP
Definition: rtcComponent.hpp:70
@ Simple
Definition: model.hpp:23
Definition: rtcComponent.hpp:34
Definition: rtcComponent.hpp:90
void ModTransGuard(std::string const &source_id, std::string const &target_id, std::string const &event_id, std::string const &guard_id, std::string const &new_guard_id)
Modifies the guard of a transition.
Definition: modelManipulator.cpp:295
@ Parallel
Definition: model.hpp:24
Basic life cycle for RtcComponent.
Definition: rtcComponent.hpp:67
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
ModelBuilder(StateMachineEngine &engine)
Definition: rtcComponent.hpp:182
ModelManipulator mm
Definition: modelBuilderBase.hpp:86
std::function< void(std::exception_ptr)> m_update_error_handler
Definition: rtcComponent.hpp:175
static constexpr int32_t ERROR_CODE
Definition: rtcComponent.hpp:27
void ModStateType(std::string const &state_id, StateType new_state_type)
Modifies type of state.
Definition: modelManipulator.cpp:122
Definition: commandReplier.cpp:20
Implementation of MAL commands for layer 'RtcComponent'.
static constexpr int32_t ERROR_CODE
Definition: rtcComponent.hpp:49
void RegisterGuard(std::string const &id, GuardMethod guard)
Register guard.
Definition: stateMachineEngine.cpp:77
const std::string STD_OK_REPLY
Definition: stdComponent.hpp:83
rad::StopToken StopToken
Definition: stopToken.hpp:19
Definition: stateMachineEngine.hpp:31
Basic life cycle for StdComponent.
Definition: stdComponent.hpp:138
Adapter object intended to be used in contexts without direct access to the output-stream object.
Definition: exceptions.hpp:157
RequestRejected(std::string const &request_id, std::string const &state_id)
Definition: rtcComponent.hpp:37
void RegisterAction(std::string const &id, ActionMethod action)
Register action.
Definition: stateMachineEngine.cpp:65
std::shared_ptr< rad::cii::Request< std::string, std::string > > m_tmp_update_request
Definition: rtcComponent.hpp:173
std::list< std::string > m_no_disable_in_states
Definition: rtcComponent.hpp:177
std::string Payload
Definition: payload.hpp:19
std::function< void()> m_update_success_handler
Definition: rtcComponent.hpp:174
StateMachineEngine & m_engine
Definition: stdComponent.hpp:447
std::string Str() const
Convenience function for constructing a std::string from the exception.
Definition: exceptions.hpp:175
RequestFailed(std::string const &message)
Definition: rtcComponent.hpp:50
virtual void ActivityUpdating(StopToken st, Payload args)
Definition: rtcComponent.hpp:72
void RegisterRejectHandler(std::string const &id, RejectMethod reject)
Register reject handler.
Definition: stateMachineEngine.cpp:98
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
void RegisterLayer(Layer layer)
Definition: modelBuilderBase.hpp:74
Lifecycle of the 'Standard Component'.
@ Initial
Definition: model.hpp:26
Definition: stdComponent.hpp:155
virtual bool GuardUpdatingAllowed(Payload args)
Definition: rtcComponent.hpp:74
Definition: stdComponent.hpp:454
StdComponent< UseStarting< Enabled >, UseInitialising< Enabled >, UseEnabling< Enabled >, UseDisabling< Enabled > > RtcComponentSuper
Definition: rtcComponent.hpp:60
Definition: rtcComponent.hpp:44
Definition: rtcComponent.hpp:180
RequestAborted()
Definition: rtcComponent.hpp:28
OutputStage(StateMachineEngine &engine, BizLogicIf &bl)
Definition: rtcComponent.hpp:92
int int32_t
Definition: mudpi.h:17
std::string GetState()
Queries the current state.
Definition: stateMachineEngine.cpp:129
Definition: rtcComponent.hpp:25
std::list< std::string > m_no_update_in_states
Definition: rtcComponent.hpp:176
Definition: stdComponent.hpp:176
BizLogicIf & m_logic
Definition: stdComponent.hpp:448
Defines an agnostic payload type based on std::string.
static void Register(CommandReplier &replier, StateMachineEngine &engine)
Definition: rtcCmdsImpl.hpp:66
void PostEvent(rad::SharedEvent s)
Injects a new event into the state machine engine.
Definition: stateMachineEngine.cpp:124
@ Composite
Definition: model.hpp:25
static constexpr int32_t ERROR_CODE
Definition: rtcComponent.hpp:36
void RegisterActivity(std::string const &id, ActivityMethod activity, SuccessMethod on_success, FailureMethod on_failure)
Register activity.
Definition: stateMachineEngine.cpp:90