ETL  0.04.19
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
smach< CON, K, M >::state< T > Class Template Reference

State class. More...

#include <_smach.h>

Inheritance diagram for smach< CON, K, M >::state< T >:
smach< CON, K, M >::state_base

Public Types

typedef event_def_internal< T > event_def
typedef T state_context_type

Public Member Functions

 state (const char *n, smach *nest=0)
 Default handler for unknown key.
virtual ~state ()
void set_nested_machine (smach *sm)
 Setup a nested state machine.
void set_default_handler (const typename event_def::funcptr &x)
 Sets the default handler.
virtual const char * get_name () const
 Returns given the name of the state.
void insert (const event_def &x)
 Adds an event_def onto the list and then make sure it is sorted correctly.
std::vector< event_def >::iterator find (const event_key &x)
std::vector< event_def >
::const_iterator 
find (const event_key &x) const
- Public Member Functions inherited from smach< CON, K, M >::state_base
virtual ~state_base ()

Protected Member Functions

virtual void * enter_state (context_type *machine_context) const
virtual bool leave_state (void *x) const
virtual event_result process_event (void *x, const event &id) const

Private Attributes

std::vector< event_defevent_list
smachnested
event_key low
 Nested machine.
event_key high
const char * name
 Lowest and Highest event values.
event_def::funcptr default_handler
 Name of the state.

Friends

class smach

Detailed Description

template<typename CON, typename K = int, typename M = mutex_null>
template<typename T>
class smach< CON, K, M >::state< T >

State class.

Definition at line 166 of file _smach.h.

Member Typedef Documentation

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
typedef event_def_internal<T> smach< CON, K, M >::state< T >::event_def

Definition at line 172 of file _smach.h.

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
typedef T smach< CON, K, M >::state< T >::state_context_type

Definition at line 173 of file _smach.h.

Constructor & Destructor Documentation

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
smach< CON, K, M >::state< T >::state ( const char *  n,
smach nest = 0 
)
inline

Default handler for unknown key.

Constructor

Definition at line 188 of file _smach.h.

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
virtual smach< CON, K, M >::state< T >::~state ( )
inlinevirtual

Definition at line 192 of file _smach.h.

Member Function Documentation

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
void smach< CON, K, M >::state< T >::set_nested_machine ( smach sm)
inline

Setup a nested state machine.

A more detailed explanation needs to be written

Definition at line 196 of file _smach.h.

References smach< CON, K, M >::state< T >::nested.

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
void smach< CON, K, M >::state< T >::set_default_handler ( const typename event_def::funcptr x)
inline

Sets the default handler.

Definition at line 199 of file _smach.h.

References smach< CON, K, M >::state< T >::default_handler.

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
virtual const char* smach< CON, K, M >::state< T >::get_name ( ) const
inlinevirtual

Returns given the name of the state.

Implements smach< CON, K, M >::state_base.

Definition at line 202 of file _smach.h.

References smach< CON, K, M >::state< T >::name.

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
void smach< CON, K, M >::state< T >::insert ( const event_def x)
inline

Adds an event_def onto the list and then make sure it is sorted correctly.

Definition at line 206 of file _smach.h.

References smach< CON, K, M >::state< T >::event_list, smach< CON, K, M >::state< T >::high, smach< CON, K, M >::event_def_internal< T >::id, and smach< CON, K, M >::state< T >::low.

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
std::vector<event_def>::iterator smach< CON, K, M >::state< T >::find ( const event_key x)
inline
template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
std::vector<event_def>::const_iterator smach< CON, K, M >::state< T >::find ( const event_key x) const
inline

Definition at line 225 of file _smach.h.

References binary_find(), and smach< CON, K, M >::state< T >::event_list.

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
virtual void* smach< CON, K, M >::state< T >::enter_state ( context_type machine_context) const
inlineprotectedvirtual

Implements smach< CON, K, M >::state_base.

Definition at line 229 of file _smach.h.

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
virtual bool smach< CON, K, M >::state< T >::leave_state ( void *  x) const
inlineprotectedvirtual

Implements smach< CON, K, M >::state_base.

Definition at line 234 of file _smach.h.

References smach< CON, K, M >::state_context.

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
virtual event_result smach< CON, K, M >::state< T >::process_event ( void *  x,
const event id 
) const
inlineprotectedvirtual

Friends And Related Function Documentation

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
friend class smach
friend

Definition at line 169 of file _smach.h.

Member Data Documentation

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
std::vector<event_def> smach< CON, K, M >::state< T >::event_list
private
template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
smach* smach< CON, K, M >::state< T >::nested
private
template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
event_key smach< CON, K, M >::state< T >::low
private

Nested machine.

Definition at line 181 of file _smach.h.

Referenced by smach< CON, K, M >::state< T >::insert(), and smach< CON, K, M >::state< T >::process_event().

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
event_key smach< CON, K, M >::state< T >::high
private
template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
const char* smach< CON, K, M >::state< T >::name
private

Lowest and Highest event values.

Definition at line 182 of file _smach.h.

Referenced by smach< CON, K, M >::state< T >::get_name().

template<typename CON , typename K = int, typename M = mutex_null>
template<typename T >
event_def::funcptr smach< CON, K, M >::state< T >::default_handler
private

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