
This is a personal choice but these reasons matter to me more than the extra complexity added by a template parameter. If your taste is the Standard one, it is fine with me, just define "none" as event parameter.
In my approach (using none), it is also possible to implement that "if/else" mechanism. See the attached file.
I think you might have forgotten the file. I'll try to answer without it. Please correct me if I get it wrong. If your plan is to add some guards to the transitions starting from the pseudo exit, this is not UML conform as guards are not allowed there (not that it matters to msm, I usually have great pleasure to ignore the Standard's restrictions ;-) But other tools might care).
We can access the "stored" event parameter in guard functor. (Use the get_param() instead of get_result().) Of course some public interface is required in State1_.
Sure but I'd prefer to avoid this. It means attributes in State1_ which are only valid when the pseudo exit is used.
There are two different ways of thinking about dependency.
A. The event that occurs in the sub state machine is submachine’s concern. If outside state machine want to know which event is occurred in submachine, submachine should provide the proper interface.
I understand but it's not my programming style because, as stated above, it means attributes in the submachine, which are only valid in a certain scenario, meaning in a certain... state of the submachine. These attributes will need a default value, will need to be reset after the call, could be called at a point where they are invalid, will need some special work of the submachine (ex: when to reset them? Just after the transition? When is it? How will the caller know whether they are valid?). Quite some work. I prefer going generic. The main machine has no idea about the event type, only that it provides a certain method. Of course I understand that templates are not everybody's stuff. Luckily, msm allows both ways :) If you feel more comfortable with submachine methods, it's fine.
Of course we can know not only events but also everything occurs in submachine. For example action result in submachine.(See 12_InsideOutsideInfo.cpp)
Sure you can. Whether you want this or not is a matter of taste.
B. Events are the concept separate from state machine (and sub machine). They exist independent. Hence the mechanism should treat events exceptionally.
My opinion is A. But I can understand B. What do you think?
I think I'll need your example to understand this question. Generally, my opinion is that I want the weakest dependency I can get away with. And a dependency to a template method of an event seems to me a weaker one than a dependency to a submachine class. Both ways because the submachine would also have to make some assumptions about the main machine's behaviour. Regards, Christophe