Boost logo

Boost Users :

From: Commander Pirx (CmdPirx_at_[hidden])
Date: 2008-03-10 11:53:38


Thanx for the answer. I would like to say something general in this context.
The Statechart Library is well implemented and a good sample for the
flexibility and extensibility of C++. There are only a few languages that
could define a state_cast<> operator for example.
But there are also some drawbacks. States are modelled as separate
structs/classes. Dont't understand me wrong. This is a bright idea. But
programming would be easier when states could be a property of the objects.
With other words, it would be nice, if states would be supported direct by
the language.
Some time ago, I have dealt with an experimental language implementation
where states are a part of the signature of a method. I'm afraid this is
beyond the scope of possibilities of a library - even in C++. But who knows!

Thanks for your helpfull answer again.
Sylko!

"Andreas Huber" <ahd6974-spamboostorgtrap_at_[hidden]> schrieb im Newsbeitrag
news:fqpiig$7rc$1_at_ger.gmane.org...
> Hi
>
>> Here is an simple example: Each session object of the server has two
>> states:
>> signed-off and authorized. Receiving a login event leads to a transition
>> to
>> the authorized state. Thats pretty easy. But the login data (stored in
>> the
>> login event) got lost. I can hold this data in the state machine itself
>> (outermost_context()). Or I can use a pseudo event to forward this data
>> to
>> the authorized state. But I'm looking for a nifty way to avoid this
>> overhead.
>
> Your observations are correct. Provided that you absolutely want to
> transition when such an event arrives, then these are currently the only
> ways to make the event available to the destination state. Which way is
> best
> depends on your situation but in your example I'd probably simply post the
> incoming event and have it picked up with an in-state reaction in the
> destination state.
>
>> I like this concept of state-local storage very much. But I'm not
>> shure about how to use it.
>
> Maybe you've noticed the existence of
> BOOST_STATECHART_RELAX_TRANSITION_CONTEXT? Currently, this doesn't help
> you.
> However, one way to solve your problem would be to generalize the relaxing
> concept, so that you can specify any function that happens to accept the
> right type of event and also is a member of any state in the source or
> destination configuration. I've tried to implement this before, but
> abandoned the idea because it makes at lot of heavily templated code much
> more complex. Maybe I'll try again but don't count on getting this feature
> soon!
>
> 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