|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63062 - in trunk/libs/msm/doc: HTML HTML/examples PDF PDF/examples src
From: christophe.j.henry_at_[hidden]
Date: 2010-06-17 16:52:36
Author: chenry
Date: 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
New Revision: 63062
URL: http://svn.boost.org/trac/boost/changeset/63062
Log:
corrected inspection report warnings
Added:
trunk/libs/msm/doc/HTML/examples/SCComposite.cpp (contents, props changed)
trunk/libs/msm/doc/HTML/examples/SCSimple.cpp (contents, props changed)
trunk/libs/msm/doc/PDF/examples/SCComposite.cpp (contents, props changed)
trunk/libs/msm/doc/PDF/examples/SCSimple.cpp (contents, props changed)
Removed:
trunk/libs/msm/doc/HTML/boost.css
trunk/libs/msm/doc/HTML/docutils.css
trunk/libs/msm/doc/HTML/examples/SC Composite.cpp
trunk/libs/msm/doc/HTML/examples/SC Simple.cpp
trunk/libs/msm/doc/HTML/minimal.css
trunk/libs/msm/doc/HTML/reference.css
trunk/libs/msm/doc/PDF/examples/SC Composite.cpp
trunk/libs/msm/doc/PDF/examples/SC Simple.cpp
Binary files modified:
trunk/libs/msm/doc/PDF/msm.pdf
Text files modified:
trunk/libs/msm/doc/HTML/ch04.html | 4 ++--
trunk/libs/msm/doc/src/msm.xml | 17 +++++++++++------
2 files changed, 13 insertions(+), 8 deletions(-)
Deleted: trunk/libs/msm/doc/HTML/boost.css
==============================================================================
--- trunk/libs/msm/doc/HTML/boost.css 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
+++ (empty file)
@@ -1,66 +0,0 @@
-/*=============================================================================
- Copyright 2002 William E. Kempf
- Distributed under the Boost Software License, Version 1.0. (See accompany-
- ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-=============================================================================*/
-
-H1
-{
- FONT-SIZE: 200%;
- COLOR: #00008B;
-}
-H2
-{
- FONT-SIZE: 150%;
-}
-H3
-{
- FONT-SIZE: 125%;
-}
-H4
-{
- FONT-SIZE: 108%;
-}
-BODY
-{
- FONT-SIZE: 100%;
- BACKGROUND-COLOR: #ffffff;
- COLOR: #000000;
-}
-PRE
-{
- MARGIN-LEFT: 2em;
- FONT-FAMILY: Courier,
- monospace;
-}
-CODE
-{
- FONT-FAMILY: Courier,
- monospace;
-}
-CODE.as_pre
-{
- white-space: pre;
-}
-.index
-{
- TEXT-ALIGN: left;
-}
-.page-index
-{
- TEXT-ALIGN: left;
-}
-.definition
-{
- TEXT-ALIGN: left;
-}
-.footnote
-{
- FONT-SIZE: 66%;
- VERTICAL-ALIGN: super;
- TEXT-DECORATION: none;
-}
-.function-semantics
-{
- CLEAR: left;
-}
\ No newline at end of file
Modified: trunk/libs/msm/doc/HTML/ch04.html
==============================================================================
--- trunk/libs/msm/doc/HTML/ch04.html (original)
+++ trunk/libs/msm/doc/HTML/ch04.html 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
@@ -2,8 +2,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Chapter 4. Performance / Compilers</title><link rel="stylesheet" href="boostbook.css" type="text/css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.75.2"><link rel="home" href="index.html" title="Meta State Machine (MSM) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch03s05.html" title="Back-end"><link rel="next" href="ch04s02.html" title="Executable size"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. Performance / Compilers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="ch04s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 4. Performan
ce / Compilers"><div class="titlepage"><div><div><h2 class="title"><a name="d0e3724"></a>Chapter 4. Performance / Compilers</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1">Speed</span></dt><dt><span class="sect1">Executable size</span></dt><dt><span class="sect1">Supported compilers</span></dt><dt><span class="sect1"> Limitations </span></dt><dt><span class="sect1"> Compilers corner </span></dt></dl></div><p>Tests were made on different PCs running Windows XP and Vista and compiled with
VC9 SP1 or Ubuntu and compiled with g++ 4.2 and 4.3. For these tests, the same
- player state machine was written using Boost.Statechart, as a <a class="link" href="examples/SC Simple.cpp" target="_top">state machine with only simple states</a>
- and as a <a class="link" href="examples/SC Composite.cpp" target="_top">state machine with a composite
+ player state machine was written using Boost.Statechart, as a <a class="link" href="examples/SCSimple.cpp" target="_top">state machine with only simple states</a>
+ and as a <a class="link" href="examples/SCComposite.cpp" target="_top">state machine with a composite
state</a>. The same simple and composite state machines are implemented with
MSM with a standard frontend <a class="link" href="examples/MsmSimple.cpp" target="_top">(simple)</a><a class="link" href="examples/MsmComposite.cpp" target="_top">(composite)</a>,
the simple one also with <a class="link" href="examples/MsmSimpleFunctors.cpp" target="_top">functors</a> and with <a class="link" href="examples/EumlSimple.cpp" target="_top">eUML</a>. As these simple machines need no terminate/interrupt states, no
Deleted: trunk/libs/msm/doc/HTML/docutils.css
==============================================================================
--- trunk/libs/msm/doc/HTML/docutils.css 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
+++ (empty file)
@@ -1,275 +0,0 @@
-/*
-:Author: David Goodger
-:Contact: goodger_at_[hidden]
-:Date: $Date: 2007-11-25 19:34:32 +0000 (Sun, 25 Nov 2007) $
-:Revision: $Revision: 41371 $
-:Copyright: This stylesheet has been placed in the public domain.
-
-Default cascading style sheet for the HTML output of Docutils.
-
-See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
-customize this style sheet.
-*/
-
-/* used to remove borders from tables and images */
-.borderless, table.borderless td, table.borderless th {
- border: 0 }
-
-table.borderless td, table.borderless th {
- /* Override padding for "table.docutils td" with "! important".
- The right padding separates the table cells. */
- padding: 0 0.5em 0 0 ! important }
-
-.first {
- /* Override more specific margin styles with "! important". */
- margin-top: 0 ! important }
-
-.last, .with-subtitle {
- margin-bottom: 0 ! important }
-
-.hidden {
- display: none }
-
-a.toc-backref {
- text-decoration: none ;
- color: black }
-
-blockquote.epigraph {
- margin: 2em 5em ; }
-
-dl.docutils dd {
- margin-bottom: 0.5em }
-
-/* Uncomment (and remove this text!) to get bold-faced definition list terms
-dl.docutils dt {
- font-weight: bold }
-*/
-
-div.abstract {
- margin: 2em 5em }
-
-div.abstract p.topic-title {
- font-weight: bold ;
- text-align: center }
-
-div.admonition, div.attention, div.caution, div.danger, div.error,
-div.hint, div.important, div.note, div.tip, div.warning {
- margin: 2em ;
- border: medium outset ;
- padding: 1em }
-
-div.admonition p.admonition-title, div.hint p.admonition-title,
-div.important p.admonition-title, div.note p.admonition-title,
-div.tip p.admonition-title {
- font-weight: bold ;
- font-family: sans-serif }
-
-div.attention p.admonition-title, div.caution p.admonition-title,
-div.danger p.admonition-title, div.error p.admonition-title,
-div.warning p.admonition-title {
- color: red ;
- font-weight: bold ;
- font-family: sans-serif }
-
-/* Uncomment (and remove this text!) to get reduced vertical space in
- compound paragraphs.
-div.compound .compound-first, div.compound .compound-middle {
- margin-bottom: 0.5em }
-
-div.compound .compound-last, div.compound .compound-middle {
- margin-top: 0.5em }
-*/
-
-div.dedication {
- margin: 2em 5em ;
- text-align: center ;
- font-style: italic }
-
-div.dedication p.topic-title {
- font-weight: bold ;
- font-style: normal }
-
-div.figure {
- margin-left: 2em ;
- margin-right: 2em }
-
-div.footer, div.header {
- clear: both;
- font-size: smaller }
-
-div.line-block {
- display: block ;
- margin-top: 1em ;
- margin-bottom: 1em }
-
-div.line-block div.line-block {
- margin-top: 0 ;
- margin-bottom: 0 ;
- margin-left: 1.5em }
-
-div.sidebar {
- margin-left: 1em ;
- border: medium outset ;
- padding: 1em ;
- background-color: #ffffee ;
- width: 40% ;
- float: right ;
- clear: right }
-
-div.sidebar p.rubric {
- font-family: sans-serif ;
- font-size: medium }
-
-div.system-messages {
- margin: 5em }
-
-div.system-messages h1 {
- color: red }
-
-div.system-message {
- border: medium outset ;
- padding: 1em }
-
-div.system-message p.system-message-title {
- color: red ;
- font-weight: bold }
-
-div.topic {
- margin: 2em }
-
-h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
-h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
- margin-top: 0.4em }
-
-h1.title {
- text-align: center }
-
-h2.subtitle {
- text-align: center }
-
-hr.docutils {
- width: 75% }
-
-img.align-left {
- clear: left }
-
-img.align-right {
- clear: right }
-
-ol.simple, ul.simple {
- margin-bottom: 1em }
-
-ol.arabic {
- list-style: decimal }
-
-ol.loweralpha {
- list-style: lower-alpha }
-
-ol.upperalpha {
- list-style: upper-alpha }
-
-ol.lowerroman {
- list-style: lower-roman }
-
-ol.upperroman {
- list-style: upper-roman }
-
-p.attribution {
- text-align: right ;
- margin-left: 50% }
-
-p.caption {
- font-style: italic }
-
-p.credits {
- font-style: italic ;
- font-size: smaller }
-
-p.label {
- white-space: nowrap }
-
-p.rubric {
- font-weight: bold ;
- font-size: larger ;
- color: maroon ;
- text-align: center }
-
-p.sidebar-title {
- font-family: sans-serif ;
- font-weight: bold ;
- font-size: larger }
-
-p.sidebar-subtitle {
- font-family: sans-serif ;
- font-weight: bold }
-
-p.topic-title {
- font-weight: bold }
-
-pre.address {
- margin-bottom: 0 ;
- margin-top: 0 ;
- font-family: serif ;
- font-size: 100% }
-
-pre.literal-block, pre.doctest-block {
- margin-left: 2em ;
- margin-right: 2em }
-
-span.classifier {
- font-family: sans-serif ;
- font-style: oblique }
-
-span.classifier-delimiter {
- font-family: sans-serif ;
- font-weight: bold }
-
-span.interpreted {
- font-family: sans-serif }
-
-span.option {
- white-space: nowrap }
-
-span.pre {
- white-space: pre }
-
-span.problematic {
- color: red }
-
-span.section-subtitle {
- /* font-size relative to parent (h1..h6 element) */
- font-size: 80% }
-
-table.citation {
- border-left: solid 1px gray;
- margin-left: 1px }
-
-table.docinfo {
- margin: 2em 4em }
-
-table.docutils {
- margin-top: 0.5em ;
- margin-bottom: 0.5em }
-
-table.footnote {
- border-left: solid 1px black;
- margin-left: 1px }
-
-table.docutils td, table.docutils th,
-table.docinfo td, table.docinfo th {
- padding-left: 0.5em ;
- padding-right: 0.5em ;
- vertical-align: top }
-
-table.docutils th.field-name, table.docinfo th.docinfo-name {
- font-weight: bold ;
- text-align: left ;
- white-space: nowrap ;
- padding-left: 0 }
-
-h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
-h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
- font-size: 100% }
-
-ul.auto-toc {
- list-style-type: none }
Deleted: trunk/libs/msm/doc/HTML/examples/SC Composite.cpp
==============================================================================
--- trunk/libs/msm/doc/HTML/examples/SC Composite.cpp 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
+++ (empty file)
@@ -1,207 +0,0 @@
-// Copyright 2010 Christophe Henry
-// henry UNDERSCORE christophe AT hotmail DOT com
-// This is an extended version of the state machine available in the boost::mpl library
-// Distributed under the same license as the original.
-// Copyright for the original version:
-// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
-// under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include <boost/statechart/event.hpp>
-#include <boost/statechart/state_machine.hpp>
-#include <boost/statechart/simple_state.hpp>
-#include <boost/statechart/transition.hpp>
-#include "boost/mpl/list.hpp"
-
-#include <vector>
-
-#include <iostream>
-#ifdef WIN32
-#include "windows.h"
-#else
-#include <sys/time.h>
-#endif
-
-namespace sc = boost::statechart;
-namespace mpl = boost::mpl;
-
-namespace test_sc
-{
-
- //events
- struct play : sc::event< play > {};
- struct end_pause : sc::event< end_pause > {};
- struct stop : sc::event< stop > {};
- struct pause : sc::event< pause > {};
- struct open_close : sc::event< open_close > {};
- struct cd_detected : sc::event< cd_detected > {};
- struct NextSong: sc::event< NextSong > {};
- struct PreviousSong : sc::event< PreviousSong >{};
-
- struct Empty;
- struct Open;
- struct Stopped;
- struct Playing;
- struct Paused;
- // SM
- struct player : sc::state_machine< player, Empty >
- {
- void open_drawer(open_close const&) { /*std::cout << "player::open_drawer\n";*/ }
- void store_cd_info(cd_detected const& cd) {/*std::cout << "player::store_cd_info\n";*/ }
- void close_drawer(open_close const&) { /*std::cout << "player::close_drawer\n";*/ }
- void start_playback(play const&) { /*std::cout << "player::start_playback\n";*/ }
- void stopped_again(stop const&) {/*std::cout << "player::stopped_again\n";*/}
- void stop_playback(stop const&) { /*std::cout << "player::stop_playback\n";*/ }
- void pause_playback(pause const&) { /*std::cout << "player::pause_playback\n"; */}
- void stop_and_open(open_close const&) { /*std::cout << "player::stop_and_open\n";*/ }
- void resume_playback(end_pause const&) { /*std::cout << "player::resume_playback\n";*/ }
- };
-
- struct Empty : sc::simple_state< Empty, player >
- {
- Empty() { /*std::cout << "entering Empty" << std::endl;*/ } // entry
- ~Empty() { /*std::cout << "leaving Empty" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< open_close, Open,
- player, &player::open_drawer >,
- sc::transition< cd_detected, Stopped,
- player, &player::store_cd_info > > reactions;
-
- };
- struct Open : sc::simple_state< Open, player >
- {
- Open() { /*std::cout << "entering Open" << std::endl;*/ } // entry
- ~Open() { /*std::cout << "leaving Open" << std::endl;*/ } // exit
- typedef sc::transition< open_close, Empty,
- player, &player::close_drawer > reactions;
-
- };
- struct Stopped : sc::simple_state< Stopped, player >
- {
- Stopped() { /*std::cout << "entering Stopped" << std::endl;*/ } // entry
- ~Stopped() { /*std::cout << "leaving Stopped" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< play, Playing,
- player, &player::start_playback >,
- sc::transition< open_close, Open,
- player, &player::open_drawer >,
- sc::transition< stop, Stopped,
- player, &player::stopped_again > > reactions;
-
- };
- struct Song1;
- struct Playing : sc::simple_state< Playing, player,Song1 >
- {
- Playing() { /*std::cout << "entering Playing" << std::endl;*/ } // entry
- ~Playing() { /*std::cout << "leaving Playing" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< stop, Stopped,
- player, &player::stop_playback >,
- sc::transition< pause, Paused,
- player, &player::pause_playback >,
- sc::transition< open_close, Open,
- player, &player::stop_and_open > > reactions;
- void start_next_song(NextSong const&) { /*std::cout << "Playing::start_next_song\n";*/ }
- void start_prev_song(PreviousSong const&) { /*std::cout << "Playing::start_prev_song\n";*/ }
- };
- struct Song2;
- struct Song1 : sc::simple_state< Song1, Playing >
- {
- Song1() { /*std::cout << "entering Song1" << std::endl;*/ } // entry
- ~Song1() { /*std::cout << "leaving Song1" << std::endl;*/ } // exit
- typedef sc::transition< NextSong, Song2,
- Playing, &Playing::start_next_song > reactions;
- };
- struct Song3;
- struct Song2 : sc::simple_state< Song2, Playing >
- {
- Song2() { /*std::cout << "entering Song2" << std::endl;*/ } // entry
- ~Song2() { /*std::cout << "leaving Song2" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< NextSong, Song3,
- Playing, &Playing::start_next_song >,
- sc::transition< PreviousSong, Song1,
- Playing, &Playing::start_prev_song > > reactions;
- };
- struct Song3 : sc::simple_state< Song3, Playing >
- {
- Song3() { /*std::cout << "entering Song3" << std::endl;*/ } // entry
- ~Song3() { /*std::cout << "leaving Song3" << std::endl;*/ } // exit
- typedef sc::transition< PreviousSong, Song2,
- Playing, &Playing::start_prev_song > reactions;
- };
- struct Paused : sc::simple_state< Paused, player >
- {
- Paused() { /*std::cout << "entering Paused" << std::endl;*/ } // entry
- ~Paused() { /*std::cout << "leaving Paused" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< end_pause, Playing,
- player, &player::resume_playback >,
- sc::transition< stop, Stopped,
- player, &player::stop_playback >,
- sc::transition< open_close, Open,
- player, &player::stop_and_open > > reactions;
- };
-}
-
-
-#ifndef WIN32
-long mtime(struct timeval& tv1,struct timeval& tv2)
-{
- return (tv2.tv_sec-tv1.tv_sec) *1000000 + ((tv2.tv_usec-tv1.tv_usec));
-}
-#endif
-
-int main()
-{
- test_sc::player p;
- p.initiate();
- // for timing
-#ifdef WIN32
- LARGE_INTEGER res;
- ::QueryPerformanceFrequency(&res);
- LARGE_INTEGER li,li2;
- ::QueryPerformanceCounter(&li);
-#else
- struct timeval tv1,tv2;
- gettimeofday(&tv1,NULL);
-#endif
-
- for (int i=0;i<100;++i)
- {
- p.process_event(test_sc::open_close());
- p.process_event(test_sc::open_close());
- p.process_event(test_sc::cd_detected());
- p.process_event(test_sc::play());
- for (int j=0;j<100;++j)
- {
- p.process_event(test_sc::NextSong());
- p.process_event(test_sc::NextSong());
- p.process_event(test_sc::PreviousSong());
- p.process_event(test_sc::PreviousSong());
- }
-
- p.process_event(test_sc::pause());
- // go back to Playing
- p.process_event(test_sc::end_pause());
- p.process_event(test_sc::pause());
- p.process_event(test_sc::stop());
- // event leading to the same state
- p.process_event(test_sc::stop());
- p.process_event(test_sc::open_close());
- p.process_event(test_sc::open_close());
- }
-#ifdef WIN32
- ::QueryPerformanceCounter(&li2);
-#else
- gettimeofday(&tv2,NULL);
-#endif
-#ifdef WIN32
- std::cout << "sc took in s:" << (double)(li2.QuadPart-li.QuadPart)/res.QuadPart <<"\n" <<std::endl;
-#else
- std::cout << "sc took in us:" << mtime(tv1,tv2) <<"\n" <<std::endl;
-#endif
- return 0;
-}
-
Deleted: trunk/libs/msm/doc/HTML/examples/SC Simple.cpp
==============================================================================
--- trunk/libs/msm/doc/HTML/examples/SC Simple.cpp 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
+++ (empty file)
@@ -1,169 +0,0 @@
-// Copyright 2010 Christophe Henry
-// henry UNDERSCORE christophe AT hotmail DOT com
-// This is an extended version of the state machine available in the boost::mpl library
-// Distributed under the same license as the original.
-// Copyright for the original version:
-// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
-// under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include <boost/statechart/event.hpp>
-#include <boost/statechart/state_machine.hpp>
-#include <boost/statechart/simple_state.hpp>
-#include <boost/statechart/transition.hpp>
-#include "boost/mpl/list.hpp"
-
-#include <vector>
-
-#include <iostream>
-#ifdef WIN32
-#include "windows.h"
-#else
-#include <sys/time.h>
-#endif
-
-namespace sc = boost::statechart;
-namespace mpl = boost::mpl;
-
-namespace test_sc
-{
-
- //events
- struct play : sc::event< play > {};
- struct end_pause : sc::event< end_pause > {};
- struct stop : sc::event< stop > {};
- struct pause : sc::event< pause > {};
- struct open_close : sc::event< open_close > {};
- struct cd_detected : sc::event< cd_detected > {};
-
-
- struct Empty;
- struct Open;
- struct Stopped;
- struct Playing;
- struct Paused;
- // SM
- struct player : sc::state_machine< player, Empty >
- {
- void open_drawer(open_close const&) { /*std::cout << "player::open_drawer\n";*/ }
- void store_cd_info(cd_detected const& cd) {/*std::cout << "player::store_cd_info\n";*/ }
- void close_drawer(open_close const&) { /*std::cout << "player::close_drawer\n";*/ }
- void start_playback(play const&) { /*std::cout << "player::start_playback\n";*/ }
- void stopped_again(stop const&) {/*std::cout << "player::stopped_again\n";*/}
- void stop_playback(stop const&) { /*std::cout << "player::stop_playback\n";*/ }
- void pause_playback(pause const&) { /*std::cout << "player::pause_playback\n"; */}
- void stop_and_open(open_close const&) { /*std::cout << "player::stop_and_open\n";*/ }
- void resume_playback(end_pause const&) { /*std::cout << "player::resume_playback\n";*/ }
- };
-
- struct Empty : sc::simple_state< Empty, player >
- {
- Empty() { /*std::cout << "entering Empty" << std::endl;*/ } // entry
- ~Empty() { /*std::cout << "leaving Empty" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< open_close, Open,
- player, &player::open_drawer >,
- sc::transition< cd_detected, Stopped,
- player, &player::store_cd_info > > reactions;
-
- };
- struct Open : sc::simple_state< Open, player >
- {
- Open() { /*std::cout << "entering Open" << std::endl;*/ } // entry
- ~Open() { /*std::cout << "leaving Open" << std::endl;*/ } // exit
- typedef sc::transition< open_close, Empty,
- player, &player::close_drawer > reactions;
-
- };
- struct Stopped : sc::simple_state< Stopped, player >
- {
- Stopped() { /*std::cout << "entering Stopped" << std::endl;*/ } // entry
- ~Stopped() { /*std::cout << "leaving Stopped" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< play, Playing,
- player, &player::start_playback >,
- sc::transition< open_close, Open,
- player, &player::open_drawer >,
- sc::transition< stop, Stopped,
- player, &player::stopped_again > > reactions;
-
- };
- struct Playing : sc::simple_state< Playing, player >
- {
- Playing() { /*std::cout << "entering Playing" << std::endl;*/ } // entry
- ~Playing() { /*std::cout << "leaving Playing" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< stop, Stopped,
- player, &player::stop_playback >,
- sc::transition< pause, Paused,
- player, &player::pause_playback >,
- sc::transition< open_close, Open,
- player, &player::stop_and_open > > reactions;
- };
- struct Paused : sc::simple_state< Paused, player >
- {
- Paused() { /*std::cout << "entering Paused" << std::endl;*/ } // entry
- ~Paused() { /*std::cout << "leaving Paused" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< end_pause, Playing,
- player, &player::resume_playback >,
- sc::transition< stop, Stopped,
- player, &player::stop_playback >,
- sc::transition< open_close, Open,
- player, &player::stop_and_open > > reactions;
- };
-}
-
-
-#ifndef WIN32
-long mtime(struct timeval& tv1,struct timeval& tv2)
-{
- return (tv2.tv_sec-tv1.tv_sec) *1000000 + ((tv2.tv_usec-tv1.tv_usec));
-}
-#endif
-
-
-int main()
-{
- test_sc::player p;
- p.initiate();
- // for timing
-#ifdef WIN32
- LARGE_INTEGER res;
- ::QueryPerformanceFrequency(&res);
- LARGE_INTEGER li,li2;
- ::QueryPerformanceCounter(&li);
-#else
- struct timeval tv1,tv2;
- gettimeofday(&tv1,NULL);
-#endif
- for (int i=0;i<100;++i)
- {
- p.process_event(test_sc::open_close());
- p.process_event(test_sc::open_close());
- p.process_event(test_sc::cd_detected());
- p.process_event(test_sc::play());
- p.process_event(test_sc::pause());
- // go back to Playing
- p.process_event(test_sc::end_pause());
- p.process_event(test_sc::pause());
- p.process_event(test_sc::stop());
- // event leading to the same state
- p.process_event(test_sc::stop());
- p.process_event(test_sc::open_close());
- p.process_event(test_sc::open_close());
- }
-#ifdef WIN32
- ::QueryPerformanceCounter(&li2);
-#else
- gettimeofday(&tv2,NULL);
-#endif
-#ifdef WIN32
- std::cout << "sc took in s:" << (double)(li2.QuadPart-li.QuadPart)/res.QuadPart <<"\n" <<std::endl;
-#else
- std::cout << "sc took in us:" << mtime(tv1,tv2) <<"\n" <<std::endl;
-#endif
- return 0;
-}
-
Added: trunk/libs/msm/doc/HTML/examples/SCComposite.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/msm/doc/HTML/examples/SCComposite.cpp 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
@@ -0,0 +1,207 @@
+// Copyright 2010 Christophe Henry
+// henry UNDERSCORE christophe AT hotmail DOT com
+// This is an extended version of the state machine available in the boost::mpl library
+// Distributed under the same license as the original.
+// Copyright for the original version:
+// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
+// under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/statechart/event.hpp>
+#include <boost/statechart/state_machine.hpp>
+#include <boost/statechart/simple_state.hpp>
+#include <boost/statechart/transition.hpp>
+#include "boost/mpl/list.hpp"
+
+#include <vector>
+
+#include <iostream>
+#ifdef WIN32
+#include "windows.h"
+#else
+#include <sys/time.h>
+#endif
+
+namespace sc = boost::statechart;
+namespace mpl = boost::mpl;
+
+namespace test_sc
+{
+
+ //events
+ struct play : sc::event< play > {};
+ struct end_pause : sc::event< end_pause > {};
+ struct stop : sc::event< stop > {};
+ struct pause : sc::event< pause > {};
+ struct open_close : sc::event< open_close > {};
+ struct cd_detected : sc::event< cd_detected > {};
+ struct NextSong: sc::event< NextSong > {};
+ struct PreviousSong : sc::event< PreviousSong >{};
+
+ struct Empty;
+ struct Open;
+ struct Stopped;
+ struct Playing;
+ struct Paused;
+ // SM
+ struct player : sc::state_machine< player, Empty >
+ {
+ void open_drawer(open_close const&) { /*std::cout << "player::open_drawer\n";*/ }
+ void store_cd_info(cd_detected const& cd) {/*std::cout << "player::store_cd_info\n";*/ }
+ void close_drawer(open_close const&) { /*std::cout << "player::close_drawer\n";*/ }
+ void start_playback(play const&) { /*std::cout << "player::start_playback\n";*/ }
+ void stopped_again(stop const&) {/*std::cout << "player::stopped_again\n";*/}
+ void stop_playback(stop const&) { /*std::cout << "player::stop_playback\n";*/ }
+ void pause_playback(pause const&) { /*std::cout << "player::pause_playback\n"; */}
+ void stop_and_open(open_close const&) { /*std::cout << "player::stop_and_open\n";*/ }
+ void resume_playback(end_pause const&) { /*std::cout << "player::resume_playback\n";*/ }
+ };
+
+ struct Empty : sc::simple_state< Empty, player >
+ {
+ Empty() { /*std::cout << "entering Empty" << std::endl;*/ } // entry
+ ~Empty() { /*std::cout << "leaving Empty" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< open_close, Open,
+ player, &player::open_drawer >,
+ sc::transition< cd_detected, Stopped,
+ player, &player::store_cd_info > > reactions;
+
+ };
+ struct Open : sc::simple_state< Open, player >
+ {
+ Open() { /*std::cout << "entering Open" << std::endl;*/ } // entry
+ ~Open() { /*std::cout << "leaving Open" << std::endl;*/ } // exit
+ typedef sc::transition< open_close, Empty,
+ player, &player::close_drawer > reactions;
+
+ };
+ struct Stopped : sc::simple_state< Stopped, player >
+ {
+ Stopped() { /*std::cout << "entering Stopped" << std::endl;*/ } // entry
+ ~Stopped() { /*std::cout << "leaving Stopped" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< play, Playing,
+ player, &player::start_playback >,
+ sc::transition< open_close, Open,
+ player, &player::open_drawer >,
+ sc::transition< stop, Stopped,
+ player, &player::stopped_again > > reactions;
+
+ };
+ struct Song1;
+ struct Playing : sc::simple_state< Playing, player,Song1 >
+ {
+ Playing() { /*std::cout << "entering Playing" << std::endl;*/ } // entry
+ ~Playing() { /*std::cout << "leaving Playing" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< stop, Stopped,
+ player, &player::stop_playback >,
+ sc::transition< pause, Paused,
+ player, &player::pause_playback >,
+ sc::transition< open_close, Open,
+ player, &player::stop_and_open > > reactions;
+ void start_next_song(NextSong const&) { /*std::cout << "Playing::start_next_song\n";*/ }
+ void start_prev_song(PreviousSong const&) { /*std::cout << "Playing::start_prev_song\n";*/ }
+ };
+ struct Song2;
+ struct Song1 : sc::simple_state< Song1, Playing >
+ {
+ Song1() { /*std::cout << "entering Song1" << std::endl;*/ } // entry
+ ~Song1() { /*std::cout << "leaving Song1" << std::endl;*/ } // exit
+ typedef sc::transition< NextSong, Song2,
+ Playing, &Playing::start_next_song > reactions;
+ };
+ struct Song3;
+ struct Song2 : sc::simple_state< Song2, Playing >
+ {
+ Song2() { /*std::cout << "entering Song2" << std::endl;*/ } // entry
+ ~Song2() { /*std::cout << "leaving Song2" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< NextSong, Song3,
+ Playing, &Playing::start_next_song >,
+ sc::transition< PreviousSong, Song1,
+ Playing, &Playing::start_prev_song > > reactions;
+ };
+ struct Song3 : sc::simple_state< Song3, Playing >
+ {
+ Song3() { /*std::cout << "entering Song3" << std::endl;*/ } // entry
+ ~Song3() { /*std::cout << "leaving Song3" << std::endl;*/ } // exit
+ typedef sc::transition< PreviousSong, Song2,
+ Playing, &Playing::start_prev_song > reactions;
+ };
+ struct Paused : sc::simple_state< Paused, player >
+ {
+ Paused() { /*std::cout << "entering Paused" << std::endl;*/ } // entry
+ ~Paused() { /*std::cout << "leaving Paused" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< end_pause, Playing,
+ player, &player::resume_playback >,
+ sc::transition< stop, Stopped,
+ player, &player::stop_playback >,
+ sc::transition< open_close, Open,
+ player, &player::stop_and_open > > reactions;
+ };
+}
+
+
+#ifndef WIN32
+long mtime(struct timeval& tv1,struct timeval& tv2)
+{
+ return (tv2.tv_sec-tv1.tv_sec) *1000000 + ((tv2.tv_usec-tv1.tv_usec));
+}
+#endif
+
+int main()
+{
+ test_sc::player p;
+ p.initiate();
+ // for timing
+#ifdef WIN32
+ LARGE_INTEGER res;
+ ::QueryPerformanceFrequency(&res);
+ LARGE_INTEGER li,li2;
+ ::QueryPerformanceCounter(&li);
+#else
+ struct timeval tv1,tv2;
+ gettimeofday(&tv1,NULL);
+#endif
+
+ for (int i=0;i<100;++i)
+ {
+ p.process_event(test_sc::open_close());
+ p.process_event(test_sc::open_close());
+ p.process_event(test_sc::cd_detected());
+ p.process_event(test_sc::play());
+ for (int j=0;j<100;++j)
+ {
+ p.process_event(test_sc::NextSong());
+ p.process_event(test_sc::NextSong());
+ p.process_event(test_sc::PreviousSong());
+ p.process_event(test_sc::PreviousSong());
+ }
+
+ p.process_event(test_sc::pause());
+ // go back to Playing
+ p.process_event(test_sc::end_pause());
+ p.process_event(test_sc::pause());
+ p.process_event(test_sc::stop());
+ // event leading to the same state
+ p.process_event(test_sc::stop());
+ p.process_event(test_sc::open_close());
+ p.process_event(test_sc::open_close());
+ }
+#ifdef WIN32
+ ::QueryPerformanceCounter(&li2);
+#else
+ gettimeofday(&tv2,NULL);
+#endif
+#ifdef WIN32
+ std::cout << "sc took in s:" << (double)(li2.QuadPart-li.QuadPart)/res.QuadPart <<"\n" <<std::endl;
+#else
+ std::cout << "sc took in us:" << mtime(tv1,tv2) <<"\n" <<std::endl;
+#endif
+ return 0;
+}
+
Added: trunk/libs/msm/doc/HTML/examples/SCSimple.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/msm/doc/HTML/examples/SCSimple.cpp 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
@@ -0,0 +1,169 @@
+// Copyright 2010 Christophe Henry
+// henry UNDERSCORE christophe AT hotmail DOT com
+// This is an extended version of the state machine available in the boost::mpl library
+// Distributed under the same license as the original.
+// Copyright for the original version:
+// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
+// under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/statechart/event.hpp>
+#include <boost/statechart/state_machine.hpp>
+#include <boost/statechart/simple_state.hpp>
+#include <boost/statechart/transition.hpp>
+#include "boost/mpl/list.hpp"
+
+#include <vector>
+
+#include <iostream>
+#ifdef WIN32
+#include "windows.h"
+#else
+#include <sys/time.h>
+#endif
+
+namespace sc = boost::statechart;
+namespace mpl = boost::mpl;
+
+namespace test_sc
+{
+
+ //events
+ struct play : sc::event< play > {};
+ struct end_pause : sc::event< end_pause > {};
+ struct stop : sc::event< stop > {};
+ struct pause : sc::event< pause > {};
+ struct open_close : sc::event< open_close > {};
+ struct cd_detected : sc::event< cd_detected > {};
+
+
+ struct Empty;
+ struct Open;
+ struct Stopped;
+ struct Playing;
+ struct Paused;
+ // SM
+ struct player : sc::state_machine< player, Empty >
+ {
+ void open_drawer(open_close const&) { /*std::cout << "player::open_drawer\n";*/ }
+ void store_cd_info(cd_detected const& cd) {/*std::cout << "player::store_cd_info\n";*/ }
+ void close_drawer(open_close const&) { /*std::cout << "player::close_drawer\n";*/ }
+ void start_playback(play const&) { /*std::cout << "player::start_playback\n";*/ }
+ void stopped_again(stop const&) {/*std::cout << "player::stopped_again\n";*/}
+ void stop_playback(stop const&) { /*std::cout << "player::stop_playback\n";*/ }
+ void pause_playback(pause const&) { /*std::cout << "player::pause_playback\n"; */}
+ void stop_and_open(open_close const&) { /*std::cout << "player::stop_and_open\n";*/ }
+ void resume_playback(end_pause const&) { /*std::cout << "player::resume_playback\n";*/ }
+ };
+
+ struct Empty : sc::simple_state< Empty, player >
+ {
+ Empty() { /*std::cout << "entering Empty" << std::endl;*/ } // entry
+ ~Empty() { /*std::cout << "leaving Empty" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< open_close, Open,
+ player, &player::open_drawer >,
+ sc::transition< cd_detected, Stopped,
+ player, &player::store_cd_info > > reactions;
+
+ };
+ struct Open : sc::simple_state< Open, player >
+ {
+ Open() { /*std::cout << "entering Open" << std::endl;*/ } // entry
+ ~Open() { /*std::cout << "leaving Open" << std::endl;*/ } // exit
+ typedef sc::transition< open_close, Empty,
+ player, &player::close_drawer > reactions;
+
+ };
+ struct Stopped : sc::simple_state< Stopped, player >
+ {
+ Stopped() { /*std::cout << "entering Stopped" << std::endl;*/ } // entry
+ ~Stopped() { /*std::cout << "leaving Stopped" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< play, Playing,
+ player, &player::start_playback >,
+ sc::transition< open_close, Open,
+ player, &player::open_drawer >,
+ sc::transition< stop, Stopped,
+ player, &player::stopped_again > > reactions;
+
+ };
+ struct Playing : sc::simple_state< Playing, player >
+ {
+ Playing() { /*std::cout << "entering Playing" << std::endl;*/ } // entry
+ ~Playing() { /*std::cout << "leaving Playing" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< stop, Stopped,
+ player, &player::stop_playback >,
+ sc::transition< pause, Paused,
+ player, &player::pause_playback >,
+ sc::transition< open_close, Open,
+ player, &player::stop_and_open > > reactions;
+ };
+ struct Paused : sc::simple_state< Paused, player >
+ {
+ Paused() { /*std::cout << "entering Paused" << std::endl;*/ } // entry
+ ~Paused() { /*std::cout << "leaving Paused" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< end_pause, Playing,
+ player, &player::resume_playback >,
+ sc::transition< stop, Stopped,
+ player, &player::stop_playback >,
+ sc::transition< open_close, Open,
+ player, &player::stop_and_open > > reactions;
+ };
+}
+
+
+#ifndef WIN32
+long mtime(struct timeval& tv1,struct timeval& tv2)
+{
+ return (tv2.tv_sec-tv1.tv_sec) *1000000 + ((tv2.tv_usec-tv1.tv_usec));
+}
+#endif
+
+
+int main()
+{
+ test_sc::player p;
+ p.initiate();
+ // for timing
+#ifdef WIN32
+ LARGE_INTEGER res;
+ ::QueryPerformanceFrequency(&res);
+ LARGE_INTEGER li,li2;
+ ::QueryPerformanceCounter(&li);
+#else
+ struct timeval tv1,tv2;
+ gettimeofday(&tv1,NULL);
+#endif
+ for (int i=0;i<100;++i)
+ {
+ p.process_event(test_sc::open_close());
+ p.process_event(test_sc::open_close());
+ p.process_event(test_sc::cd_detected());
+ p.process_event(test_sc::play());
+ p.process_event(test_sc::pause());
+ // go back to Playing
+ p.process_event(test_sc::end_pause());
+ p.process_event(test_sc::pause());
+ p.process_event(test_sc::stop());
+ // event leading to the same state
+ p.process_event(test_sc::stop());
+ p.process_event(test_sc::open_close());
+ p.process_event(test_sc::open_close());
+ }
+#ifdef WIN32
+ ::QueryPerformanceCounter(&li2);
+#else
+ gettimeofday(&tv2,NULL);
+#endif
+#ifdef WIN32
+ std::cout << "sc took in s:" << (double)(li2.QuadPart-li.QuadPart)/res.QuadPart <<"\n" <<std::endl;
+#else
+ std::cout << "sc took in us:" << mtime(tv1,tv2) <<"\n" <<std::endl;
+#endif
+ return 0;
+}
+
Deleted: trunk/libs/msm/doc/HTML/minimal.css
==============================================================================
--- trunk/libs/msm/doc/HTML/minimal.css 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
+++ (empty file)
@@ -1,29 +0,0 @@
-/*
-
- © Copyright Beman Dawes, 2007
-
- Distributed under the Boost Software License, Version 1.0.
- See www.boost.org/LICENSE_1_0.txt
-
-*/
-
-/*******************************************************************************
- Body
-*******************************************************************************/
-
-body { font-family: sans-serif; margin: 1em; }
-
-/*******************************************************************************
- Table
-*******************************************************************************/
-
-table { margin: 0.5em; }
-
-/*******************************************************************************
- Font sizes
-*******************************************************************************/
-
-p, td, li, blockquote { font-size: 10pt; }
-pre { font-size: 9pt; }
-
-/*** end ***/
\ No newline at end of file
Deleted: trunk/libs/msm/doc/HTML/reference.css
==============================================================================
--- trunk/libs/msm/doc/HTML/reference.css 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
+++ (empty file)
@@ -1,11 +0,0 @@
-/*============================================================================
- Copyright 2003-2004 Douglas Gregor
- Distributed under the Boost Software License, Version 1.0. (See accompany-
- ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-============================================================================*/
-
-PRE.synopsis {
- background-color: #e0ffff;
- border: thin solid blue;
- padding: 1em
-}
\ No newline at end of file
Deleted: trunk/libs/msm/doc/PDF/examples/SC Composite.cpp
==============================================================================
--- trunk/libs/msm/doc/PDF/examples/SC Composite.cpp 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
+++ (empty file)
@@ -1,207 +0,0 @@
-// Copyright 2010 Christophe Henry
-// henry UNDERSCORE christophe AT hotmail DOT com
-// This is an extended version of the state machine available in the boost::mpl library
-// Distributed under the same license as the original.
-// Copyright for the original version:
-// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
-// under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include <boost/statechart/event.hpp>
-#include <boost/statechart/state_machine.hpp>
-#include <boost/statechart/simple_state.hpp>
-#include <boost/statechart/transition.hpp>
-#include "boost/mpl/list.hpp"
-
-#include <vector>
-
-#include <iostream>
-#ifdef WIN32
-#include "windows.h"
-#else
-#include <sys/time.h>
-#endif
-
-namespace sc = boost::statechart;
-namespace mpl = boost::mpl;
-
-namespace test_sc
-{
-
- //events
- struct play : sc::event< play > {};
- struct end_pause : sc::event< end_pause > {};
- struct stop : sc::event< stop > {};
- struct pause : sc::event< pause > {};
- struct open_close : sc::event< open_close > {};
- struct cd_detected : sc::event< cd_detected > {};
- struct NextSong: sc::event< NextSong > {};
- struct PreviousSong : sc::event< PreviousSong >{};
-
- struct Empty;
- struct Open;
- struct Stopped;
- struct Playing;
- struct Paused;
- // SM
- struct player : sc::state_machine< player, Empty >
- {
- void open_drawer(open_close const&) { /*std::cout << "player::open_drawer\n";*/ }
- void store_cd_info(cd_detected const& cd) {/*std::cout << "player::store_cd_info\n";*/ }
- void close_drawer(open_close const&) { /*std::cout << "player::close_drawer\n";*/ }
- void start_playback(play const&) { /*std::cout << "player::start_playback\n";*/ }
- void stopped_again(stop const&) {/*std::cout << "player::stopped_again\n";*/}
- void stop_playback(stop const&) { /*std::cout << "player::stop_playback\n";*/ }
- void pause_playback(pause const&) { /*std::cout << "player::pause_playback\n"; */}
- void stop_and_open(open_close const&) { /*std::cout << "player::stop_and_open\n";*/ }
- void resume_playback(end_pause const&) { /*std::cout << "player::resume_playback\n";*/ }
- };
-
- struct Empty : sc::simple_state< Empty, player >
- {
- Empty() { /*std::cout << "entering Empty" << std::endl;*/ } // entry
- ~Empty() { /*std::cout << "leaving Empty" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< open_close, Open,
- player, &player::open_drawer >,
- sc::transition< cd_detected, Stopped,
- player, &player::store_cd_info > > reactions;
-
- };
- struct Open : sc::simple_state< Open, player >
- {
- Open() { /*std::cout << "entering Open" << std::endl;*/ } // entry
- ~Open() { /*std::cout << "leaving Open" << std::endl;*/ } // exit
- typedef sc::transition< open_close, Empty,
- player, &player::close_drawer > reactions;
-
- };
- struct Stopped : sc::simple_state< Stopped, player >
- {
- Stopped() { /*std::cout << "entering Stopped" << std::endl;*/ } // entry
- ~Stopped() { /*std::cout << "leaving Stopped" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< play, Playing,
- player, &player::start_playback >,
- sc::transition< open_close, Open,
- player, &player::open_drawer >,
- sc::transition< stop, Stopped,
- player, &player::stopped_again > > reactions;
-
- };
- struct Song1;
- struct Playing : sc::simple_state< Playing, player,Song1 >
- {
- Playing() { /*std::cout << "entering Playing" << std::endl;*/ } // entry
- ~Playing() { /*std::cout << "leaving Playing" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< stop, Stopped,
- player, &player::stop_playback >,
- sc::transition< pause, Paused,
- player, &player::pause_playback >,
- sc::transition< open_close, Open,
- player, &player::stop_and_open > > reactions;
- void start_next_song(NextSong const&) { /*std::cout << "Playing::start_next_song\n";*/ }
- void start_prev_song(PreviousSong const&) { /*std::cout << "Playing::start_prev_song\n";*/ }
- };
- struct Song2;
- struct Song1 : sc::simple_state< Song1, Playing >
- {
- Song1() { /*std::cout << "entering Song1" << std::endl;*/ } // entry
- ~Song1() { /*std::cout << "leaving Song1" << std::endl;*/ } // exit
- typedef sc::transition< NextSong, Song2,
- Playing, &Playing::start_next_song > reactions;
- };
- struct Song3;
- struct Song2 : sc::simple_state< Song2, Playing >
- {
- Song2() { /*std::cout << "entering Song2" << std::endl;*/ } // entry
- ~Song2() { /*std::cout << "leaving Song2" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< NextSong, Song3,
- Playing, &Playing::start_next_song >,
- sc::transition< PreviousSong, Song1,
- Playing, &Playing::start_prev_song > > reactions;
- };
- struct Song3 : sc::simple_state< Song3, Playing >
- {
- Song3() { /*std::cout << "entering Song3" << std::endl;*/ } // entry
- ~Song3() { /*std::cout << "leaving Song3" << std::endl;*/ } // exit
- typedef sc::transition< PreviousSong, Song2,
- Playing, &Playing::start_prev_song > reactions;
- };
- struct Paused : sc::simple_state< Paused, player >
- {
- Paused() { /*std::cout << "entering Paused" << std::endl;*/ } // entry
- ~Paused() { /*std::cout << "leaving Paused" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< end_pause, Playing,
- player, &player::resume_playback >,
- sc::transition< stop, Stopped,
- player, &player::stop_playback >,
- sc::transition< open_close, Open,
- player, &player::stop_and_open > > reactions;
- };
-}
-
-
-#ifndef WIN32
-long mtime(struct timeval& tv1,struct timeval& tv2)
-{
- return (tv2.tv_sec-tv1.tv_sec) *1000000 + ((tv2.tv_usec-tv1.tv_usec));
-}
-#endif
-
-int main()
-{
- test_sc::player p;
- p.initiate();
- // for timing
-#ifdef WIN32
- LARGE_INTEGER res;
- ::QueryPerformanceFrequency(&res);
- LARGE_INTEGER li,li2;
- ::QueryPerformanceCounter(&li);
-#else
- struct timeval tv1,tv2;
- gettimeofday(&tv1,NULL);
-#endif
-
- for (int i=0;i<100;++i)
- {
- p.process_event(test_sc::open_close());
- p.process_event(test_sc::open_close());
- p.process_event(test_sc::cd_detected());
- p.process_event(test_sc::play());
- for (int j=0;j<100;++j)
- {
- p.process_event(test_sc::NextSong());
- p.process_event(test_sc::NextSong());
- p.process_event(test_sc::PreviousSong());
- p.process_event(test_sc::PreviousSong());
- }
-
- p.process_event(test_sc::pause());
- // go back to Playing
- p.process_event(test_sc::end_pause());
- p.process_event(test_sc::pause());
- p.process_event(test_sc::stop());
- // event leading to the same state
- p.process_event(test_sc::stop());
- p.process_event(test_sc::open_close());
- p.process_event(test_sc::open_close());
- }
-#ifdef WIN32
- ::QueryPerformanceCounter(&li2);
-#else
- gettimeofday(&tv2,NULL);
-#endif
-#ifdef WIN32
- std::cout << "sc took in s:" << (double)(li2.QuadPart-li.QuadPart)/res.QuadPart <<"\n" <<std::endl;
-#else
- std::cout << "sc took in us:" << mtime(tv1,tv2) <<"\n" <<std::endl;
-#endif
- return 0;
-}
-
Deleted: trunk/libs/msm/doc/PDF/examples/SC Simple.cpp
==============================================================================
--- trunk/libs/msm/doc/PDF/examples/SC Simple.cpp 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
+++ (empty file)
@@ -1,169 +0,0 @@
-// Copyright 2010 Christophe Henry
-// henry UNDERSCORE christophe AT hotmail DOT com
-// This is an extended version of the state machine available in the boost::mpl library
-// Distributed under the same license as the original.
-// Copyright for the original version:
-// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
-// under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include <boost/statechart/event.hpp>
-#include <boost/statechart/state_machine.hpp>
-#include <boost/statechart/simple_state.hpp>
-#include <boost/statechart/transition.hpp>
-#include "boost/mpl/list.hpp"
-
-#include <vector>
-
-#include <iostream>
-#ifdef WIN32
-#include "windows.h"
-#else
-#include <sys/time.h>
-#endif
-
-namespace sc = boost::statechart;
-namespace mpl = boost::mpl;
-
-namespace test_sc
-{
-
- //events
- struct play : sc::event< play > {};
- struct end_pause : sc::event< end_pause > {};
- struct stop : sc::event< stop > {};
- struct pause : sc::event< pause > {};
- struct open_close : sc::event< open_close > {};
- struct cd_detected : sc::event< cd_detected > {};
-
-
- struct Empty;
- struct Open;
- struct Stopped;
- struct Playing;
- struct Paused;
- // SM
- struct player : sc::state_machine< player, Empty >
- {
- void open_drawer(open_close const&) { /*std::cout << "player::open_drawer\n";*/ }
- void store_cd_info(cd_detected const& cd) {/*std::cout << "player::store_cd_info\n";*/ }
- void close_drawer(open_close const&) { /*std::cout << "player::close_drawer\n";*/ }
- void start_playback(play const&) { /*std::cout << "player::start_playback\n";*/ }
- void stopped_again(stop const&) {/*std::cout << "player::stopped_again\n";*/}
- void stop_playback(stop const&) { /*std::cout << "player::stop_playback\n";*/ }
- void pause_playback(pause const&) { /*std::cout << "player::pause_playback\n"; */}
- void stop_and_open(open_close const&) { /*std::cout << "player::stop_and_open\n";*/ }
- void resume_playback(end_pause const&) { /*std::cout << "player::resume_playback\n";*/ }
- };
-
- struct Empty : sc::simple_state< Empty, player >
- {
- Empty() { /*std::cout << "entering Empty" << std::endl;*/ } // entry
- ~Empty() { /*std::cout << "leaving Empty" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< open_close, Open,
- player, &player::open_drawer >,
- sc::transition< cd_detected, Stopped,
- player, &player::store_cd_info > > reactions;
-
- };
- struct Open : sc::simple_state< Open, player >
- {
- Open() { /*std::cout << "entering Open" << std::endl;*/ } // entry
- ~Open() { /*std::cout << "leaving Open" << std::endl;*/ } // exit
- typedef sc::transition< open_close, Empty,
- player, &player::close_drawer > reactions;
-
- };
- struct Stopped : sc::simple_state< Stopped, player >
- {
- Stopped() { /*std::cout << "entering Stopped" << std::endl;*/ } // entry
- ~Stopped() { /*std::cout << "leaving Stopped" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< play, Playing,
- player, &player::start_playback >,
- sc::transition< open_close, Open,
- player, &player::open_drawer >,
- sc::transition< stop, Stopped,
- player, &player::stopped_again > > reactions;
-
- };
- struct Playing : sc::simple_state< Playing, player >
- {
- Playing() { /*std::cout << "entering Playing" << std::endl;*/ } // entry
- ~Playing() { /*std::cout << "leaving Playing" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< stop, Stopped,
- player, &player::stop_playback >,
- sc::transition< pause, Paused,
- player, &player::pause_playback >,
- sc::transition< open_close, Open,
- player, &player::stop_and_open > > reactions;
- };
- struct Paused : sc::simple_state< Paused, player >
- {
- Paused() { /*std::cout << "entering Paused" << std::endl;*/ } // entry
- ~Paused() { /*std::cout << "leaving Paused" << std::endl;*/ } // exit
- typedef mpl::list<
- sc::transition< end_pause, Playing,
- player, &player::resume_playback >,
- sc::transition< stop, Stopped,
- player, &player::stop_playback >,
- sc::transition< open_close, Open,
- player, &player::stop_and_open > > reactions;
- };
-}
-
-
-#ifndef WIN32
-long mtime(struct timeval& tv1,struct timeval& tv2)
-{
- return (tv2.tv_sec-tv1.tv_sec) *1000000 + ((tv2.tv_usec-tv1.tv_usec));
-}
-#endif
-
-
-int main()
-{
- test_sc::player p;
- p.initiate();
- // for timing
-#ifdef WIN32
- LARGE_INTEGER res;
- ::QueryPerformanceFrequency(&res);
- LARGE_INTEGER li,li2;
- ::QueryPerformanceCounter(&li);
-#else
- struct timeval tv1,tv2;
- gettimeofday(&tv1,NULL);
-#endif
- for (int i=0;i<100;++i)
- {
- p.process_event(test_sc::open_close());
- p.process_event(test_sc::open_close());
- p.process_event(test_sc::cd_detected());
- p.process_event(test_sc::play());
- p.process_event(test_sc::pause());
- // go back to Playing
- p.process_event(test_sc::end_pause());
- p.process_event(test_sc::pause());
- p.process_event(test_sc::stop());
- // event leading to the same state
- p.process_event(test_sc::stop());
- p.process_event(test_sc::open_close());
- p.process_event(test_sc::open_close());
- }
-#ifdef WIN32
- ::QueryPerformanceCounter(&li2);
-#else
- gettimeofday(&tv2,NULL);
-#endif
-#ifdef WIN32
- std::cout << "sc took in s:" << (double)(li2.QuadPart-li.QuadPart)/res.QuadPart <<"\n" <<std::endl;
-#else
- std::cout << "sc took in us:" << mtime(tv1,tv2) <<"\n" <<std::endl;
-#endif
- return 0;
-}
-
Added: trunk/libs/msm/doc/PDF/examples/SCComposite.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/msm/doc/PDF/examples/SCComposite.cpp 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
@@ -0,0 +1,207 @@
+// Copyright 2010 Christophe Henry
+// henry UNDERSCORE christophe AT hotmail DOT com
+// This is an extended version of the state machine available in the boost::mpl library
+// Distributed under the same license as the original.
+// Copyright for the original version:
+// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
+// under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/statechart/event.hpp>
+#include <boost/statechart/state_machine.hpp>
+#include <boost/statechart/simple_state.hpp>
+#include <boost/statechart/transition.hpp>
+#include "boost/mpl/list.hpp"
+
+#include <vector>
+
+#include <iostream>
+#ifdef WIN32
+#include "windows.h"
+#else
+#include <sys/time.h>
+#endif
+
+namespace sc = boost::statechart;
+namespace mpl = boost::mpl;
+
+namespace test_sc
+{
+
+ //events
+ struct play : sc::event< play > {};
+ struct end_pause : sc::event< end_pause > {};
+ struct stop : sc::event< stop > {};
+ struct pause : sc::event< pause > {};
+ struct open_close : sc::event< open_close > {};
+ struct cd_detected : sc::event< cd_detected > {};
+ struct NextSong: sc::event< NextSong > {};
+ struct PreviousSong : sc::event< PreviousSong >{};
+
+ struct Empty;
+ struct Open;
+ struct Stopped;
+ struct Playing;
+ struct Paused;
+ // SM
+ struct player : sc::state_machine< player, Empty >
+ {
+ void open_drawer(open_close const&) { /*std::cout << "player::open_drawer\n";*/ }
+ void store_cd_info(cd_detected const& cd) {/*std::cout << "player::store_cd_info\n";*/ }
+ void close_drawer(open_close const&) { /*std::cout << "player::close_drawer\n";*/ }
+ void start_playback(play const&) { /*std::cout << "player::start_playback\n";*/ }
+ void stopped_again(stop const&) {/*std::cout << "player::stopped_again\n";*/}
+ void stop_playback(stop const&) { /*std::cout << "player::stop_playback\n";*/ }
+ void pause_playback(pause const&) { /*std::cout << "player::pause_playback\n"; */}
+ void stop_and_open(open_close const&) { /*std::cout << "player::stop_and_open\n";*/ }
+ void resume_playback(end_pause const&) { /*std::cout << "player::resume_playback\n";*/ }
+ };
+
+ struct Empty : sc::simple_state< Empty, player >
+ {
+ Empty() { /*std::cout << "entering Empty" << std::endl;*/ } // entry
+ ~Empty() { /*std::cout << "leaving Empty" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< open_close, Open,
+ player, &player::open_drawer >,
+ sc::transition< cd_detected, Stopped,
+ player, &player::store_cd_info > > reactions;
+
+ };
+ struct Open : sc::simple_state< Open, player >
+ {
+ Open() { /*std::cout << "entering Open" << std::endl;*/ } // entry
+ ~Open() { /*std::cout << "leaving Open" << std::endl;*/ } // exit
+ typedef sc::transition< open_close, Empty,
+ player, &player::close_drawer > reactions;
+
+ };
+ struct Stopped : sc::simple_state< Stopped, player >
+ {
+ Stopped() { /*std::cout << "entering Stopped" << std::endl;*/ } // entry
+ ~Stopped() { /*std::cout << "leaving Stopped" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< play, Playing,
+ player, &player::start_playback >,
+ sc::transition< open_close, Open,
+ player, &player::open_drawer >,
+ sc::transition< stop, Stopped,
+ player, &player::stopped_again > > reactions;
+
+ };
+ struct Song1;
+ struct Playing : sc::simple_state< Playing, player,Song1 >
+ {
+ Playing() { /*std::cout << "entering Playing" << std::endl;*/ } // entry
+ ~Playing() { /*std::cout << "leaving Playing" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< stop, Stopped,
+ player, &player::stop_playback >,
+ sc::transition< pause, Paused,
+ player, &player::pause_playback >,
+ sc::transition< open_close, Open,
+ player, &player::stop_and_open > > reactions;
+ void start_next_song(NextSong const&) { /*std::cout << "Playing::start_next_song\n";*/ }
+ void start_prev_song(PreviousSong const&) { /*std::cout << "Playing::start_prev_song\n";*/ }
+ };
+ struct Song2;
+ struct Song1 : sc::simple_state< Song1, Playing >
+ {
+ Song1() { /*std::cout << "entering Song1" << std::endl;*/ } // entry
+ ~Song1() { /*std::cout << "leaving Song1" << std::endl;*/ } // exit
+ typedef sc::transition< NextSong, Song2,
+ Playing, &Playing::start_next_song > reactions;
+ };
+ struct Song3;
+ struct Song2 : sc::simple_state< Song2, Playing >
+ {
+ Song2() { /*std::cout << "entering Song2" << std::endl;*/ } // entry
+ ~Song2() { /*std::cout << "leaving Song2" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< NextSong, Song3,
+ Playing, &Playing::start_next_song >,
+ sc::transition< PreviousSong, Song1,
+ Playing, &Playing::start_prev_song > > reactions;
+ };
+ struct Song3 : sc::simple_state< Song3, Playing >
+ {
+ Song3() { /*std::cout << "entering Song3" << std::endl;*/ } // entry
+ ~Song3() { /*std::cout << "leaving Song3" << std::endl;*/ } // exit
+ typedef sc::transition< PreviousSong, Song2,
+ Playing, &Playing::start_prev_song > reactions;
+ };
+ struct Paused : sc::simple_state< Paused, player >
+ {
+ Paused() { /*std::cout << "entering Paused" << std::endl;*/ } // entry
+ ~Paused() { /*std::cout << "leaving Paused" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< end_pause, Playing,
+ player, &player::resume_playback >,
+ sc::transition< stop, Stopped,
+ player, &player::stop_playback >,
+ sc::transition< open_close, Open,
+ player, &player::stop_and_open > > reactions;
+ };
+}
+
+
+#ifndef WIN32
+long mtime(struct timeval& tv1,struct timeval& tv2)
+{
+ return (tv2.tv_sec-tv1.tv_sec) *1000000 + ((tv2.tv_usec-tv1.tv_usec));
+}
+#endif
+
+int main()
+{
+ test_sc::player p;
+ p.initiate();
+ // for timing
+#ifdef WIN32
+ LARGE_INTEGER res;
+ ::QueryPerformanceFrequency(&res);
+ LARGE_INTEGER li,li2;
+ ::QueryPerformanceCounter(&li);
+#else
+ struct timeval tv1,tv2;
+ gettimeofday(&tv1,NULL);
+#endif
+
+ for (int i=0;i<100;++i)
+ {
+ p.process_event(test_sc::open_close());
+ p.process_event(test_sc::open_close());
+ p.process_event(test_sc::cd_detected());
+ p.process_event(test_sc::play());
+ for (int j=0;j<100;++j)
+ {
+ p.process_event(test_sc::NextSong());
+ p.process_event(test_sc::NextSong());
+ p.process_event(test_sc::PreviousSong());
+ p.process_event(test_sc::PreviousSong());
+ }
+
+ p.process_event(test_sc::pause());
+ // go back to Playing
+ p.process_event(test_sc::end_pause());
+ p.process_event(test_sc::pause());
+ p.process_event(test_sc::stop());
+ // event leading to the same state
+ p.process_event(test_sc::stop());
+ p.process_event(test_sc::open_close());
+ p.process_event(test_sc::open_close());
+ }
+#ifdef WIN32
+ ::QueryPerformanceCounter(&li2);
+#else
+ gettimeofday(&tv2,NULL);
+#endif
+#ifdef WIN32
+ std::cout << "sc took in s:" << (double)(li2.QuadPart-li.QuadPart)/res.QuadPart <<"\n" <<std::endl;
+#else
+ std::cout << "sc took in us:" << mtime(tv1,tv2) <<"\n" <<std::endl;
+#endif
+ return 0;
+}
+
Added: trunk/libs/msm/doc/PDF/examples/SCSimple.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/msm/doc/PDF/examples/SCSimple.cpp 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
@@ -0,0 +1,169 @@
+// Copyright 2010 Christophe Henry
+// henry UNDERSCORE christophe AT hotmail DOT com
+// This is an extended version of the state machine available in the boost::mpl library
+// Distributed under the same license as the original.
+// Copyright for the original version:
+// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
+// under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/statechart/event.hpp>
+#include <boost/statechart/state_machine.hpp>
+#include <boost/statechart/simple_state.hpp>
+#include <boost/statechart/transition.hpp>
+#include "boost/mpl/list.hpp"
+
+#include <vector>
+
+#include <iostream>
+#ifdef WIN32
+#include "windows.h"
+#else
+#include <sys/time.h>
+#endif
+
+namespace sc = boost::statechart;
+namespace mpl = boost::mpl;
+
+namespace test_sc
+{
+
+ //events
+ struct play : sc::event< play > {};
+ struct end_pause : sc::event< end_pause > {};
+ struct stop : sc::event< stop > {};
+ struct pause : sc::event< pause > {};
+ struct open_close : sc::event< open_close > {};
+ struct cd_detected : sc::event< cd_detected > {};
+
+
+ struct Empty;
+ struct Open;
+ struct Stopped;
+ struct Playing;
+ struct Paused;
+ // SM
+ struct player : sc::state_machine< player, Empty >
+ {
+ void open_drawer(open_close const&) { /*std::cout << "player::open_drawer\n";*/ }
+ void store_cd_info(cd_detected const& cd) {/*std::cout << "player::store_cd_info\n";*/ }
+ void close_drawer(open_close const&) { /*std::cout << "player::close_drawer\n";*/ }
+ void start_playback(play const&) { /*std::cout << "player::start_playback\n";*/ }
+ void stopped_again(stop const&) {/*std::cout << "player::stopped_again\n";*/}
+ void stop_playback(stop const&) { /*std::cout << "player::stop_playback\n";*/ }
+ void pause_playback(pause const&) { /*std::cout << "player::pause_playback\n"; */}
+ void stop_and_open(open_close const&) { /*std::cout << "player::stop_and_open\n";*/ }
+ void resume_playback(end_pause const&) { /*std::cout << "player::resume_playback\n";*/ }
+ };
+
+ struct Empty : sc::simple_state< Empty, player >
+ {
+ Empty() { /*std::cout << "entering Empty" << std::endl;*/ } // entry
+ ~Empty() { /*std::cout << "leaving Empty" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< open_close, Open,
+ player, &player::open_drawer >,
+ sc::transition< cd_detected, Stopped,
+ player, &player::store_cd_info > > reactions;
+
+ };
+ struct Open : sc::simple_state< Open, player >
+ {
+ Open() { /*std::cout << "entering Open" << std::endl;*/ } // entry
+ ~Open() { /*std::cout << "leaving Open" << std::endl;*/ } // exit
+ typedef sc::transition< open_close, Empty,
+ player, &player::close_drawer > reactions;
+
+ };
+ struct Stopped : sc::simple_state< Stopped, player >
+ {
+ Stopped() { /*std::cout << "entering Stopped" << std::endl;*/ } // entry
+ ~Stopped() { /*std::cout << "leaving Stopped" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< play, Playing,
+ player, &player::start_playback >,
+ sc::transition< open_close, Open,
+ player, &player::open_drawer >,
+ sc::transition< stop, Stopped,
+ player, &player::stopped_again > > reactions;
+
+ };
+ struct Playing : sc::simple_state< Playing, player >
+ {
+ Playing() { /*std::cout << "entering Playing" << std::endl;*/ } // entry
+ ~Playing() { /*std::cout << "leaving Playing" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< stop, Stopped,
+ player, &player::stop_playback >,
+ sc::transition< pause, Paused,
+ player, &player::pause_playback >,
+ sc::transition< open_close, Open,
+ player, &player::stop_and_open > > reactions;
+ };
+ struct Paused : sc::simple_state< Paused, player >
+ {
+ Paused() { /*std::cout << "entering Paused" << std::endl;*/ } // entry
+ ~Paused() { /*std::cout << "leaving Paused" << std::endl;*/ } // exit
+ typedef mpl::list<
+ sc::transition< end_pause, Playing,
+ player, &player::resume_playback >,
+ sc::transition< stop, Stopped,
+ player, &player::stop_playback >,
+ sc::transition< open_close, Open,
+ player, &player::stop_and_open > > reactions;
+ };
+}
+
+
+#ifndef WIN32
+long mtime(struct timeval& tv1,struct timeval& tv2)
+{
+ return (tv2.tv_sec-tv1.tv_sec) *1000000 + ((tv2.tv_usec-tv1.tv_usec));
+}
+#endif
+
+
+int main()
+{
+ test_sc::player p;
+ p.initiate();
+ // for timing
+#ifdef WIN32
+ LARGE_INTEGER res;
+ ::QueryPerformanceFrequency(&res);
+ LARGE_INTEGER li,li2;
+ ::QueryPerformanceCounter(&li);
+#else
+ struct timeval tv1,tv2;
+ gettimeofday(&tv1,NULL);
+#endif
+ for (int i=0;i<100;++i)
+ {
+ p.process_event(test_sc::open_close());
+ p.process_event(test_sc::open_close());
+ p.process_event(test_sc::cd_detected());
+ p.process_event(test_sc::play());
+ p.process_event(test_sc::pause());
+ // go back to Playing
+ p.process_event(test_sc::end_pause());
+ p.process_event(test_sc::pause());
+ p.process_event(test_sc::stop());
+ // event leading to the same state
+ p.process_event(test_sc::stop());
+ p.process_event(test_sc::open_close());
+ p.process_event(test_sc::open_close());
+ }
+#ifdef WIN32
+ ::QueryPerformanceCounter(&li2);
+#else
+ gettimeofday(&tv2,NULL);
+#endif
+#ifdef WIN32
+ std::cout << "sc took in s:" << (double)(li2.QuadPart-li.QuadPart)/res.QuadPart <<"\n" <<std::endl;
+#else
+ std::cout << "sc took in us:" << mtime(tv1,tv2) <<"\n" <<std::endl;
+#endif
+ return 0;
+}
+
Modified: trunk/libs/msm/doc/PDF/msm.pdf
==============================================================================
Binary files. No diff available.
Modified: trunk/libs/msm/doc/src/msm.xml
==============================================================================
--- trunk/libs/msm/doc/src/msm.xml (original)
+++ trunk/libs/msm/doc/src/msm.xml 2010-06-17 16:52:34 EDT (Thu, 17 Jun 2010)
@@ -3176,10 +3176,15 @@
value before including any header if you need to overwrite the default. </para>
<para>You can also pass arguments by reference (or const-reference) using
boost::ref (or boost::cref):</para>
- <para>struct player_ : public msm::front::state_machine_def<player_> {
- player_(SomeType& t, int some_value){â¦} }; </para>
- <para>typedef msm::back::state_machine<player_ > player; SomeType data;
- player p(boost::ref(data),3);</para>
+ <programlisting>struct player_ : public msm::front::state_machine_def<player_>
+{
+ player_(SomeType& t, int some_value){â¦}
+};
+
+typedef msm::back::state_machine<player_ > player;
+SomeType data;
+player p(boost::ref(data),3);
+ </programlisting>
</sect2>
<sect2>
<title><command xml:id="backend-tradeof-rt-ct"/>Trading run-time speed for
@@ -3270,8 +3275,8 @@
<para>Tests were made on different PCs running Windows XP and Vista and compiled with
VC9 SP1 or Ubuntu and compiled with g++ 4.2 and 4.3. For these tests, the same
player state machine was written using Boost.Statechart, as a <link
- xlink:href="examples/SC Simple.cpp">state machine with only simple states</link>
- and as a <link xlink:href="examples/SC Composite.cpp">state machine with a composite
+ xlink:href="examples/SCSimple.cpp">state machine with only simple states</link>
+ and as a <link xlink:href="examples/SCComposite.cpp">state machine with a composite
state</link>. The same simple and composite state machines are implemented with
MSM with a standard frontend <link xlink:href="examples/MsmSimple.cpp"
>(simple)</link><link xlink:href="examples/MsmComposite.cpp">(composite)</link>,
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk