mirror of
https://github.com/nasa/fpp.git
synced 2025-12-11 11:16:42 -06:00
210 lines
5.8 KiB
C++
Vendored
210 lines
5.8 KiB
C++
Vendored
// ======================================================================
|
|
// \title StateToChoiceStateMachineAc.cpp
|
|
// \author Generated by fpp-to-cpp
|
|
// \brief cpp file for StateToChoice state machine
|
|
// ======================================================================
|
|
|
|
#include "Fw/Types/Assert.hpp"
|
|
#include "state-machine/state/StateToChoiceStateMachineAc.hpp"
|
|
|
|
namespace FppTest {
|
|
|
|
namespace SmState {
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Constructors and Destructors
|
|
// ----------------------------------------------------------------------
|
|
|
|
StateToChoiceStateMachineBase ::
|
|
StateToChoiceStateMachineBase()
|
|
{
|
|
|
|
}
|
|
|
|
StateToChoiceStateMachineBase ::
|
|
~StateToChoiceStateMachineBase()
|
|
{
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Initialization
|
|
// ----------------------------------------------------------------------
|
|
|
|
void StateToChoiceStateMachineBase ::
|
|
initBase(const FwEnumStoreType id)
|
|
{
|
|
this->m_id = id;
|
|
// Enter the initial target of the state machine
|
|
this->enter_S1(Signal::__FPRIME_AC_INITIAL_TRANSITION);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Getter functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
StateToChoiceStateMachineBase::State StateToChoiceStateMachineBase ::
|
|
getState() const
|
|
{
|
|
return this->m_state;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Send signal functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
void StateToChoiceStateMachineBase ::
|
|
sendSignal_S1_to_S4()
|
|
{
|
|
switch (this->m_state) {
|
|
case State::S1_S2:
|
|
// Do the actions for the transition
|
|
this->action_exitS2(Signal::S1_to_S4);
|
|
this->action_exitS1(Signal::S1_to_S4);
|
|
this->action_a(Signal::S1_to_S4);
|
|
// Enter the target
|
|
this->enter_S4(Signal::S1_to_S4);
|
|
break;
|
|
case State::S1_S3:
|
|
// Do the actions for the transition
|
|
this->action_exitS3(Signal::S1_to_S4);
|
|
this->action_exitS1(Signal::S1_to_S4);
|
|
this->action_a(Signal::S1_to_S4);
|
|
// Enter the target
|
|
this->enter_S4(Signal::S1_to_S4);
|
|
break;
|
|
case State::S4_S5:
|
|
break;
|
|
case State::S4_S6:
|
|
break;
|
|
default:
|
|
FW_ASSERT(0, static_cast<FwAssertArgType>(this->m_state));
|
|
break;
|
|
}
|
|
}
|
|
|
|
void StateToChoiceStateMachineBase ::
|
|
sendSignal_S1_to_C()
|
|
{
|
|
switch (this->m_state) {
|
|
case State::S1_S2:
|
|
// Do the actions for the transition
|
|
this->action_exitS2(Signal::S1_to_C);
|
|
this->action_exitS1(Signal::S1_to_C);
|
|
this->action_a(Signal::S1_to_C);
|
|
this->action_enterS4(Signal::S1_to_C);
|
|
// Enter the target
|
|
this->enter_S4_C(Signal::S1_to_C);
|
|
break;
|
|
case State::S1_S3:
|
|
// Do the actions for the transition
|
|
this->action_exitS3(Signal::S1_to_C);
|
|
this->action_exitS1(Signal::S1_to_C);
|
|
this->action_a(Signal::S1_to_C);
|
|
this->action_enterS4(Signal::S1_to_C);
|
|
// Enter the target
|
|
this->enter_S4_C(Signal::S1_to_C);
|
|
break;
|
|
case State::S4_S5:
|
|
break;
|
|
case State::S4_S6:
|
|
break;
|
|
default:
|
|
FW_ASSERT(0, static_cast<FwAssertArgType>(this->m_state));
|
|
break;
|
|
}
|
|
}
|
|
|
|
void StateToChoiceStateMachineBase ::
|
|
sendSignal_S2_to_S3()
|
|
{
|
|
switch (this->m_state) {
|
|
case State::S1_S2:
|
|
// Do the actions for the transition
|
|
this->action_exitS2(Signal::S2_to_S3);
|
|
// Enter the target
|
|
this->enter_S1_S3(Signal::S2_to_S3);
|
|
break;
|
|
case State::S1_S3:
|
|
break;
|
|
case State::S4_S5:
|
|
break;
|
|
case State::S4_S6:
|
|
break;
|
|
default:
|
|
FW_ASSERT(0, static_cast<FwAssertArgType>(this->m_state));
|
|
break;
|
|
}
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
// State and choice entry
|
|
// ----------------------------------------------------------------------
|
|
|
|
void StateToChoiceStateMachineBase ::
|
|
enter_S4(Signal signal)
|
|
{
|
|
// Do the entry actions
|
|
this->action_enterS4(signal);
|
|
// Enter the target of the initial transition
|
|
this->enter_S4_C(signal);
|
|
}
|
|
|
|
void StateToChoiceStateMachineBase ::
|
|
enter_S4_C(Signal signal)
|
|
{
|
|
if (this->guard_g(signal)) {
|
|
// Enter the target
|
|
this->enter_S4_S5(signal);
|
|
}
|
|
else {
|
|
// Enter the target
|
|
this->enter_S4_S6(signal);
|
|
}
|
|
}
|
|
|
|
void StateToChoiceStateMachineBase ::
|
|
enter_S4_S5(Signal signal)
|
|
{
|
|
// Update the state
|
|
this->m_state = State::S4_S5;
|
|
}
|
|
|
|
void StateToChoiceStateMachineBase ::
|
|
enter_S4_S6(Signal signal)
|
|
{
|
|
// Update the state
|
|
this->m_state = State::S4_S6;
|
|
}
|
|
|
|
void StateToChoiceStateMachineBase ::
|
|
enter_S1(Signal signal)
|
|
{
|
|
// Do the entry actions
|
|
this->action_enterS1(signal);
|
|
// Enter the target of the initial transition
|
|
this->enter_S1_S2(signal);
|
|
}
|
|
|
|
void StateToChoiceStateMachineBase ::
|
|
enter_S1_S2(Signal signal)
|
|
{
|
|
// Do the entry actions
|
|
this->action_enterS2(signal);
|
|
// Update the state
|
|
this->m_state = State::S1_S2;
|
|
}
|
|
|
|
void StateToChoiceStateMachineBase ::
|
|
enter_S1_S3(Signal signal)
|
|
{
|
|
// Do the entry actions
|
|
this->action_enterS3(signal);
|
|
// Update the state
|
|
this->m_state = State::S1_S3;
|
|
}
|
|
|
|
}
|
|
|
|
}
|