Program Listing for File cell3D_fsm.hpp
↰ Return to documentation for file (cosm/fsm/cell3D_fsm.hpp
)
#pragma once
/*******************************************************************************
* Includes
******************************************************************************/
#include <string>
#include "rcppsw/patterns/fsm/simple_fsm.hpp"
#include "cosm/cosm.hpp"
#include "cosm/fsm/cell3D_state.hpp"
/*******************************************************************************
* Namespaces
******************************************************************************/
namespace cosm::fsm {
/*******************************************************************************
* Class Definitions
******************************************************************************/
class cell3D_fsm final : public rpfsm::simple_fsm,
public rer::client<cell3D_fsm> {
public:
using state = cell3D_state;
cell3D_fsm(void);
~cell3D_fsm(void) override = default;
cell3D_fsm& operator=(const cell3D_fsm&) = delete;
cell3D_fsm(const cell3D_fsm& other);
bool state_is_known(void) const {
return current_state() != state::ekST_UNKNOWN;
}
bool state_has_block(void) const {
return current_state() == state::ekST_HAS_BLOCK;
}
bool state_in_block_extent(void) const {
return current_state() == state::ekST_BLOCK_EXTENT;
}
bool state_is_empty(void) const { return current_state() == state::ekST_EMPTY; }
/* events */
void event_unknown(void);
void event_empty(void);
void event_block_place(void);
void event_block_extent(void);
private:
RCPPSW_FSM_STATE_DECLARE_ND(cell3D_fsm, state_unknown, RCPPSW_CONST);
RCPPSW_FSM_STATE_DECLARE_ND(cell3D_fsm, state_empty, RCPPSW_CONST);
RCPPSW_FSM_STATE_DECLARE_ND(cell3D_fsm, state_block, RCPPSW_CONST);
RCPPSW_FSM_STATE_DECLARE_ND(cell3D_fsm, state_block_extent, RCPPSW_CONST);
RCPPSW_FSM_DEFINE_STATE_MAP_ACCESSOR(state_map, index) override {
return &mc_state_map[index];
}
RCPPSW_FSM_DECLARE_STATE_MAP(state_map, mc_state_map, state::ekST_MAX_STATES);
};
} /* namespace cosm::fsm */