Boost logo

Boost Users :

Subject: Re: [Boost-users] [MSM] test if state machine is in a given state /const get_state
From: Jan Vogelgesang (jan.vogelgesang_at_[hidden])
Date: 2011-03-03 06:31:52


Hi all, hi Christoph,

On 01.03.2011 22:51, Christophe Henry wrote:
>
> Usually, if you want to ask "isInState", you actually mean "is my fsm
> in such a state that a property is true?". Next, what you will want
> is:
> assert(isInState(mAvail, AvailFSM::UpstreamAvailable()) ||
> isInState(...)&& !... );
>
> And this can pretty fast get much uglier as you need more and more conditions.
> To that aim, MSM offers the concept of flags, allowing you to flag a
> state with a certain property. You can then check if the property is
> true with, say:
> if (mAvail.is_flag_active<UpstreamOk>()) ...

I considered to use the concept of flags, but then rejected it, simply
because it adds another layer of abstraction, which is great in certain
cases, but also increases the overall complexity.

In my case i need hardly any properties which span over more than one
state, so i prefer to keep thinks simple for now. It's the constant
struggle to have enough, but not to much abstraction...

But thanks for the hint, i'll keep that in mind.

>> 2) Is a const version of "get_state" possible ? And how?
>
> Sure. My mistake. Will be fixed in 1.47. Would you mind opening a
> ticket so I don't forget it?

done, ticket #5253. Now i'am looking forward to 1.47 ;-)
Thanks for the good work!

Best,
jan


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