Line-Following-Robot/lfr_states.cpp

52 lines
1008 B
C++

#include "lfr_states.h"
void State::Idle::enter(LFR_StateMachine* stateMachine)
{
}
void State::Idle::exit(LFR_StateMachine* stateMachine)
{
}
LFR_IState& State::Idle::getInstance()
{
static State::Idle singleton;
return singleton;
}
void State::Autonomous::enter(LFR_StateMachine* stateMachine)
{
std::cout << "enter autonomous mode" << std::endl;
stateMachine->enterAutonomous();
}
void State::Autonomous::exit(LFR_StateMachine* stateMachine)
{
std::cout << "exit autonomous mode" << std::endl;
stateMachine->exitAutonomous();
}
LFR_IState& State::Autonomous::getInstance()
{
static State::Autonomous singleton;
return singleton;
}
void State::Manual::enter(LFR_StateMachine* stateMachine)
{
std::cout << "enter manual mode" << std::endl;
}
void State::Manual::exit(LFR_StateMachine* stateMachine)
{
std::cout << "exit manual mode" << std::endl;
}
LFR_IState& State::Manual::getInstance()
{
static State::Manual singleton;
return singleton;
}