Boost logo

Boost Users :

From: Andreas Huber (ahd6974-spamgroupstrap_at_[hidden])
Date: 2006-05-14 13:29:34


Hi Johan

Sorry for the delay, I'm currently on holiday.

> 1. For a state, is it possible to specify a method that will be called when
> an event with no defined handlers is received?

You can do that globally for the whole state machine with the technique
outlined by Oliver (thanks, Oliver!), or locally for one state or a group of
states by defining a reaction that is triggered by sc::event_base rather than a
concrete event. Such a reaction is usually the last one in the reactions
typedef.

> 2. Is is somehow possible to reuse state definitions as substates of
> different "higher-level" states? Sorry about the terminology, I'll give a
> specific example:
>
> - I've got an application that can be either in remote or locally controlled
> mode (this is the highest-level states).
> - Certain events are allowed both in remote and local, while some are not.
> As an example, the "CommandEvent" event should be handled both in remote and
> local - resulting in the "ExecutingCommandState" being entered.
> - I'd like to be able to reuse the definition of ExecutingCommandState
> regardless of the enclosing state being Remote or Local - Possible?

It seems Tim is right on the spot on this one (thanks, Tim!). Please let us
know whether that works for you.

HTH & Regards,

Andreas


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