Robot Devastation
StateMachine.hpp
1 // Authors: see AUTHORS.md at project root.
2 // CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
3 // URL: https://github.com/asrob-uc3m/robotDevastation
4 
5 #ifndef __RD_FINITE_STATE_MACHINE_HPP__
6 #define __RD_FINITE_STATE_MACHINE_HPP__
7 
8 #include <vector>
9 
10 #include "StateDirector.hpp"
11 
12 namespace rd{
13 
20 {
21  public:
27  FiniteStateMachine(const std::vector<StateDirector *> & stateDirectors, int initial_state_id);
28  virtual ~FiniteStateMachine();
29 
31  bool start();
32  bool stop();
33 
35  int getCurrentState() const;
36 
37  private:
39 
40  std::vector<StateDirector *> stateDirectors;
41  int initial_state_id;
42 };
43 
44 }
45 
46 #endif //-- __RD_FINITE_STATE_MACHINE_HPP__
rd
The main, catch-all namespace for Robot Devastation.
Definition: groups.dox:4
rd::FiniteStateMachine
Class implementing a finite state machine.
Definition: StateMachine.hpp:19
rd::FiniteStateMachine::start
bool start()
Starts the state machine (running the initial state)
Definition: StateMachine.cpp:26
rd::FiniteStateMachine::getCurrentState
int getCurrentState() const
Returns current active state id.
Definition: StateMachine.cpp:44