Andrey Semashev | 8 Aug 18:55
Picon

Re: FSM Review Announcement

David Abrahams wrote:
> on Tue Aug 05 2008, Andrey Semashev <andrey.semashev-AT-gmail.com> wrote:
> 
>> David Abrahams wrote:
>>> on Tue Aug 05 2008, Chris Knight <cknite-AT-gmail.com> wrote:
>>> I don't know if you've seen the FSM examples from "C++ Template
>>> Metaprogramming" or not.  It would be interesting for this library's
>>> documentation to explain its advantages over that approach (I can see
>>> some from here already).
>> No, I don't have that book.
> 
> For your perusal:
> 
> http://www.boostpro.com/mplbook/examples/player.cpp
> http://www.boostpro.com/mplbook/examples/player2.cpp

Thanks for the info. I guess I'm not the first one who came up with such 
approach. :)

My implementation has similarities to player2.cpp, however, there are 
significant advantages in Boost.FSM.
- The library does not take addresses of user's functions, which allows 
to use templates and simplifies overloading.
- States are not an enum values but classes that may have a common 
virtual base, which allows to have state-specific and shared data in the 
FSM. The events are processed in states.
- States support enter and leave handlers. There is also a reset method 
that allows to clear the states and silently transit to the initial state.
- Other minor things, like auto-generated state names, dynamic handler 
for unsupported events, thread-safety issues, etc.

I'd love to put a full comparison to the library documentation, but I 
feel this would be not... fair (for the lack of a better word) since I 
didn't read the book and only seen a couple of examples.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Gmane