Boost logo

Boost Users :

From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2007-04-12 18:32:31


Jeffrey Holle wrote:
> I'm using boost CVS version gotten on Fri Apr 6 11:48:58 EDT 2007.
>
> I'm starting to use boost::statechart for the first time.
>
> Scanning the available documentation has produced some questions.
>
> I found the following text in a C++ comment within the tutorial:
> context<>() is used to gain access to the direct or indirect context
> of a state. This can either be a direct or indirect outer state or
> the state machine itself.
>
> 1, What does "direct" "indirect" context mean?

Have you read:

<http://www.boost-consulting.com/boost/libs/statechart/doc/definitions.html#Context>

?

> It is documented a number of places that the possible types of
> reactions are:
> 1. custom-reaction
> 2. in-state-reaction
> 3. deferral
> 4. transition
>
> 2. What is the syntax for using an "in-state-reaction"

Pretty much the same as for a transition with a transition action but of
course without the Destination parameter. See here for an example:

<http://www.boost-consulting.com/boost/libs/statechart/doc/tutorial.html#TransitionActions>

(see the typedef in the Focusing struct)

>, which I
> assume is a self transition?

No. A self-transition, at least with UML <2.0, always exits the state
where it originates and then reenters it. That is, if present the
states' exit and entry actions are called. An in-state reaction never
changes the current state configuration.

> 3. What is a custom-reaction?

Please see

<http://www.boost-consulting.com/boost/libs/statechart/doc/tutorial.html#IntermediateTopicsADigitalCamera>

Basically they allow you to do things for which the predefined reactions
are too inflexible. An event often carries arguments with it and you
sometimes want to inspect these arguments before you decide exactly what
kind of reaction you want to execute. Another common use-case is when
the kind of reaction depends on the value of local state variables.

> 4. What is a deferral?

Short answer: <http://www.omg.org/cgi-bin/apps/doc?formal/07-02-05.pdf>,
page 548
Longer answer:
<http://www.boost-consulting.com/boost/libs/statechart/doc/tutorial.html#DeferringEvents>

HTH,

-- 
Andreas Huber
When replying by private email, please remove the words spam and trap
from the address shown in the header. 

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net