Boost logo

Boost :

From: Marc Jacobs (marcja_at_[hidden])
Date: 2002-10-31 10:41:46

"Mattias Flodin" <flodin_at_[hidden]> wrote in message
On Wed, Oct 30, 2002 at 03:45:05PM -0500, Marc Jacobs wrote:
> > > Exception handling may be expensive. Perhaps it could be good to
provide a
> > > query, to determine if an operation may be performed.
> >
> > Good suggestion. I will add it. Requires a little slight of hand given
> > the state objects have no intrinsic value, just type, but entirely
> > Usage would probably be something like:
> >
> > if( context::equals( fsmtl::state< on >() ) ) {
> > // ...
> > }
> Why not also have:
> if(context::raise( fsmtl::event< fsm::poweron >() )) {
> // ...
> }
> I suppose this would require configuration by policies, though.

Hmm. I think that too would be possible even without policies (although
either a policy class or an exceptions(...) member a la iostream might
simplify things). Currently, the default_handler (which is a virtual
function) throws a fsmtl::bad_transition exception upon an illegal
transition. But there's no reason the library user couldn't instead 'return
false' (even on a per-state basis). I would have to change the return types
of several functions from void to bool, but that doesn't seems too much
trouble. Of course, the library user would have to provide 'return true'
implementations in the transition bodies (where currently an empty body

Thanks for the good suggestion!

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