README.txt 1.3 KB

12345678910111213141516171819202122232425262728
  1. What's In This Directory
  2. ========================
  3. * player1.cpp - this is exactly what's covered in C++ Template
  4. Metaprogramming (http://www.boost-consulting.com/mplbook); in fact,
  5. it was auto-extracted from the examples as shown in the book. The
  6. state machine framework and its use are together in one .cpp file;
  7. normally they would be separated. You can think of the framework as
  8. ending with the definition of the generate_dispatcher class
  9. template.
  10. You can ignore the typedef called "dummy;" that was included in order to
  11. test an intermediate example that appears in the book.
  12. * player2.cpp - this example demonstrates that the abstraction of the
  13. framework is complete by replacing its implementation with one that
  14. dispatches using O(1) table lookups, while still using the same code
  15. to describe the particular FSM. Look at this one if you want to see
  16. how to generate a static lookup table that's initialized at dynamic
  17. initialization time.
  18. * player.cpp, state_machine.hpp - This example predates the book, and
  19. is more sophisticated in some ways than what we cover in the other
  20. examples. In particular, it supports state invariants, and it
  21. maintains an internal event queue, which requires an additional
  22. layer of runtime dispatching to sort out the next event to be
  23. processed.