Boost logo

Boost :

Subject: Re: [boost] [msm] orthogonal region and event consume
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2012-05-30 16:43:25

Hi Takatoshi,

>> I read your ticket. Note that it's not UML-conform to have 2 transitions
>> originating from Entry1 (11-08-06.pdf §15.3.8 page 551).
>> After reading the Standard again twice, I realized that no example
>> provided
>> there displays any event on both transitions, which is really bad if it's
>> what they mean. I need to have a look at other literature.

>I read the section that you mentioned carefully. My interpretation of
>UML specification is different from yours.
>It's really difficult to explain my interpretation. So, I draw the
>diagram. See the attached file.
>Am I misunderstanding?

I will not pretend I have the perfect understanding of the Standard. Here's
my take. I also saw the sentence on top of your diagram and didn't fully
understand it when reading the Standard. There is also the following
sentence in the Standard:

"An entry pseudostate is used to join an external transition terminating on
that entry point to an internal transition
emanating from that entry point".

Which sounds logical because on your diagram the regions would not be

This means you cannot have transitions triggered by different events leading
to the entry point, not can you have different transitions leaving it. You
will need more entry points.

Caution: I am far from being sure I got it right. That's why I precised my
definition of it in the doc. The implemented solution has the advantage that
you have the normal transition handling, including multiple transitions and
guards, events with data, base events, etc.
What you don't have is entry in multiple regions, which only the fork
currently provides, at the cost of lesser encapsulation.
Correct or not, this is the part of the Standard I chose to implement pseudo

To be honest, I'm not of fan of pseudo entries. I prefer the vastly superior
solution of entering a submachine the "normal" way, then letting a
templatized, enable_if'd on_entry of the submachine do something clever with
the event at compile-time.

>My goal is to improve sub-machines' re-usability. If we want to reuse
>sub-machines in another state machines, sub-machines shouldn't know
>the outside information.

I agree but is it the case? I mean, if you send normal events to your
submachine through your outer machine, it also needs to know them, right?
I understand this as: "hi, I'm a submachine and I provide the following
entry points: Entry1 requires Event1, Entry2 requires Event2, etc.". A bit
like function parameters.

>See my second mail in this thread. My solution using templates
>(entry_pseudo_event_template.cpp) requires the template parameters
>same as the number of entry point pseudo states in sub-machine. It's
>acceptable but if outgoing transition would be able to use none, I
>would remove the template parameters.

>In the above case, it is not required to support multiple incoming
>transitions to one entry pseudo state. Because the instances of
>sub-machine are different.

In this case, maybe I could interest you in defining a base event class for
Event1 and Event2, then making this base event the event triggering the
inside transition. Your first example would be changed this way:

    struct BaseEvent {};
    struct Event1: public BaseEvent {};
   msmf::Row < Entry1, BaseEvent, State2_2, msmf::none, msmf::none >


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