David Abrahams writes:
"Terry G"
writes: BTW, on the boost website, there are three versions of the FSM player example. Where?
Its in the Boost 1.33.1 download from the website, in boost/libs/mpl/example/fsm. I have the book CD too, of course. Which is "best"?
Oh, crud. We should have included a README file there, and I hope Aleksey will help me get this sorted out so I can write one.
Here's what I think:
player1.cpp - this is exactly what's covered in the book; in fact, it was auto-extracted from the examples as shown in the book.
Yep.
player2.cpp - this example demonstrates that the abstraction of the framework is complete by replacing its implementation with one that dispatches using O(1) table lookups, while still using the same code to describe the particular FSM. Look at this one if you want to see how to generate a static lookup table that's initialized at dynamic initialization time.
Correct.
player.cpp, state_machine.hpp - this is something Aleksey wrote. I'm not sure, but I think it predates the book,
It does.
and is more sophisticated in some ways
In particular, it supports state invariants and maintains an internal event queue.
but probably should be treated as an advanced example.
Yep. -- Aleksey Gurtovoy MetaCommunications Engineering