mirror of
https://github.com/nasa/fpp.git
synced 2025-12-11 03:05:32 -06:00
185 lines
4.9 KiB
C++
Vendored
185 lines
4.9 KiB
C++
Vendored
// ======================================================================
|
|
// \title SequenceStateMachineAc.hpp
|
|
// \author Generated by fpp-to-cpp
|
|
// \brief hpp file for Sequence state machine
|
|
// ======================================================================
|
|
|
|
#ifndef FppTest_SmChoice_SequenceStateMachineAc_HPP
|
|
#define FppTest_SmChoice_SequenceStateMachineAc_HPP
|
|
|
|
#include "Fw/FPrimeBasicTypes.hpp"
|
|
#include "Fw/Types/ExternalString.hpp"
|
|
#include "Fw/Types/Serializable.hpp"
|
|
#include "Fw/Types/String.hpp"
|
|
|
|
namespace FppTest {
|
|
|
|
namespace SmChoice {
|
|
|
|
//! A basic state machine with a choice sequence
|
|
class SequenceStateMachineBase {
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Friend classes
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Tester class for the state machine
|
|
friend class SequenceTester;
|
|
|
|
public:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Types
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! The state type
|
|
enum class State : FwEnumStoreType {
|
|
//! The uninitialized state
|
|
__FPRIME_AC_UNINITIALIZED,
|
|
//! State S1
|
|
S1,
|
|
//! State S2
|
|
S2,
|
|
//! State S3
|
|
S3,
|
|
//! State S4
|
|
S4,
|
|
};
|
|
|
|
//! The signal type
|
|
enum class Signal : FwEnumStoreType {
|
|
//! The initial transition
|
|
__FPRIME_AC_INITIAL_TRANSITION,
|
|
//! Signal s
|
|
s,
|
|
};
|
|
|
|
protected:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Constructors and Destructors
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Constructor
|
|
SequenceStateMachineBase();
|
|
|
|
//! Destructor
|
|
virtual ~SequenceStateMachineBase();
|
|
|
|
protected:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Initialization
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Initialize the state machine
|
|
void initBase(
|
|
const FwEnumStoreType id //!< The state machine ID
|
|
);
|
|
|
|
public:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Getter functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Get the state
|
|
SequenceStateMachineBase::State getState() const;
|
|
|
|
public:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Send signal functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Signal s
|
|
void sendSignal_s();
|
|
|
|
protected:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Actions
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Action a
|
|
virtual void action_a(
|
|
Signal signal //!< The signal
|
|
) = 0;
|
|
|
|
//! Action b
|
|
virtual void action_b(
|
|
Signal signal //!< The signal
|
|
) = 0;
|
|
|
|
protected:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Guards
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Guard g1
|
|
virtual bool guard_g1(
|
|
Signal signal //!< The signal
|
|
) const = 0;
|
|
|
|
//! Guard g2
|
|
virtual bool guard_g2(
|
|
Signal signal //!< The signal
|
|
) const = 0;
|
|
|
|
private:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// State and choice entry
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Enter state S4
|
|
void enter_S4(
|
|
Signal signal //!< The signal
|
|
);
|
|
|
|
//! Enter state S3
|
|
void enter_S3(
|
|
Signal signal //!< The signal
|
|
);
|
|
|
|
//! Enter state S2
|
|
void enter_S2(
|
|
Signal signal //!< The signal
|
|
);
|
|
|
|
//! Enter choice C2
|
|
void enter_C2(
|
|
Signal signal //!< The signal
|
|
);
|
|
|
|
//! Enter choice C1
|
|
void enter_C1(
|
|
Signal signal //!< The signal
|
|
);
|
|
|
|
//! Enter state S1
|
|
void enter_S1(
|
|
Signal signal //!< The signal
|
|
);
|
|
|
|
protected:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Member variables
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! The state machine ID
|
|
FwEnumStoreType m_id = 0;
|
|
|
|
//! The state
|
|
State m_state = State::__FPRIME_AC_UNINITIALIZED;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|