CHSM
4.4.1
|
A cluster is-a CHSM::parent that can have at most one child-state active at any given time. More...
#include <chsm.h>
Public Member Functions | |
void | clear () |
Clears the history. More... | |
cluster (CHSM_CLUSTER_ARGS) | |
Constructs a cluster. More... | |
virtual void | deep_clear () |
Clear the history, if any; then clear all child cluster's history, if any. More... | |
virtual bool | enter (event const &trigger, state *from_child=0) |
Enters a cluster via a transition and also enter one of its child states. More... | |
virtual bool | exit (event const &trigger, state *to=0) |
Exits a cluster via a transition, but first exit its active child state. More... | |
Public Member Functions inherited from CHSM::parent | |
iterator | begin () |
Returns a parent::iterator positioned at the first child state of a parent. More... | |
const_iterator | begin () const |
Returns a parent::const_iterator positioned at the first child state of a parent. More... | |
bool | empty () const |
Returns whether this parent has any child states. More... | |
iterator | end () |
Returns a parent::iterator positioned at one past the last child state of a parent. More... | |
const_iterator | end () const |
Returns a parent::const_iterator positioned at one past the last child state of a parent. More... | |
reference | front () |
Returns a parent::reference to the first child state. More... | |
const_reference | front () const |
Returns a parent::const_reference to the first child state. More... | |
Public Member Functions inherited from CHSM::state | |
bool | active () const |
Returns whether this state is active. More... | |
char const * | name () const |
Return the name of the state. More... | |
parent * | parent_of () const |
Return the parent cluster or set. More... | |
state (CHSM_STATE_ARGS) | |
Construct a state. More... | |
~state () | |
Destroy a state. More... | |
Additional Inherited Members | |
Public Types inherited from CHSM::parent | |
typedef value_type const * | const_pointer |
A pointer to a const value_type . More... | |
typedef value_type const & | const_reference |
A reference to a const value_type . More... | |
typedef value_type * | pointer |
A pointer to a value_type . More... | |
typedef value_type & | reference |
A reference to a value_type . More... | |
typedef state | value_type |
The type of the value returned by iterator and const_iterator. More... | |
A cluster is-a CHSM::parent that can have at most one child-state active at any given time.
A cluster may have a history. If a cluster does not have a history, or it does have a history but has not previously been active, then the child-state entered after it itself is entered is the default child-state; if a cluster does have a history and it has been visited before, then the child-state entered after it itself is entered is the one that was last active.
A cluster may alternatively have a deep history. Such a cluster behaves exactly as one with an ordinary history; the difference is that all clusters lexically-enclosed by it in the CHSM description also have a history.
The cluster class can be extended either to add additional data members and member functions, or to alter its behavior upon being entered or exited.
CHSM::cluster::cluster | ( | CHSM_CLUSTER_ARGS | ) |
Constructs a cluster.
When deriving a class from cluster, the macros CHSM_CLUSTER_ARGS
CHSM_CLUSTER_INIT
can be used to avoid having to deal with the many constructor arguments. See CHSM::state for an example.
|
inline |
Clears the history.
Referenced by deep_clear().
|
virtual |
Clear the history, if any; then clear all child cluster's history, if any.
Reimplemented from CHSM::parent.
References clear(), and CHSM::parent::deep_clear().
Enters a cluster via a transition and also enter one of its child states.
trigger | The event that triggered the transition. |
from_child | If not null , this child state of the cluster is being entered directly. |
true
only if the cluster was actually entered, i.e., it wasn't already active. Reimplemented from CHSM::state.
References CHSM::parent::empty(), CHSM::state::enter(), and CHSM::parent::front().
Referenced by CHSM::machine::enter().
Exits a cluster via a transition, but first exit its active child state.
trigger | The event that triggered the transition. |
to | The state that is being transitioned to. |
true
only if the cluster actually exited, i.e., it was active. Reimplemented from CHSM::state.
References CHSM::state::active(), and CHSM::state::exit().
Referenced by CHSM::machine::exit().