fpp/compiler/tools/fpp-to-cpp/test/state-machine/state/BasicTestEnumStateMachineAc.ref.cpp
Rob Bocchino ab44e7ffc4 Revise state machine code gen
Add comments
2024-11-20 14:43:21 -08:00

99 lines
2.8 KiB
C++

// ======================================================================
// \title BasicTestEnumStateMachineAc.cpp
// \author Generated by fpp-to-cpp
// \brief cpp file for BasicTestEnum state machine
// ======================================================================
#include "Fw/Types/Assert.hpp"
#include "state-machine/state/BasicTestEnumStateMachineAc.hpp"
namespace FppTest {
namespace SmState {
// ----------------------------------------------------------------------
// Constructors and Destructors
// ----------------------------------------------------------------------
BasicTestEnumStateMachineBase ::
BasicTestEnumStateMachineBase()
{
}
BasicTestEnumStateMachineBase ::
~BasicTestEnumStateMachineBase()
{
}
// ----------------------------------------------------------------------
// Initialization
// ----------------------------------------------------------------------
void BasicTestEnumStateMachineBase ::
initBase(const FwEnumStoreType id)
{
this->m_id = id;
// Enter the initial target of the state machine
this->enter_S(Signal::__FPRIME_AC_INITIAL_TRANSITION);
}
// ----------------------------------------------------------------------
// Getter functions
// ----------------------------------------------------------------------
BasicTestEnumStateMachineBase::State BasicTestEnumStateMachineBase ::
getState() const
{
return this->m_state;
}
// ----------------------------------------------------------------------
// Send signal functions
// ----------------------------------------------------------------------
void BasicTestEnumStateMachineBase ::
sendSignal_s(const FppTest::SmHarness::TestEnum& value)
{
switch (this->m_state) {
case State::S:
// Do the actions for the transition
this->action_a(Signal::s);
this->action_a(Signal::s);
this->action_b(Signal::s, value);
// Enter the target
this->enter_T(Signal::s);
break;
case State::T:
break;
default:
FW_ASSERT(0, static_cast<FwAssertArgType>(this->m_state));
break;
}
}
// ----------------------------------------------------------------------
// State and choice entry
// ----------------------------------------------------------------------
void BasicTestEnumStateMachineBase ::
enter_T(Signal signal)
{
// Do the entry actions
this->action_a(signal);
this->action_a(signal);
this->action_a(signal);
this->m_state = State::T;
}
void BasicTestEnumStateMachineBase ::
enter_S(Signal signal)
{
this->m_state = State::S;
}
}
}