#include <_smach.h>
Public Types | |
typedef K | event_key |
typedef M | _mutex |
typedef CON | context_type |
enum | event_result { RESULT_ERROR, RESULT_OK, RESULT_ACCEPT, RESULT_REJECT, RESULT_END } |
Result type for event processing. More... | |
Public Member Functions | |
const char * | get_state_name () const |
Gets the name of the currently active state. | |
bool | set_default_state (const state_base *nextstate) |
bool | egress () |
Leaves the current state. | |
bool | enter (const state_base *nextstate) |
State entry function. | |
bool | push_state (const state_base *nextstate) |
Pushes state onto state stack. | |
void | pop_state () |
Pops state off of state stack. | |
smach (context_type *machine_context=0) | |
State Machine Constructor. | |
~smach () | |
The destructor. | |
void | set_child (smach *x) |
Sets up a child state machine. | |
int | state_depth () |
Returns the number states currently active. | |
event_result | process_event (const event_key &id) |
event_result | process_event (const event &id) |
Process an event. | |
Static Public Member Functions | |
static bool | event_error (const event_result &rhs) |
Determines if a given event result is an error. | |
Public Attributes | |
void * | state_context |
State Context. | |
Private Attributes | |
const state_base * | curr_state |
Current state of the machine. | |
smach * | child |
Child machine. | |
context_type * | machine_context |
Machine Context. | |
const state_base * | default_state |
void * | default_context |
_mutex | mutex |
const state_base * | state_stack [SMACH_STATE_STACK_SIZE] |
State stack data. | |
void * | state_context_stack [SMACH_STATE_STACK_SIZE] |
int | states_on_stack |
Classes | |
struct | egress_exception |
struct | event |
Event base class. More... | |
class | event_def |
Event definition class. More... | |
struct | pop_exception |
class | state |
State class. More... | |
class | state_base |
========================================================================
A more detailed description needs to be written.
Definition at line 60 of file _smach.h.
|
|
|
|
|
|
|
Result type for event processing.
|
|
State Machine Constructor. A more detailed description needs to be written |
|
The destructor.
Definition at line 527 of file _smach.h. References smach< CON, K, M >::default_context, smach< CON, K, M >::default_state, smach< CON, K, M >::egress(), and smach< CON, K, M >::state_base::leave_state(). |
|
Gets the name of the currently active state.
Definition at line 311 of file _smach.h. References smach< CON, K, M >::curr_state, smach< CON, K, M >::default_state, ETL_MUTEX_LOCK, and smach< CON, K, M >::state_base::get_name(). |
|
Determines if a given event result is an error. This function allows us to quickly see if an event_result contained an error Definition at line 327 of file _smach.h. References smach< CON, K, M >::RESULT_ERROR. |
|
Definition at line 331 of file _smach.h. References smach< CON, K, M >::default_context, smach< CON, K, M >::default_state, smach< CON, K, M >::state_base::enter_state(), ETL_MUTEX_LOCK, smach< CON, K, M >::state_base::leave_state(), and smach< CON, K, M >::machine_context. |
|
Leaves the current state. Effectively makes the state_depth() function return zero. Definition at line 374 of file _smach.h. References smach< CON, K, M >::curr_state, ETL_MUTEX_LOCK, smach< CON, K, M >::state_base::leave_state(), smach< CON, K, M >::pop_state(), smach< CON, K, M >::state_context, and smach< CON, K, M >::states_on_stack. Referenced by smach< CON, K, M >::enter(), smach< CON, K, M >::pop_state(), smach< CON, K, M >::process_event(), and smach< CON, K, M >::~smach(). |
|
State entry function. Attempts to enter the given state, popping off all states on the stack in the process. Definition at line 408 of file _smach.h. References smach< CON, K, M >::curr_state, smach< CON, K, M >::egress(), smach< CON, K, M >::state_base::enter_state(), ETL_MUTEX_LOCK, smach< CON, K, M >::machine_context, and smach< CON, K, M >::state_context. Referenced by smach< CON, K, M >::process_event(), and smach< CON, K, M >::push_state(). |
|
Pushes state onto state stack. This allows you to enter a state without leaving your current state.
Definition at line 451 of file _smach.h. References smach< CON, K, M >::curr_state, smach< CON, K, M >::enter(), smach< CON, K, M >::state_base::enter_state(), ETL_MUTEX_LOCK, smach< CON, K, M >::machine_context, SMACH_STATE_STACK_SIZE, smach< CON, K, M >::state_context, smach< CON, K, M >::state_context_stack, smach< CON, K, M >::state_stack, and smach< CON, K, M >::states_on_stack. |
|
Pops state off of state stack. Decreases state depth Definition at line 487 of file _smach.h. References smach< CON, K, M >::curr_state, smach< CON, K, M >::egress(), ETL_MUTEX_LOCK, smach< CON, K, M >::state_base::leave_state(), smach< CON, K, M >::state_context, smach< CON, K, M >::state_context_stack, smach< CON, K, M >::state_stack, and smach< CON, K, M >::states_on_stack. Referenced by smach< CON, K, M >::egress(), and smach< CON, K, M >::process_event(). |
|
Sets up a child state machine. A child state machine runs in parallel with its parent, and gets event priority. This mechanism is useful in cases where an inherited object has its own state machine. Definition at line 540 of file _smach.h. References smach< CON, K, M >::child, and ETL_MUTEX_LOCK. |
|
Returns the number states currently active.
Definition at line 550 of file _smach.h. References smach< CON, K, M >::curr_state, and smach< CON, K, M >::states_on_stack. |
|
Definition at line 554 of file _smach.h. Referenced by smach< CON, K, M >::process_event(), and smach< CON, K, M >::state< T >::process_event(). |
|
|
Current state of the machine.
Definition at line 286 of file _smach.h. Referenced by smach< CON, K, M >::egress(), smach< CON, K, M >::enter(), smach< CON, K, M >::get_state_name(), smach< CON, K, M >::pop_state(), smach< CON, K, M >::process_event(), smach< CON, K, M >::push_state(), and smach< CON, K, M >::state_depth(). |
|
Child machine.
Definition at line 287 of file _smach.h. Referenced by smach< CON, K, M >::process_event(), and smach< CON, K, M >::set_child(). |
|
State Context.
Definition at line 290 of file _smach.h. Referenced by smach< CON, K, M >::egress(), smach< CON, K, M >::enter(), smach< CON, K, M >::state< T >::get_context(), smach< CON, K, M >::state< T >::leave_state(), smach< CON, K, M >::pop_state(), smach< CON, K, M >::process_event(), smach< CON, K, M >::state< T >::process_event(), and smach< CON, K, M >::push_state(). |
|
Machine Context.
Definition at line 293 of file _smach.h. Referenced by smach< CON, K, M >::enter(), smach< CON, K, M >::push_state(), and smach< CON, K, M >::set_default_state(). |
|
Definition at line 295 of file _smach.h. Referenced by smach< CON, K, M >::get_state_name(), smach< CON, K, M >::process_event(), smach< CON, K, M >::set_default_state(), and smach< CON, K, M >::~smach(). |
|
Definition at line 296 of file _smach.h. Referenced by smach< CON, K, M >::process_event(), smach< CON, K, M >::set_default_state(), and smach< CON, K, M >::~smach(). |
|
|
|
State stack data.
Definition at line 303 of file _smach.h. Referenced by smach< CON, K, M >::pop_state(), and smach< CON, K, M >::push_state(). |
|
Definition at line 304 of file _smach.h. Referenced by smach< CON, K, M >::pop_state(), and smach< CON, K, M >::push_state(). |
|
Definition at line 305 of file _smach.h. Referenced by smach< CON, K, M >::egress(), smach< CON, K, M >::pop_state(), smach< CON, K, M >::push_state(), and smach< CON, K, M >::state_depth(). |