// ====================================================================== // \title StateToChildStateMachineAc.cpp // \author Generated by fpp-to-cpp // \brief cpp file for StateToChild state machine // ====================================================================== #include "Fw/Types/Assert.hpp" #include "state-machine/state/StateToChildStateMachineAc.hpp" namespace FppTest { namespace SmState { // ---------------------------------------------------------------------- // Constructors and Destructors // ---------------------------------------------------------------------- StateToChildStateMachineBase :: StateToChildStateMachineBase() { } StateToChildStateMachineBase :: ~StateToChildStateMachineBase() { } // ---------------------------------------------------------------------- // Initialization // ---------------------------------------------------------------------- void StateToChildStateMachineBase :: 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 // ---------------------------------------------------------------------- StateToChildStateMachineBase::State StateToChildStateMachineBase :: getState() const { return this->m_state; } // ---------------------------------------------------------------------- // Send signal functions // ---------------------------------------------------------------------- void StateToChildStateMachineBase :: sendSignal_S1_to_S2() { switch (this->m_state) { case State::S1_S2: // Do the actions for the transition this->action_exitS2(Signal::S1_to_S2); this->action_a(Signal::S1_to_S2); // Enter the target this->enter_S1_S2(Signal::S1_to_S2); break; case State::S1_S3: // Do the actions for the transition this->action_exitS3(Signal::S1_to_S2); this->action_a(Signal::S1_to_S2); // Enter the target this->enter_S1_S2(Signal::S1_to_S2); break; default: FW_ASSERT(0, static_cast(this->m_state)); break; } } void StateToChildStateMachineBase :: 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; default: FW_ASSERT(0, static_cast(this->m_state)); break; } } // ---------------------------------------------------------------------- // State and choice entry // ---------------------------------------------------------------------- void StateToChildStateMachineBase :: enter_S1(Signal signal) { // Enter the target of the initial transition this->enter_S1_S2(signal); } void StateToChildStateMachineBase :: enter_S1_S2(Signal signal) { // Do the entry actions this->action_enterS2(signal); // Update the state this->m_state = State::S1_S2; } void StateToChildStateMachineBase :: enter_S1_S3(Signal signal) { // Do the entry actions this->action_enterS3(signal); // Update the state this->m_state = State::S1_S3; } } }