Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::FSM< T > Class Template Reference

#include <FSM.h>

Inheritance diagram for Boardcore::FSM< T >:
Collaboration diagram for Boardcore::FSM< T >:

Public Member Functions

 FSM (void(T::*initialState)(const Event &), unsigned int stacksize=miosix::STACK_DEFAULT_FOR_PTHREAD, miosix::Priority priority=miosix::MAIN_PRIORITY)
 
virtual ~FSM ()
 
void transition (void(T::*nextState)(const Event &))
 
bool testState (void(T::*testState)(const Event &))
 Test if the FSM is in the given state.
 
- Public Member Functions inherited from Boardcore::EventHandler
 EventHandler (unsigned int stacksize=miosix::STACK_DEFAULT_FOR_PTHREAD, miosix::Priority priority=miosix::MAIN_PRIORITY)
 
virtual ~EventHandler ()
 
void postEvent (const Event &ev) override
 
void stop () override
 Signals the runner thread to terminate and joins the thread.
 
- Public Member Functions inherited from Boardcore::EventHandlerBase
 EventHandlerBase ()
 
virtual ~EventHandlerBase ()
 
- Public Member Functions inherited from Boardcore::ActiveObject
 ActiveObject (unsigned int stacksize=miosix::STACK_DEFAULT_FOR_PTHREAD, miosix::Priority priority=miosix::MAIN_PRIORITY)
 
virtual ~ActiveObject ()
 
virtual bool start ()
 Start the thread associated with this active object.
 
bool isRunning ()
 

Protected Member Functions

void handleEvent (const Event &e) override
 
- Protected Member Functions inherited from Boardcore::EventHandler
void run () override
 
- Protected Member Functions inherited from Boardcore::ActiveObject
bool shouldStop ()
 Tells whether or not the ActiveObject should stop its execution.
 

Additional Inherited Members

- Protected Attributes inherited from Boardcore::EventHandler
SynchronizedQueue< EventeventList
 
- Protected Attributes inherited from Boardcore::ActiveObject
miosix::Thread * thread = nullptr
 Gives access to the thread object.
 
std::atomic< bool > stopFlag {false}
 
std::atomic< bool > running {false}
 

Detailed Description

template<class T>
class Boardcore::FSM< T >

Definition at line 35 of file FSM.h.

Constructor & Destructor Documentation

◆ FSM()

template<class T >
Boardcore::FSM< T >::FSM ( void(T::*)(const Event &) initialState,
unsigned int stacksize = miosix::STACK_DEFAULT_FOR_PTHREAD,
miosix::Priority priority = miosix::MAIN_PRIORITY )

Definition at line 62 of file FSM.h.

◆ ~FSM()

template<class T >
Boardcore::FSM< T >::~FSM ( )
virtual

Definition at line 72 of file FSM.h.

Member Function Documentation

◆ handleEvent()

template<class T >
void Boardcore::FSM< T >::handleEvent ( const Event & e)
overrideprotectedvirtual

Implements Boardcore::EventHandler.

Definition at line 91 of file FSM.h.

◆ testState()

template<class T >
bool Boardcore::FSM< T >::testState ( void(T::*)(const Event &) testState)

Test if the FSM is in the given state.

Parameters
testStateState to test.

Definition at line 85 of file FSM.h.

◆ transition()

template<class T >
void Boardcore::FSM< T >::transition ( void(T::*)(const Event &) nextState)

Definition at line 75 of file FSM.h.


The documentation for this class was generated from the following file: