Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2002-10-30 15:07:20

>From: "Marc Jacobs" <marcja_at_[hidden]>
> A common strategy for using this kind of state machine is raise an event
> before doing some work to see if the work is allowed in the current state.
> Example:
> void BusinessObject::turnPowerOn() {
> try {
> context::raise( fsmtl::event< fsm::poweron >() );
> // do work for turn the power on
> }
> catch( fsmtl::exception & e )
> { ... }
> If the transition is not permitted given the current state and event, an
> exception is thrown and no work is performed. Whether the exception is
> rethrown, not caught, or translated into a different kind of exception is
> to the library user.

Exception handling may be expensive. Perhaps it could be good to provide a
query, to determine if an operation may be performed.



Boost list run by bdawes at, gregod at, cpdaniel at, john at