Boost logo

Boost Users :

Subject: Re: [Boost-users] [MSM] multiple visitors / signatures, and visitors by ref in submachines
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2012-04-06 17:53:20


  Hi Albert,

>Hi,
>
>I think that the visitors and the flags ideas of the MSM are very generic and easy to use.
>So, great!
>
>But, there is a way to define multiple visitors for a single state (base)?

  No.

>I think that it is not possible because the visitors mechanism is based on a "simple/single typedef" and not on an "listed typedef"... isn't it?
  Yes.

>So, why the visitors are not like flags?
>I mean, why not to use an "accept_sig_list" instead of a single "accept_sig"?
>Why is not possible a code like the following:
>
>struct my_visitable_state
>{
> typedef mpl::vector< args<void, VisitorType1&>, args<void, VisitorType2&> > accept_sig_list;
>

> void accept(VisitorType1&) const {}
> void accept(VisitorType2&) const {}
>};
>

  It is possible. It has not been done because the interest in the visitor concept seems to have been (sadly) limited. This feature is dates a bit (about 3 years ago), and I got, if my memory is correct, exactly 2 questions about it (counting his one). This makes improvements get a low priority. Actually the concept could also do with a bit of redesign. For example args<void, SomeVisitor&,int> would look much better if defined as args<void (SomeVisitor&,int)>. If you would like to help, I'm interested ;-)

>By the way... I think that the usage of boost::ref() is not propagated to the submachines...?
>I've found that when my state machine is also in a submachine, the visitor of the state machine is passed by reference, but the
>submachine is passed always by value... is this a bug?
>(just using a pointer solved my needs, so just to report...)
  I just fixed it in trunk (rev. 77793). Thanks for the report.

>
>

>Thanks,
>
>

>Albert

  Cheers,
  Christophe



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