Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59634 - in sandbox/msm/libs/msm/doc: . BoostCon09
From: christophe.j.henry_at_[hidden]
Date: 2010-02-11 06:19:50


Author: chenry
Date: 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
New Revision: 59634
URL: http://svn.boost.org/trac/boost/changeset/59634

Log:
examples updated with the new attribute syntax
Added:
   sandbox/msm/libs/msm/doc/EumlInternal.cpp (contents, props changed)
   sandbox/msm/libs/msm/doc/EumlInternal2.cpp (contents, props changed)
   sandbox/msm/libs/msm/doc/EumlInternalDistributed.cpp (contents, props changed)
Text files modified:
   sandbox/msm/libs/msm/doc/BoostCon09/iPodEuml.cpp | 131 +++++++-------
   sandbox/msm/libs/msm/doc/CompilerStressTestEuml.cpp | 352 ++++++++++++++++++++-------------------
   sandbox/msm/libs/msm/doc/CompositeTutorialEuml.cpp | 28 ++
   sandbox/msm/libs/msm/doc/FlagsTutorialEuml.cpp | 67 ++++--
   sandbox/msm/libs/msm/doc/HistoryEuml.cpp | 32 ++
   sandbox/msm/libs/msm/doc/OrthogonalDeferredEuml.cpp | 40 +++-
   sandbox/msm/libs/msm/doc/SimpleTimer.cpp | 41 ++--
   sandbox/msm/libs/msm/doc/SimpleTutorialEuml.cpp | 41 +++-
   sandbox/msm/libs/msm/doc/SimpleTutorialEuml2.cpp | 35 ++-
   sandbox/msm/libs/msm/doc/SimpleTutorialInternal.cpp | 4
   sandbox/msm/libs/msm/doc/TestInternal.cpp | 8
   sandbox/msm/libs/msm/doc/iPodSearchEuml.cpp | 83 ++++----
   12 files changed, 498 insertions(+), 364 deletions(-)

Modified: sandbox/msm/libs/msm/doc/BoostCon09/iPodEuml.cpp
==============================================================================
--- sandbox/msm/libs/msm/doc/BoostCon09/iPodEuml.cpp (original)
+++ sandbox/msm/libs/msm/doc/BoostCon09/iPodEuml.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -13,10 +13,11 @@
 using namespace std;
 using namespace boost::msm::front::euml;
 namespace msm = boost::msm;
-//attributes
-#define m_SongIndex 0
-#define m_NumberOfSongs 1
-#define m_Selected 0
+
+// attribute names and types
+BOOST_MSM_EUML_DECLARE_ATTRIBUTE(int,m_Selected)
+BOOST_MSM_EUML_DECLARE_ATTRIBUTE(int,m_SongIndex)
+BOOST_MSM_EUML_DECLARE_ATTRIBUTE(int,m_NumberOfSongs)
 #include "ipod_functors.hpp"
 
 
@@ -50,13 +51,13 @@
     struct SelectSong : euml_event<SelectSong> {};
     struct SongFinished : euml_event<SongFinished> {};
 
- typedef BOOST_TYPEOF(build_attributes(attributes_ << int()/*m_Selected*/ )) StartSongAttributes;
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << m_Selected )) StartSongAttributes;
     struct StartSong : euml_event<StartSong> ,StartSongAttributes
     {
         StartSong(){}//defined only for stt
         StartSong (int song_index)
         {
- get_attribute<m_Selected>()=song_index;
+ get_attribute(m_Selected)=song_index;
         }
     };
     struct PreviousSong : euml_event<PreviousSong> {};
@@ -91,41 +92,41 @@
     //stt
     typedef BOOST_TYPEOF(build_stt((
         // +------------------------------------------------------------------------------+
- Playing() + PlayPause() == Paused() ,
- Playing() + Off() == Paused() ,
- Playing() + StartSong() == Playing()
- / (if_then_(Event_<m_Selected>() > Int_<0>() &&
- Event_<m_Selected>() < Fsm_<m_NumberOfSongs>(),
- Fsm_<m_SongIndex>() = Event_<m_Selected>() ),show_selected_song()) ,
- Playing() + SongFinished() == Playing()
- / (if_then_else_(++Fsm_<m_SongIndex>() <= Fsm_<m_NumberOfSongs>(), /*if*/
- show_playing_song(), /*then*/
- (Fsm_<m_SongIndex>()=Int_<1>(),process_(EndPlay()))/*else*/ ) ) ,
- Paused() + PlayPause() == Playing() ,
- Paused() + StartSong() == Playing()
- / (if_then_(Event_<m_Selected>() > Int_<0>() &&
- Event_<m_Selected>() < Fsm_<m_NumberOfSongs>(),
- Fsm_<m_SongIndex>() = Event_<m_Selected>() ),show_selected_song()) ,
- WaitingForNextPrev()+ PreviousSong() == WaitingForNextPrev()
- /( if_then_else_(--Fsm_<m_SongIndex>() > Int_<0>(), /*if*/
- show_playing_song(), /*then*/
- (Fsm_<m_SongIndex>()=Int_<1>(),process_(EndPlay())) /*else*/ ) ) ,
- WaitingForNextPrev()+ NextSong() == WaitingForNextPrev()
- / (if_then_else_(++Fsm_<m_SongIndex>() <= Fsm_<m_NumberOfSongs>(), /*if*/
- show_playing_song(), /*then*/
- (Fsm_<m_SongIndex>()=Int_<1>(),process_(EndPlay())) /*else*/ ) ) ,
-
- WaitingForEnd() + EndPlay() == PlayingExit() ,
- NoForward() + EastPressed() == ForwardPressed() [!is_flag_(NoFastFwd())] ,
- ForwardPressed() + EastReleased() == NoForward() / process_(NextSong()) ,
- ForwardPressed() + ForwardTimer() == FastForward() / do_fast_forward() ,
- FastForward() + ForwardTimer() == FastForward() / do_fast_forward() ,
- FastForward() + EastReleased() == NoForward() ,
- StdDisplay() + PlayingMiddleButton() == SetPosition() ,
- SetPosition() + StartSong() == StdDisplay() ,
- SetPosition() + PlayingMiddleButton() == SetMark() ,
- SetMark() + PlayingMiddleButton() == StdDisplay() ,
- SetMark() + StartSong() == StdDisplay()
+ Paused() == Playing() + PlayPause() ,
+ Paused() == Playing() + Off() ,
+ Playing() == Playing() + StartSong()
+ / (if_then_(event_(m_Selected) > Int_<0>() &&
+ event_(m_Selected) < fsm_(m_NumberOfSongs),
+ fsm_(m_SongIndex) = event_(m_Selected) ),show_selected_song()) ,
+ Playing() == Playing() + SongFinished()
+ / (if_then_else_(++fsm_(m_SongIndex) <= fsm_(m_NumberOfSongs), /*if*/
+ show_playing_song(), /*then*/
+ (fsm_(m_SongIndex)=Int_<1>(),process_(EndPlay()))/*else*/ ) ) ,
+ Playing() == Paused() + PlayPause() ,
+ Playing() == Paused() + StartSong()
+ / (if_then_(event_(m_Selected) > Int_<0>() &&
+ event_(m_Selected) < fsm_(m_NumberOfSongs),
+ fsm_(m_SongIndex) = event_(m_Selected) ),show_selected_song()) ,
+ WaitingForNextPrev() == WaitingForNextPrev()+ PreviousSong()
+ /( if_then_else_(--fsm_(m_SongIndex) > Int_<0>(), /*if*/
+ show_playing_song(), /*then*/
+ (fsm_(m_SongIndex)=Int_<1>(),process_(EndPlay())) /*else*/ ) ) ,
+ WaitingForNextPrev() == WaitingForNextPrev()+ NextSong()
+ / (if_then_else_(++fsm_(m_SongIndex) <= fsm_(m_NumberOfSongs), /*if*/
+ show_playing_song(), /*then*/
+ (fsm_(m_SongIndex)=Int_<1>(),process_(EndPlay())) /*else*/ ) ),
+
+ PlayingExit() == WaitingForEnd() + EndPlay() ,
+ ForwardPressed() == NoForward() + EastPressed() [!is_flag_(NoFastFwd())] ,
+ NoForward() == ForwardPressed() + EastReleased() / process_(NextSong()) ,
+ FastForward() == ForwardPressed() + ForwardTimer() / do_fast_forward() ,
+ FastForward() == FastForward() + ForwardTimer() / do_fast_forward() ,
+ FastForward() == NoForward() + EastReleased() ,
+ SetPosition() == StdDisplay() + PlayingMiddleButton() ,
+ StdDisplay() == SetPosition() + StartSong() ,
+ SetMark() == SetPosition() + PlayingMiddleButton() ,
+ StdDisplay() == SetMark() + PlayingMiddleButton() ,
+ StdDisplay() == SetMark() + StartSong()
         // +------------------------------------------------------------------------------+
         ) ) ) playingmode_transition_table;
 
@@ -135,9 +136,9 @@
     typedef BOOST_TYPEOF(build_sm( playingmode_transition_table(), //STT
         init_ << Playing() << WaitingForNextPrev() << WaitingForEnd()
               << NoForward() << StdDisplay(), // Init States
- Fsm_<m_NumberOfSongs>()=Int_<5>(), // entry
+ fsm_(m_NumberOfSongs)=Int_<5>(), // entry
         NoAction(), // exit
- attributes_ << int() /*m_SongIndex*/ << int() /*m_NumberOfSongs*/, //attributes
+ attributes_ << m_SongIndex << m_NumberOfSongs, //attributes
         configure_<< NoFastFwd() // Flags, Deferred events, configuration
 
         )) PlayingMode_;
@@ -146,9 +147,9 @@
     struct PlayingMode_ : public BOOST_TYPEOF(build_sm( playingmode_transition_table(), //STT
         init_ << Playing() << WaitingForNextPrev() << WaitingForEnd()
               << NoForward() << StdDisplay(), // Init States
- Fsm_<m_NumberOfSongs>()=Int_<5>(), // entry
+ fsm_(m_NumberOfSongs)=Int_<5>(), // entry
         NoAction(), // exit
- attributes_ << int() /*m_SongIndex*/ << int() /*m_NumberOfSongs*/, //attributes
+ attributes_ << m_SongIndex << m_NumberOfSongs, //attributes
         configure_<< NoFastFwd() // Flags, Deferred events, configuration
         ))
     {
@@ -165,8 +166,8 @@
     //stt
     typedef BOOST_TYPEOF(build_stt((
         // +------------------------------------------------------------------------------+
- WaitingForSongChoice() + MenuMiddleButton() == StartCurrentSong() ,
- StartCurrentSong() + SelectSong() == MenuExit()
+ StartCurrentSong() == WaitingForSongChoice() + MenuMiddleButton() ,
+ MenuExit() == StartCurrentSong() + SelectSong()
         // +------------------------------------------------------------------------------+
         ) ) ) menumode_transition_table;
 
@@ -198,23 +199,25 @@
     // iPod stt
     typedef BOOST_TYPEOF(build_stt((
         // +------------------------------------------------------------------------------+
- NotHolding() + Hold() == Holding() ,
- Holding() + NoHold() == NotHolding() ,
- NotPlaying() + PlayPause() == PlayingMode() ,
- PlayingMode::
- exit_pt<PlayingExit>() + EndPlay() == NotPlaying() / process_(MenuButton()) ,
- NoMenuMode() + MenuButton() == MenuMode() ,
- MenuMode::
- exit_pt<MenuExit>() + CloseMenu() == NoMenuMode() / process2_(StartSong(),Int_<5>()) ,
- NoOnOffButton() + SouthPressed() == OffDown() ,
- OffDown() + SouthReleased() == NoOnOffButton() / process_(PlayPause()) ,
- OffDown() + OnOffTimer() == PlayerOff() / (show_player_off(),process_(Off())) ,
- PlayerOff() + SouthPressed() == NoOnOffButton() / show_player_on() ,
- PlayerOff() + NoHold() == NoOnOffButton() / show_player_on(),
- CheckMiddleButton() + MiddleButton() == CheckMiddleButton()
- [is_flag_(MenuActive())] / process_(PlayingMiddleButton()) ,
- CheckMiddleButton() + MiddleButton() == CheckMiddleButton()
- [!is_flag_(MenuActive())] / process_(PlayingMiddleButton())
+ Holding() == NotHolding() + Hold() ,
+ NotHolding() == Holding() + NoHold() ,
+ PlayingMode() == NotPlaying() + PlayPause() ,
+ NotPlaying() == PlayingMode::exit_pt<PlayingExit>() + EndPlay()
+ / process_(MenuButton()) ,
+ MenuMode() == NoMenuMode() + MenuButton() ,
+ NoMenuMode() == MenuMode::exit_pt<MenuExit>()+ CloseMenu()
+ / process2_(StartSong(),Int_<5>()) ,
+ OffDown() == NoOnOffButton() + SouthPressed() ,
+ NoOnOffButton() == OffDown() + SouthReleased()
+ / process_(PlayPause()) ,
+ PlayerOff() == OffDown() + OnOffTimer()
+ / (show_player_off(),process_(Off())) ,
+ NoOnOffButton() == PlayerOff() + SouthPressed() / show_player_on() ,
+ NoOnOffButton() == PlayerOff() + NoHold() / show_player_on() ,
+ CheckMiddleButton() == CheckMiddleButton() + MiddleButton()
+ [is_flag_(MenuActive())] / process_(PlayingMiddleButton()) ,
+ CheckMiddleButton() == CheckMiddleButton() + MiddleButton()
+ [!is_flag_(MenuActive())] / process_(PlayingMiddleButton())
         // +------------------------------------------------------------------------------+
         ) ) ) ipod_transition_table;
     // VC9 cannot compile the typedef with build_sm if one is also used for player

Modified: sandbox/msm/libs/msm/doc/CompilerStressTestEuml.cpp
==============================================================================
--- sandbox/msm/libs/msm/doc/CompilerStressTestEuml.cpp (original)
+++ sandbox/msm/libs/msm/doc/CompilerStressTestEuml.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -17,34 +17,30 @@
 // how long the timer will ring when countdown elapsed.
 #define RINGING_TIME 5
 
-#define m_src_container 0
-#define m_tgt_container 1
-#define m_test_container 2
-#define m_song 0
-#define m_letters 0
-#define m_src_it 0
-
 namespace // Concrete FSM implementation
 {
     // flag
     struct SomeFlag : euml_flag<SomeFlag>{};
 
     // events
- typedef BOOST_TYPEOF(build_attributes(attributes_ << string() << int()/*m_song*/ )) OneSongDef;
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_song)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(int,m_song_id)
+
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << m_song << m_song_id )) OneSongDef;
     struct OneSong : euml_event<OneSong>,OneSongDef
     {
         OneSong(){}
         OneSong(const string& asong)
         {
- get_attribute<m_song>()=asong;
- get_attribute<1>()=1;
+ get_attribute(m_song)=asong;
+ get_attribute(m_song_id)=1;
         }
         OneSong(const OneSong& asong)
         {
- get_attribute<m_song>()=asong.get_attribute<m_song>();
- get_attribute<1>()=1;
+ get_attribute(m_song)=asong.get_attribute(m_song);
+ get_attribute(m_song_id)=1;
         }
- const string& get_data() const {return get_attribute<m_song>();}
+ const string& get_data() const {return get_attribute(m_song);}
     };
     struct SongComparator : euml_action<SongComparator>
     {
@@ -72,7 +68,7 @@
     {
         bool operator()(const OneSong& lhs)const
         {
- return (lhs.get_attribute<m_song>().compare(std::string("She-Dummy. Remove this one"))==0 );
+ return (lhs.get_attribute(m_song).compare(std::string("She-Dummy. Remove this one"))==0 );
         }
     };
     template <int val>
@@ -115,23 +111,23 @@
             std::cout << "Song:" << lhs.get_data() << endl;
         }
     };
- typedef BOOST_TYPEOF(build_attributes(attributes_ << string()/*m_song*/ )) NotFoundDef;
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << m_song )) NotFoundDef;
     struct NotFound : euml_event<NotFound>,NotFoundDef
     {
         NotFound(){}
         NotFound (const string& data)
         {
- get_attribute<m_song>()=data;
+ get_attribute(m_song)=data;
         }
     };
 
- typedef BOOST_TYPEOF(build_attributes(attributes_ << string()/*m_song*/ )) FoundDef;
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << m_song )) FoundDef;
     struct Found : euml_event<Found>,FoundDef
     {
         Found(){}
         Found (const string& data)
         {
- get_attribute<m_song>()=data;
+ get_attribute(m_song)=data;
         }
         int foo()const {std::cout << "foo()" << std::endl; return 0;}
         int foo(int i)const {std::cout << "foo(int):" << i << std::endl; return 1;}
@@ -158,99 +154,113 @@
     // some functions to call
     MSM_EUML_METHOD(FooBar_ , foobar , foobar_ , int , int )
 
+ // fsm attributes
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(vector<OneSong>,m_src_container)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(list<OneSong>,m_tgt_container)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(list<int>,m_var2)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(list<int>,m_var3)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(set<int>,m_var4)
+ typedef std::map<int,int> int_int_map;
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(int_int_map,m_var5)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_var6)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_var7)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(vector<int>,m_var8)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(vector<int>,m_var9)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(int,m_var10)
+
     // The list of FSM states
- typedef BOOST_TYPEOF(build_state( ( insert_(Fsm_<m_tgt_container>(),end_(Fsm_<m_tgt_container>()),
- append_(Event_<m_song>(),Fsm_<7>()) ),//foo_(event_(),Int_<0>()) ,
+ typedef BOOST_TYPEOF(build_state( ( insert_(fsm_(m_tgt_container),end_(fsm_(m_tgt_container)),
+ append_(event_(m_song),fsm_(m_var7)) ),//foo_(event_(),Int_<0>()) ,
                                                 //foo_(event_(),Int_<0>(),Int_<1>()),print_(state_()),
                                                 process_(Done()/*,fsm_()*/),if_then_(True_(),True_()) ),
                                        NoAction()
                                         )) Insert;
 
-
- typedef BOOST_TYPEOF(build_state( if_then_else_( (string_find_(Event_<m_song>(),State_<m_letters>(),Size_t_<0>()) != Npos_<string>()&&
- string_find_(Event_<m_song>(),Char_<'S'>(),Size_t_<0>()) != Npos_<string>()&&
- string_find_first_of_(Event_<m_song>(),Char_<'S'>()) == Size_t_<0>() &&
- string_compare_(Event_<m_song>(),Int_<0>(),size_(Event_<m_song>()),Event_<m_song>()) == Int_<0>()
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_letters)
+ typedef BOOST_TYPEOF(build_state( if_then_else_( (string_find_(event_(m_song),state_(m_letters),Size_t_<0>()) != Npos_<string>()&&
+ string_find_(event_(m_song),Char_<'S'>(),Size_t_<0>()) != Npos_<string>()&&
+ string_find_first_of_(event_(m_song),Char_<'S'>()) == Size_t_<0>() &&
+ string_compare_(event_(m_song),Int_<0>(),size_(event_(m_song)),event_(m_song)) == Int_<0>()
                                                       //&& is_flag_(SomeFlag(),fsm_())
- //&& ( attribute_(event_(),Int_<1>()) == Int_<1>())
- //&& string_find_(Event_<m_song>(),String_<mpl::string<'Sh','e'> >())
+ //&& ( event_(m_song_id) == Int_<1>())
+ //&& string_find_(event_(m_song),String_<mpl::string<'Sh','e'> >())
                                                       // != Npos_<string>()
 
                                                       ),
                                                      process2_(Found(),
- //string_insert_(Event_<m_song>(),Size_t_<0>(),Fsm_<6>()) ),
+ //string_insert_(event_(m_song),Size_t_<0>(),fsm_(m_var6)) ),
                                                         string_replace_(
                                                             string_assign_(
                                                                 string_erase_(
                                                                     string_insert_(
- substr_(Event_<m_song>(),Size_t_<1>()),
+ substr_(event_(m_song),Size_t_<1>()),
                                                                         Size_t_<0>(),
                                                                         Size_t_<1>(),
                                                                         Char_<'S'>()),
                                                                     Size_t_<0>(),
                                                                     Size_t_<1>() ),
- Event_<m_song>() ),
+ event_(m_song) ),
                                                             Size_t_<0>(),
                                                             Size_t_<1>(),
- c_str_(Fsm_<6>())
+ c_str_(fsm_(m_var6))
                                                             /*Size_t_<1>(),
                                                             Char_<'s'>()*/ ) ),
- process2_(NotFound(),Event_<m_song>(),fsm_()) ) ,
+ process2_(NotFound(),event_(m_song),fsm_()) ) ,
                                      NoAction(),
- attributes_ << string()/*m_letters*/,
+ attributes_ << m_letters,
                                      configure_<< SomeFlag() ))
                          StringFind;
-
- typedef BOOST_TYPEOF(build_state( if_then_( (State_<m_src_it>() != end_(Fsm_<m_src_container>()) &&
- //associative_find_(Fsm_<4>(),Int_<9>()) != end_(Fsm_<4>())&&
- //associative_count_(Fsm_<4>(),Int_<9>()) == Size_t_<1>() &&
- //*associative_upper_bound_(Fsm_<4>(),Int_<8>()) == Int_<9>()&&
- //*associative_lower_bound_(Fsm_<4>(),Int_<9>()) == Int_<9>() &&
- //second_(associative_equal_range_(Fsm_<4>(),Int_<8>())) == associative_upper_bound_(Fsm_<4>(),Int_<8>()) &&
- //first_(associative_equal_range_(Fsm_<4>(),Int_<8>())) == associative_lower_bound_(Fsm_<4>(),Int_<8>())&&
- //second_(*associative_lower_bound_(Fsm_<5>(),Int_<0>())) == Int_<0>() && //map => pair as return
- //find_if_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Predicate_<LookFor<8> >()) != end_(Fsm_<4>())&&
- //*lower_bound_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Int_<9>(),Predicate_<std::less<int> >()) == Int_<9>()&&
- //*upper_bound_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Int_<8>(),Predicate_<std::less<int> >()) == Int_<9>() &&
- //second_(equal_range_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Int_<8>()))
- // == upper_bound_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Int_<8>()) &&
- //first_(equal_range_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Int_<9>(),Predicate_<std::less<int> >()))
- // == lower_bound_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Int_<9>(),Predicate_<std::less<int> >())&&
- //binary_search_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Int_<9>(),Predicate_<std::less<int> >())&&
- //binary_search_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Int_<9>())&&
- //count_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Int_<9>()) == Int_<1>()&&
- //count_if_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Predicate_<LookFor<9> >()) == Int_<1>()&&
- //distance_(begin_(Fsm_<4>()),end_(Fsm_<4>())) == Int_<2>()&&
- //*min_element_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Predicate_<std::less<int> >()) == Int_<8>()&&
- //*max_element_(begin_(Fsm_<4>()),end_(Fsm_<4>()),Predicate_<std::less<int> >()) == Int_<9>()&&
- //adjacent_find_(begin_(Fsm_<4>()),end_(Fsm_<4>())) == end_(Fsm_<4>())&&
- //*find_end_(begin_(Fsm_<8>()),end_(Fsm_<8>()),begin_(Fsm_<9>()),end_(Fsm_<9>()))
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(vector<OneSong>::iterator,m_src_it)
+ typedef BOOST_TYPEOF(build_state( if_then_( (state_(m_src_it) != end_(fsm_(m_src_container)) &&
+ //associative_find_(fsm_(m_var4),Int_<9>()) != end_(fsm_(m_var4))&&
+ //associative_count_(fsm_(m_var4),Int_<9>()) == Size_t_<1>() &&
+ //*associative_upper_bound_(fsm_(m_var4),Int_<8>()) == Int_<9>()&&
+ //*associative_lower_bound_(fsm_(m_var4),Int_<9>()) == Int_<9>() &&
+ //second_(associative_equal_range_(fsm_(m_var4),Int_<8>())) == associative_upper_bound_(fsm_(m_var4),Int_<8>()) &&
+ //first_(associative_equal_range_(fsm_(m_var4),Int_<8>())) == associative_lower_bound_(fsm_(m_var4),Int_<8>())&&
+ //second_(*associative_lower_bound_(fsm_(m_var5),Int_<0>())) == Int_<0>() && //map => pair as return
+ //find_if_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Predicate_<LookFor<8> >()) != end_(fsm_(m_var4))&&
+ //*lower_bound_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Int_<9>(),Predicate_<std::less<int> >()) == Int_<9>()&&
+ //*upper_bound_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Int_<8>(),Predicate_<std::less<int> >()) == Int_<9>() &&
+ //second_(equal_range_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Int_<8>()))
+ // == upper_bound_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Int_<8>()) &&
+ //first_(equal_range_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Int_<9>(),Predicate_<std::less<int> >()))
+ // == lower_bound_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Int_<9>(),Predicate_<std::less<int> >())&&
+ //binary_search_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Int_<9>(),Predicate_<std::less<int> >())&&
+ //binary_search_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Int_<9>())&&
+ //count_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Int_<9>()) == Int_<1>()&&
+ //count_if_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Predicate_<LookFor<9> >()) == Int_<1>()&&
+ //distance_(begin_(fsm_(m_var4)),end_(fsm_(m_var4))) == Int_<2>()&&
+ //*min_element_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Predicate_<std::less<int> >()) == Int_<8>()&&
+ //*max_element_(begin_(fsm_(m_var4)),end_(fsm_(m_var4)),Predicate_<std::less<int> >()) == Int_<9>()&&
+ //adjacent_find_(begin_(fsm_(m_var4)),end_(fsm_(m_var4))) == end_(fsm_(m_var4))&&
+ //*find_end_(begin_(fsm_(m_var8)),end_(fsm_(m_var8)),begin_(fsm_(m_var9)),end_(fsm_(m_var9)))
                                                 // == Int_<1>()&&
- //*find_first_of_(begin_(Fsm_<8>()),end_(Fsm_<8>()),begin_(Fsm_<9>()),end_(Fsm_<9>()))
+ //*find_first_of_(begin_(fsm_(m_var8)),end_(fsm_(m_var8)),begin_(fsm_(m_var9)),end_(fsm_(m_var9)))
                                                 // == Int_<1>()&&
- //equal_(begin_(Fsm_<9>()),end_(Fsm_<9>()),begin_(Fsm_<8>()))&&
- //*search_(begin_(Fsm_<8>()),end_(Fsm_<8>()),begin_(Fsm_<9>()),end_(Fsm_<9>()))
+ //equal_(begin_(fsm_(m_var9)),end_(fsm_(m_var9)),begin_(fsm_(m_var8)))&&
+ //*search_(begin_(fsm_(m_var8)),end_(fsm_(m_var8)),begin_(fsm_(m_var9)),end_(fsm_(m_var9)))
                                                 // == Int_<1>()&&
- //includes_(begin_(Fsm_<8>()),end_(Fsm_<8>()),begin_(Fsm_<9>()),end_(Fsm_<9>()))&&
- //!lexicographical_compare_(begin_(Fsm_<8>()),end_(Fsm_<8>()),
- // begin_(Fsm_<9>()),end_(Fsm_<9>()))&&
- //first_(mismatch_(begin_(Fsm_<9>()),end_(Fsm_<9>()),begin_(Fsm_<8>())))
- // == end_(Fsm_<9>()) &&
- accumulate_(begin_(Fsm_<9>()),end_(Fsm_<9>()),Int_<1>(),
+ //includes_(begin_(fsm_(m_var8)),end_(fsm_(m_var8)),begin_(fsm_(m_var9)),end_(fsm_(m_var9)))&&
+ //!lexicographical_compare_(begin_(fsm_(m_var8)),end_(fsm_(m_var8)),
+ // begin_(fsm_(m_var9)),end_(fsm_(m_var9)))&&
+ //first_(mismatch_(begin_(fsm_(m_var9)),end_(fsm_(m_var9)),begin_(fsm_(m_var8))))
+ // == end_(fsm_(m_var9)) &&
+ accumulate_(begin_(fsm_(m_var9)),end_(fsm_(m_var9)),Int_<1>(),
                                                             Predicate_<std::plus<int> >()) == Int_<1>()
                                                 ),
- (process2_(OneSong(),*(State_<m_src_it>()++))/*,foobar_(fsm_(),Int_<0>())*/ ) ),
+ (process2_(OneSong(),*(state_(m_src_it)++))/*,foobar_(fsm_(),Int_<0>())*/ ) ),
                                       NoAction(),
- attributes_ << vector<OneSong>::iterator()/*m_src_it*/
+ attributes_ << m_src_it
                                       , configure_<< SomeFlag() )) Foreach;
 
 
     // replaces the old transition table
- typedef BOOST_TYPEOF(build_stt
- ((Foreach() + OneSong() == StringFind() [if_then_else_(True_(),True_(),True_())],
- StringFind() + Found() == Insert() / (if_then_(True_(),NoAction())),
- StringFind() + NotFound() == Foreach() ,
- Insert() + Done() == Foreach()
+ typedef BOOST_TYPEOF(build_stt((
+ StringFind() == Foreach() + OneSong()[if_then_else_(True_(),True_(),True_())],
+ Insert() == StringFind() + Found() / (if_then_(True_(),NoAction())),
+ Foreach() == StringFind() + NotFound() ,
+ Foreach() == Insert() + Done()
           // +------------------------------------------------------------------------------+
                     ) ) ) transition_table;
     struct Log_No_Transition : euml_action<Log_No_Transition>
@@ -265,80 +275,80 @@
     // create a state machine "on the fly"
     typedef BOOST_TYPEOF(build_sm( transition_table(), //STT
                                     init_ << Foreach(), // Init
- //insert_(State_<4>(),begin_(State_<2>()),end_(State_<2>())),
- (insert_(State_<4>(),Int_<5>()),insert_(State_<4>(),Int_<6>()),insert_(State_<4>(),Int_<7>()),
- insert_(State_<4>(),Int_<8>()),insert_(State_<4>(),Int_<9>()),
- associative_erase_(State_<4>(),Int_<6>()),associative_erase_(State_<4>(),begin_(State_<4>())),
- associative_erase_(State_<4>(),begin_(State_<4>()),++begin_(State_<4>())),
- insert_(State_<2>(),begin_(State_<2>()),begin_(State_<3>()),end_(State_<3>())),
- State_<5>()[Int_<0>()]=Int_<0>(),State_<5>()[Int_<1>()]=Int_<1>()
- ,attribute_(substate_(Foreach(),fsm_()),Int_<m_src_it>())
- = begin_(attribute_(fsm_(),Int_<m_src_container>()))
- //,fill_(begin_(State_<9>()),end_(State_<9>()),Int_<0>())
- //,fill_n_(begin_(State_<9>()),Size_t_<2>(),Int_<0>())
- //,transform_(begin_(State_<4>()),end_(State_<4>()),begin_(State_<2>()),begin_(State_<4>()),
+ //insert_(state_(m_var4),begin_(state_(m_var2)),end_(state_(m_var2))),
+ (insert_(state_(m_var4),Int_<5>()),insert_(state_(m_var4),Int_<6>()),insert_(state_(m_var4),Int_<7>()),
+ insert_(state_(m_var4),Int_<8>()),insert_(state_(m_var4),Int_<9>()),
+ associative_erase_(state_(m_var4),Int_<6>()),associative_erase_(state_(m_var4),begin_(state_(m_var4))),
+ associative_erase_(state_(m_var4),begin_(state_(m_var4)),++begin_(state_(m_var4))),
+ insert_(state_(m_var2),begin_(state_(m_var2)),begin_(state_(m_var3)),end_(state_(m_var3))),
+ state_(m_var5)[Int_<0>()]=Int_<0>(),state_(m_var5)[Int_<1>()]=Int_<1>()
+ ,attribute_(substate_(Foreach(),fsm_()),m_src_it)
+ = begin_(fsm_(m_src_container))
+ //,fill_(begin_(state_(m_var9)),end_(state_(m_var9)),Int_<0>())
+ //,fill_n_(begin_(state_(m_var9)),Size_t_<2>(),Int_<0>())
+ //,transform_(begin_(state_(m_var4)),end_(state_(m_var4)),begin_(state_(m_var2)),begin_(state_(m_var4)),
                                     // Predicate_<std::plus<int> >())
                                     //,process_(Done(),fsm_(),fsm_())
                                     //,process_(Done(),fsm_())
                                     //,fsm_()
                                     //,foobar_(state_(),Int_<0>(),Int_<1>())
- //,nth_element_(begin_(State_<9>()),++begin_(State_<9>()),end_(State_<9>()),Predicate_<std::less<int> >())
- //,partial_sort_(begin_(State_<9>()),end_(State_<9>()),end_(State_<9>()),Predicate_<std::less<int> >())
- //,partial_sort_copy_(begin_(State_<9>()),end_(State_<9>()),begin_(State_<9>()),end_(State_<9>()),Predicate_<std::less<int> >())
- //,list_sort_(State_<2>())
- //,sort_(begin_(State_<9>()),end_(State_<9>()),Predicate_<std::less<int> >())
- //,inner_product_(begin_(State_<9>()),end_(State_<9>()),begin_(State_<9>()),Int_<1>())
- //,replace_copy_(begin_(State_<4>()),end_(State_<4>()),begin_(State_<4>()),Int_<8>(),Int_<7>())
- //,replace_copy_if_(begin_(State_<4>()),end_(State_<4>()),begin_(State_<4>()),Predicate_<LookFor<9> >(),Int_<8>())
- //,replace_(begin_(State_<4>()),end_(State_<4>()),Int_<8>(),Int_<7>())
- //,replace_if_(begin_(State_<4>()),end_(State_<4>()),Predicate_<LookFor<9> >(),Int_<8>())
- //,adjacent_difference_(begin_(State_<9>()),end_(State_<9>()),begin_(State_<9>()))
- //,partial_sum_(begin_(State_<9>()),end_(State_<9>()),begin_(State_<9>()))
- //,inner_product_(begin_(State_<9>()),end_(State_<9>()),begin_(State_<9>()),Int_<1>())
- //,next_permutation_(begin_(State_<9>()),end_(State_<9>()),Predicate_<std::less<int> >())
- //,prev_permutation_(begin_(State_<9>()),end_(State_<9>()),Predicate_<std::less<int> >())
- //,set_union_(begin_(State_<9>()),end_(State_<9>()),begin_(State_<9>()),end_(State_<9>()),begin_(State_<9>()))
- //,inplace_merge_(begin_(State_<9>()),end_(State_<9>()),end_(State_<9>()),Predicate_<std::less<int> >())
- //,merge_(begin_(State_<9>()),end_(State_<9>()),begin_(State_<9>()),end_(State_<9>())
- // ,begin_(State_<9>()),Predicate_<std::less<int> >())
- //,stable_sort_(begin_(State_<9>()),end_(State_<9>()),Predicate_<std::less<int> >())
- //,partition_(begin_(State_<2>()),end_(State_<2>()),Predicate_<LessThan<3> >())
- //,stable_partition_(begin_(State_<2>()),end_(State_<2>()),Predicate_<LessThan<3> >())
- //,rotate_copy_(begin_(State_<2>()),++begin_(State_<2>()),end_(State_<2>()),begin_(State_<2>()))
- //,rotate_(begin_(State_<2>()),++begin_(State_<2>()),end_(State_<2>()))
- //,unique_(begin_(State_<2>()),end_(State_<2>()))
- //,unique_copy_(begin_(State_<2>()),end_(State_<2>()),begin_(State_<2>()))
- //,random_shuffle_(begin_(State_<9>()),end_(State_<9>()))
- //,generate_(begin_(State_<9>()),end_(State_<9>()),Predicate_<Generator>())
- //,generate_n_(begin_(State_<9>()),Int_<2>(),Predicate_<Generator>())
- //,reverse_copy_(begin_(State_<2>()),end_(State_<2>()),begin_(State_<2>()))
- //erase_(State_<m_src_container>(),
- // remove_if_(begin_(State_<m_src_container>()),end_(State_<m_src_container>()),
+ //,nth_element_(begin_(state_(m_var9)),++begin_(state_(m_var9)),end_(state_(m_var9)),Predicate_<std::less<int> >())
+ //,partial_sort_(begin_(state_(m_var9)),end_(state_(m_var9)),end_(state_(m_var9)),Predicate_<std::less<int> >())
+ //,partial_sort_copy_(begin_(state_(m_var9)),end_(state_(m_var9)),begin_(state_(m_var9)),end_(state_(m_var9)),Predicate_<std::less<int> >())
+ //,list_sort_(state_(m_var2))
+ //,sort_(begin_(state_(m_var9)),end_(state_(m_var9)),Predicate_<std::less<int> >())
+ //,inner_product_(begin_(state_(m_var9)),end_(state_(m_var9)),begin_(state_(m_var9)),Int_<1>())
+ //,replace_copy_(begin_(state_(m_var4)),end_(state_(m_var4)),begin_(state_(m_var4)),Int_<8>(),Int_<7>())
+ //,replace_copy_if_(begin_(state_(m_var4)),end_(state_(m_var4)),begin_(state_(m_var4)),Predicate_<LookFor<9> >(),Int_<8>())
+ //,replace_(begin_(state_(m_var4)),end_(state_(m_var4)),Int_<8>(),Int_<7>())
+ //,replace_if_(begin_(state_(m_var4)),end_(state_(m_var4)),Predicate_<LookFor<9> >(),Int_<8>())
+ //,adjacent_difference_(begin_(state_(m_var9)),end_(state_(m_var9)),begin_(state_(m_var9)))
+ //,partial_sum_(begin_(state_(m_var9)),end_(state_(m_var9)),begin_(state_(m_var9)))
+ //,inner_product_(begin_(state_(m_var9)),end_(state_(m_var9)),begin_(state_(m_var9)),Int_<1>())
+ //,next_permutation_(begin_(state_(m_var9)),end_(state_(m_var9)),Predicate_<std::less<int> >())
+ //,prev_permutation_(begin_(state_(m_var9)),end_(state_(m_var9)),Predicate_<std::less<int> >())
+ //,set_union_(begin_(state_(m_var9)),end_(state_(m_var9)),begin_(state_(m_var9)),end_(state_(m_var9)),begin_(state_(m_var9)))
+ //,inplace_merge_(begin_(state_(m_var9)),end_(state_(m_var9)),end_(state_(m_var9)),Predicate_<std::less<int> >())
+ //,merge_(begin_(state_(m_var9)),end_(state_(m_var9)),begin_(state_(m_var9)),end_(state_(m_var9))
+ // ,begin_(state_(m_var9)),Predicate_<std::less<int> >())
+ //,stable_sort_(begin_(state_(m_var9)),end_(state_(m_var9)),Predicate_<std::less<int> >())
+ //,partition_(begin_(state_(m_var2)),end_(state_(m_var2)),Predicate_<LessThan<3> >())
+ //,stable_partition_(begin_(state_(m_var2)),end_(state_(m_var2)),Predicate_<LessThan<3> >())
+ //,rotate_copy_(begin_(state_(m_var2)),++begin_(state_(m_var2)),end_(state_(m_var2)),begin_(state_(m_var2)))
+ //,rotate_(begin_(state_(m_var2)),++begin_(state_(m_var2)),end_(state_(m_var2)))
+ //,unique_(begin_(state_(m_var2)),end_(state_(m_var2)))
+ //,unique_copy_(begin_(state_(m_var2)),end_(state_(m_var2)),begin_(state_(m_var2)))
+ //,random_shuffle_(begin_(state_(m_var9)),end_(state_(m_var9)))
+ //,generate_(begin_(state_(m_var9)),end_(state_(m_var9)),Predicate_<Generator>())
+ //,generate_n_(begin_(state_(m_var9)),Int_<2>(),Predicate_<Generator>())
+ //,reverse_copy_(begin_(state_(m_var2)),end_(state_(m_var2)),begin_(state_(m_var2)))
+ //erase_(state_(m_src_container),
+ // remove_if_(begin_(state_(m_src_container)),end_(state_(m_src_container)),
                                     // Predicate_<RemoveDummy>()),
- // end_(State_<m_src_container>())),
- //list_remove_(State_<2>(),Int_<3>()),
- //remove_copy_if_(begin_(State_<9>()),end_(State_<9>()),back_inserter_(State_<2>()),
+ // end_(state_(m_src_container))),
+ //list_remove_(state_(m_var2),Int_<3>()),
+ //remove_copy_if_(begin_(state_(m_var9)),end_(state_(m_var9)),back_inserter_(state_(m_var2)),
                                     // Predicate_<LookFor<2> >() )
- //for_each_(begin_(State_<m_src_container>()),end_(State_<m_src_container>()),
+ //for_each_(begin_(state_(m_src_container)),end_(state_m_src_container()),
                                     // Predicate_<Print>() ),
- //copy_(begin_(State_<9>()),end_(State_<9>()),inserter_(State_<2>(),end_(State_<2>()))),
- //reverse_(begin_(State_<2>()),end_(State_<2>()))
+ //copy_(begin_(state_(m_var9)),end_(state_(m_var9)),inserter_(state_(m_var2),end_(state_(m_var2)))),
+ //reverse_(begin_(state_(m_var2)),end_(state_(m_var2)))
                                     ),
                                     //NoAction(), // Entry
- //splice_(State_<2>(),begin_(State_<2>()),State_<3>(),begin_(State_<3>()),end_(State_<3>())),
- //(list_remove_(State_<2>(),Int_<3>()),list_merge_(State_<2>(),State_<3>(),Comparator())),//NoAction(), // Entry
+ //splice_(state_(m_var2),begin_(state_(m_var2)),state_(m_var3),begin_(state_(m_var3)),end_(state_(m_var3))),
+ //(list_remove_(state_(m_var2),Int_<3>()),list_merge_(state_(m_var2),state_(m_var3),Comparator())),//NoAction(), // Entry
                                     NoAction(), // Exit
- attributes_ << vector<OneSong>() /*m_src_container*/ // song list
- << list<OneSong>() /*m_tgt_container*/ // result
- << list<int>()
- << list<int>()
- << std::set<int>()
- << std::map<int,int>()
- << std::string()
- << std::string()
- << std::vector<int>()
- << std::vector<int>()
- << int(),
+ attributes_ << m_src_container // song list
+ << m_tgt_container // result
+ << m_var2
+ << m_var3
+ << m_var4
+ << m_var5
+ << m_var6
+ << m_var7
+ << m_var8
+ << m_var9
+ << m_var10,
                                     configure_<< no_configure_,
                                     Log_No_Transition()
                                     )) iPodSearch_helper;
@@ -355,58 +365,58 @@
         iPodSearch search;
         // fill our song list
         //search.get_attribute<m_src_container>().push_back(OneSong("She-Dummy. Remove this one"));
- search.get_attribute<m_src_container>().push_back(OneSong("Let it be"));
- search.get_attribute<m_src_container>().push_back(OneSong("Yellow submarine"));
- search.get_attribute<m_src_container>().push_back(OneSong("Twist and Shout"));
- search.get_attribute<m_src_container>().push_back(OneSong("She Loves You"));
-
- search.get_attribute<2>().push_back(1);
- search.get_attribute<2>().push_back(3);
- search.get_attribute<2>().push_back(4);
-
- search.get_attribute<3>().push_back(2);
- search.get_attribute<3>().push_back(4);
-
- search.get_attribute<6>() = "S";
- search.get_attribute<7>() = "- Some text";
-
- search.get_attribute<8>().push_back(1);
- search.get_attribute<8>().push_back(2);
- search.get_attribute<8>().push_back(3);
- search.get_attribute<8>().push_back(4);
+ search.get_attribute(m_src_container).push_back(OneSong("Let it be"));
+ search.get_attribute(m_src_container).push_back(OneSong("Yellow submarine"));
+ search.get_attribute(m_src_container).push_back(OneSong("Twist and Shout"));
+ search.get_attribute(m_src_container).push_back(OneSong("She Loves You"));
+
+ search.get_attribute(m_var2).push_back(1);
+ search.get_attribute(m_var2).push_back(3);
+ search.get_attribute(m_var2).push_back(4);
+
+ search.get_attribute(m_var3).push_back(2);
+ search.get_attribute(m_var3).push_back(4);
+
+ search.get_attribute(m_var6) = "S";
+ search.get_attribute(m_var7) = "- Some text";
+
+ search.get_attribute(m_var8).push_back(1);
+ search.get_attribute(m_var8).push_back(2);
+ search.get_attribute(m_var8).push_back(3);
+ search.get_attribute(m_var8).push_back(4);
 
- search.get_attribute<9>().push_back(1);
- search.get_attribute<9>().push_back(2);
+ search.get_attribute(m_var9).push_back(1);
+ search.get_attribute(m_var9).push_back(2);
 
 
         // look for "She Loves You" using the first letters
- search.get_state<StringFind&>().get_attribute<m_letters>()="Sh";
+ search.get_state<StringFind&>().get_attribute(m_letters)="Sh";
         // needed to start the highest-level SM. This will call on_entry and mark the start of the SM
         search.start();
         // display all the songs
- for (list<OneSong>::const_iterator it = search.get_attribute<m_tgt_container>().begin();
- it != search.get_attribute<m_tgt_container>().end();++it)
+ for (list<OneSong>::const_iterator it = search.get_attribute(m_tgt_container).begin();
+ it != search.get_attribute(m_tgt_container).end();++it)
         {
             cout << "candidate song:" << (*it).get_data() << endl;
         }
- for (list<int>::const_iterator iti = search.get_attribute<2>().begin();
- iti != search.get_attribute<2>().end();++iti)
+ for (list<int>::const_iterator iti = search.get_attribute(m_var2).begin();
+ iti != search.get_attribute(m_var2).end();++iti)
         {
- cout << "int in attribute<2>:" << (*iti) << endl;
+ cout << "int in attribute m_var2:" << (*iti) << endl;
         }
- for (set<int>::const_iterator its = search.get_attribute<4>().begin();
- its != search.get_attribute<4>().end();++its)
+ for (set<int>::const_iterator its = search.get_attribute(m_var4).begin();
+ its != search.get_attribute(m_var4).end();++its)
         {
- cout << "int in attribute<4>:" << (*its) << endl;
+ cout << "int in attribute m_var4:" << (*its) << endl;
         }
         cout << "search using more letters" << endl;
         // look for "She Loves You" using more letters
- search.get_state<StringFind&>().get_attribute<m_letters>()="She";
- search.get_attribute<m_tgt_container>().clear();
+ search.get_state<StringFind&>().get_attribute(m_letters)="She";
+ search.get_attribute(m_tgt_container).clear();
         search.start();
         // display all the songs
- for (list<OneSong>::const_iterator it = search.get_attribute<m_tgt_container>().begin();
- it != search.get_attribute<m_tgt_container>().end();++it)
+ for (list<OneSong>::const_iterator it = search.get_attribute(m_tgt_container).begin();
+ it != search.get_attribute(m_tgt_container).end();++it)
         {
             cout << "candidate song:" << (*it).get_data() << endl;
         }

Modified: sandbox/msm/libs/msm/doc/CompositeTutorialEuml.cpp
==============================================================================
--- sandbox/msm/libs/msm/doc/CompositeTutorialEuml.cpp (original)
+++ sandbox/msm/libs/msm/doc/CompositeTutorialEuml.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -24,15 +24,16 @@
     struct region2_evt : euml_event<region2_evt>{};
 
     // A "complicated" event type that carries some data.
- typedef BOOST_TYPEOF(build_attributes(attributes_ << std::string() << DiskTypeEnum() )) cd_detected_attributes;
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << cd_name << cd_type )) cd_detected_attributes;
     struct cd_detected : euml_event<cd_detected>,cd_detected_attributes
-
     {
         cd_detected(){}
         cd_detected(std::string name, DiskTypeEnum diskType)
         {
- get_attribute<0>()=name;
- get_attribute<1>()=diskType;
+ get_attribute(cd_name)=name;
+ get_attribute(cd_type)=diskType;
         }
     };
 
@@ -91,6 +92,23 @@
     // choice of back-end
     typedef msm::back::state_machine<Playing_> Playing;
 
+ // guard conditions
+ struct good_disk_format : euml_action<good_disk_format>
+ {
+ template <class FSM,class EVT,class SourceState,class TargetState>
+ bool operator()(EVT const& evt,FSM&,SourceState& ,TargetState& )
+ {
+ // to test a guard condition, let's say we understand only CDs, not DVD
+ if (evt.get_attribute(cd_type)!=DISK_CD)
+ {
+ std::cout << "wrong disk, sorry" << std::endl;
+ // just for logging, does not block any transition
+ return true;
+ }
+ std::cout << "good disk" << std::endl;
+ return true;
+ }
+ };
     // replaces the old transition table
     typedef BOOST_TYPEOF(build_stt((
         Playing() == Stopped() + play() / start_playback() ,
@@ -107,7 +125,7 @@
         // +------------------------------------------------------------------------------+
         Stopped() == Playing() + stop() / stop_playback(),
         Stopped() == Paused() + stop() / stop_playback(),
- Stopped() == Empty() + cd_detected() [good_disk_format()&&(Event_<1>()==Int_<DISK_CD>())]
+ Stopped() == Empty() + cd_detected() [good_disk_format()&&(Event_<cd_type_>()==Int_<DISK_CD>())]
                         / (store_cd_info(),process_(play())),
         Stopped() == Stopped() + stop()
         // +------------------------------------------------------------------------------+

Added: sandbox/msm/libs/msm/doc/EumlInternal.cpp
==============================================================================
--- (empty file)
+++ sandbox/msm/libs/msm/doc/EumlInternal.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -0,0 +1,187 @@
+#include <vector>
+#include <iostream>
+
+//#define BOOST_PROTO_MAX_ARITY 5
+#include <boost/msm/back/state_machine.hpp>
+#include <boost/msm/front/euml/euml.hpp>
+
+using namespace std;
+using namespace boost::msm::front::euml;
+using namespace boost::msm::front;
+namespace msm = boost::msm;
+
+// entry/exit/action/guard logging functors
+#include "logging_functors.h"
+
+namespace // Concrete FSM implementation
+{
+ // events
+ // note that unlike the SimpleTutorial, events must derive from euml_event.
+ struct play : euml_event<play>{};
+ struct end_pause : euml_event<end_pause>{};
+ struct stop : euml_event<stop>{};
+ struct pause : euml_event<pause>{};
+ struct open_close : euml_event<open_close>{};
+ struct internal_event : euml_event<internal_event>{};
+
+ // A "complicated" event type that carries some data.
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << cd_name << cd_type )) cd_detected_attributes;
+ struct cd_detected : euml_event<cd_detected>,cd_detected_attributes
+ {
+ cd_detected(){}
+ cd_detected(std::string name, DiskTypeEnum diskType)
+ {
+ get_attribute(cd_name)=name;
+ get_attribute(cd_type)=diskType;
+ }
+ };
+
+
+ // Concrete FSM implementation
+
+ // The list of FSM states
+
+ typedef BOOST_TYPEOF(build_state(Empty_Entry(),Empty_Exit())) Empty;
+
+ typedef BOOST_TYPEOF(build_state( Open_Entry(),Open_Exit() )) Open;
+
+ typedef BOOST_TYPEOF(build_state( Stopped_Entry(),Stopped_Exit() )) Stopped;
+
+ typedef BOOST_TYPEOF(build_state( (Playing_Entry()),(Playing_Exit()) )) Playing;
+
+ // state not needing any entry or exit
+ typedef BOOST_TYPEOF(build_state( )) Paused;
+
+ // guard conditions
+ struct good_disk_format : euml_action<good_disk_format>
+ {
+ template <class FSM,class EVT,class SourceState,class TargetState>
+ bool operator()(EVT const& evt,FSM&,SourceState& ,TargetState& )
+ {
+ // to test a guard condition, let's say we understand only CDs, not DVD
+ if (evt.get_attribute(cd_type)!=DISK_CD)
+ {
+ std::cout << "wrong disk, sorry" << std::endl;
+ // just for logging, does not block any transition
+ return true;
+ }
+ std::cout << "good disk" << std::endl;
+ return true;
+ }
+ };
+ // replaces the old transition table
+ typedef BOOST_TYPEOF(build_stt((
+ Playing() == Stopped() + play() / start_playback() ,
+ Playing() == Paused() + end_pause() / resume_playback(),
+ // +------------------------------------------------------------------------------+
+ Empty() == Open() + open_close() / close_drawer(),
+ // +------------------------------------------------------------------------------+
+ Open() == Empty() + open_close() / open_drawer(),
+ Open() == Paused() + open_close() / stop_and_open(),
+ Open() == Stopped() + open_close() / open_drawer(),
+ Open() == Playing() + open_close() / stop_and_open(),
+ Open() + open_close() [internal_guard1()] / internal_action1(),
+ Open() + open_close() [internal_guard2()] / internal_action2(),
+ Open() + internal_event() / internal_action() ,
+ // +------------------------------------------------------------------------------+
+ Paused() == Playing() + pause() / pause_playback(),
+ // +------------------------------------------------------------------------------+
+ Stopped() == Playing() + stop() / stop_playback(),
+ Stopped() == Paused() + stop() / stop_playback(),
+ Stopped() == Empty() + cd_detected() [good_disk_format()&&
+ (attribute_(event_(),cd_type)==Int_<DISK_CD>())]
+ / (store_cd_info(),process_(play())),
+ Stopped() == Stopped() + stop()
+ // +------------------------------------------------------------------------------+
+ ) ) ) transition_table;
+
+ //typedef BOOST_TYPEOF(build_sm( transition_table(), //STT
+ // init_ << Empty(), // Init State
+ // NoAction(), // Entry
+ // NoAction(), // Exit
+ // attributes_ << no_attributes_, // Attributes
+ // configure_<< no_configure_, // Flags, Deferred events, configuration
+ // Log_No_Transition() // no_transition handler
+ // )) player_;
+ // or simply, if no no_transition handler needed:
+ //typedef BOOST_TYPEOF(build_sm( transition_table(), //STT
+ // Empty() // Init State
+ // )) player_;
+
+ // create a state machine "on the fly"
+ // VC9 sometimes cannot compile the typedef with build_sm
+#ifndef BOOST_MSVC
+ // create a state machine "on the fly" for player
+ typedef BOOST_TYPEOF(build_sm( transition_table(), //STT
+ init_ << Empty(), // Init State
+ NoAction(), // Entry
+ NoAction(), // Exit
+ attributes_ << no_attributes_, // Attributes
+ configure_ << no_configure_,
+ Log_No_Transition() // no_transition handler
+ )) player_;
+#else
+ // but this definition is ok
+ struct player_ : public BOOST_TYPEOF(build_sm( transition_table(), //STT
+ init_ << Empty(), // Init State
+ NoAction(), // Entry
+ NoAction(), // Exit
+ attributes_ << no_attributes_, // Attributes
+ configure_ << no_configure_, // configuration
+ Log_No_Transition() // no_transition handler
+ ))
+ {
+ };
+#endif
+ // choice of back-end
+ typedef msm::back::state_machine<player_> player;
+
+ //
+ // Testing utilities.
+ //
+ static char const* const state_names[] = { "Stopped", "Paused", "Open", "Empty", "Playing" };
+ void pstate(player const& p)
+ {
+ std::cout << " -> " << state_names[p.current_state()[0]] << std::endl;
+ }
+
+ void test()
+ {
+ player p;
+ // needed to start the highest-level SM. This will call on_entry and mark the start of the SM
+ p.start();
+ // go to Open, call on_exit on Empty, then action, then on_entry on Open
+ p.process_event(open_close()); pstate(p);
+ std::cout << "sending internal event (not rejected)" << std::endl;
+ p.process_event(internal_event());
+ std::cout << "sending open_close event. Conflict with internal transitions (rejecting event)" << std::endl;
+ p.process_event(open_close()); pstate(p);
+ // will be rejected, wrong disk type
+ p.process_event(
+ cd_detected("louie, louie",DISK_DVD)); pstate(p);
+ p.process_event(
+ cd_detected("louie, louie",DISK_CD)); pstate(p);
+ // no need to call play() as the previous event does it in its action method
+ //p.process_event(play());
+
+ // at this point, Play is active
+ p.process_event(pause()); pstate(p);
+ // go back to Playing
+ p.process_event(end_pause()); pstate(p);
+ p.process_event(pause()); pstate(p);
+ p.process_event(stop()); pstate(p);
+ // event leading to the same state
+ // no action method called as none is defined in the transition table
+ p.process_event(stop()); pstate(p);
+ // test call to no_transition
+ p.process_event(pause()); pstate(p);
+ }
+}
+
+int main()
+{
+ test();
+ return 0;
+}

Added: sandbox/msm/libs/msm/doc/EumlInternal2.cpp
==============================================================================
--- (empty file)
+++ sandbox/msm/libs/msm/doc/EumlInternal2.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -0,0 +1,176 @@
+#include <vector>
+#include <iostream>
+
+//#define BOOST_PROTO_MAX_ARITY 5
+#include <boost/msm/back/state_machine.hpp>
+#include <boost/msm/front/euml/euml.hpp>
+
+using namespace std;
+using namespace boost::msm::front::euml;
+using namespace boost::msm::front;
+namespace msm = boost::msm;
+
+// entry/exit/action/guard logging functors
+#include "logging_functors.h"
+
+namespace // Concrete FSM implementation
+{
+ // events
+ // note that unlike the SimpleTutorial, events must derive from euml_event.
+ struct play : euml_event<play>{};
+ struct end_pause : euml_event<end_pause>{};
+ struct stop : euml_event<stop>{};
+ struct pause : euml_event<pause>{};
+ struct open_close : euml_event<open_close>{};
+ struct internal_event : euml_event<internal_event>{};
+
+ // A "complicated" event type that carries some data.
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << cd_name << cd_type )) cd_detected_attributes;
+ struct cd_detected : euml_event<cd_detected>,cd_detected_attributes
+ {
+ cd_detected(){}
+ cd_detected(std::string name, DiskTypeEnum diskType)
+ {
+ get_attribute(cd_name)=name;
+ get_attribute(cd_type)=diskType;
+ }
+ };
+
+ // Concrete FSM implementation
+
+ // The list of FSM states
+
+ typedef BOOST_TYPEOF(build_state(Empty_Entry(),Empty_Exit())) Empty;
+
+ typedef BOOST_TYPEOF(build_state( Open_Entry(),Open_Exit() )) Open;
+
+ typedef BOOST_TYPEOF(build_state( Stopped_Entry(),Stopped_Exit() )) Stopped;
+
+ typedef BOOST_TYPEOF(build_state( (Playing_Entry()),(Playing_Exit()) )) Playing;
+
+ // state not needing any entry or exit
+ typedef BOOST_TYPEOF(build_state( )) Paused;
+
+ // guard conditions
+ struct good_disk_format : euml_action<good_disk_format>
+ {
+ template <class FSM,class EVT,class SourceState,class TargetState>
+ bool operator()(EVT const& evt,FSM&,SourceState& ,TargetState& )
+ {
+ // to test a guard condition, let's say we understand only CDs, not DVD
+ if (evt.get_attribute(cd_type)!=DISK_CD)
+ {
+ std::cout << "wrong disk, sorry" << std::endl;
+ // just for logging, does not block any transition
+ return true;
+ }
+ std::cout << "good disk" << std::endl;
+ return true;
+ }
+ };
+ // replaces the old transition table
+ typedef BOOST_TYPEOF(build_stt
+ ((Stopped() + play() / start_playback() == Playing() ,
+ Stopped() + open_close() / open_drawer() == Open() ,
+ Stopped() + stop() == Stopped() ,
+ // +------------------------------------------------------------------------------+
+ Open() + open_close() / close_drawer() == Empty() ,
+ Open() + open_close() [internal_guard1()] / internal_action1() ,
+ Open() + open_close() [internal_guard2()] / internal_action2() ,
+ Open() + internal_event() / internal_action() ,
+ // +------------------------------------------------------------------------------+
+ Empty() + open_close() / open_drawer() == Open() ,
+ Empty() + cd_detected()
+ [good_disk_format()&&(attribute_(event_(),cd_type)==Int_<DISK_CD>())]
+ / (store_cd_info(),process_(play()))
+ == Stopped() ,
+ // +------------------------------------------------------------------------------+
+ Playing() + stop() / stop_playback() == Stopped() ,
+ Playing() + pause() / pause_playback() == Paused() ,
+ Playing() + open_close() / stop_and_open() == Open() ,
+ // +------------------------------------------------------------------------------+
+ Paused() + end_pause() / resume_playback() == Playing() ,
+ Paused() + stop() / stop_playback() == Stopped() ,
+ Paused() + open_close() / stop_and_open() == Open()
+ // +------------------------------------------------------------------------------+
+ ) ) ) transition_table;
+
+
+
+ // create a state machine "on the fly"
+ // VC9 sometimes cannot compile the typedef with build_sm
+#ifndef BOOST_MSVC
+ // create a state machine "on the fly" for player
+ typedef BOOST_TYPEOF(build_sm( transition_table(), //STT
+ init_ << Empty(), // Init State
+ NoAction(), // Entry
+ NoAction(), // Exit
+ attributes_ << no_attributes_, // Attributes
+ configure_ << no_configure_,
+ Log_No_Transition() // no_transition handler
+ )) player_;
+#else
+ // but this definition is ok
+ struct player_ : public BOOST_TYPEOF(build_sm( transition_table(), //STT
+ init_ << Empty(), // Init State
+ NoAction(), // Entry
+ NoAction(), // Exit
+ attributes_ << no_attributes_, // Attributes
+ configure_ << no_configure_, // configuration
+ Log_No_Transition() // no_transition handler
+ ))
+ {
+ };
+#endif
+ // choice of back-end
+ typedef msm::back::state_machine<player_> player;
+
+ //
+ // Testing utilities.
+ //
+ static char const* const state_names[] = { "Stopped", "Open", "Empty", "Playing", "Paused" };
+ void pstate(player const& p)
+ {
+ std::cout << " -> " << state_names[p.current_state()[0]] << std::endl;
+ }
+
+ void test()
+ {
+ player p;
+ // needed to start the highest-level SM. This will call on_entry and mark the start of the SM
+ p.start();
+ // go to Open, call on_exit on Empty, then action, then on_entry on Open
+ p.process_event(open_close()); pstate(p);
+ std::cout << "sending internal event (not rejected)" << std::endl;
+ p.process_event(internal_event());
+ std::cout << "sending open_close event. Conflict with internal transitions (rejecting event)" << std::endl;
+ p.process_event(open_close()); pstate(p);
+ // will be rejected, wrong disk type
+ p.process_event(
+ cd_detected("louie, louie",DISK_DVD)); pstate(p);
+ p.process_event(
+ cd_detected("louie, louie",DISK_CD)); pstate(p);
+ // no need to call play() as the previous event does it in its action method
+ //p.process_event(play());
+
+ // at this point, Play is active
+ p.process_event(pause()); pstate(p);
+ // go back to Playing
+ p.process_event(end_pause()); pstate(p);
+ p.process_event(pause()); pstate(p);
+ p.process_event(stop()); pstate(p);
+ // event leading to the same state
+ // no action method called as none is defined in the transition table
+ p.process_event(stop()); pstate(p);
+ // test call to no_transition
+ p.process_event(pause()); pstate(p);
+ }
+}
+
+int main()
+{
+ test();
+ return 0;
+}

Added: sandbox/msm/libs/msm/doc/EumlInternalDistributed.cpp
==============================================================================
--- (empty file)
+++ sandbox/msm/libs/msm/doc/EumlInternalDistributed.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -0,0 +1,183 @@
+#include <vector>
+#include <iostream>
+
+//#define BOOST_PROTO_MAX_ARITY 5
+#include <boost/msm/back/state_machine.hpp>
+#include <boost/msm/front/euml/euml.hpp>
+
+using namespace std;
+using namespace boost::msm::front::euml;
+using namespace boost::msm::front;
+namespace msm = boost::msm;
+
+// entry/exit/action/guard logging functors
+#include "logging_functors.h"
+
+namespace // Concrete FSM implementation
+{
+ // events
+ // note that unlike the SimpleTutorial, events must derive from euml_event.
+ struct play : euml_event<play>{};
+ struct end_pause : euml_event<end_pause>{};
+ struct stop : euml_event<stop>{};
+ struct pause : euml_event<pause>{};
+ struct open_close : euml_event<open_close>{};
+ struct internal_event : euml_event<internal_event>{};
+
+ // A "complicated" event type that carries some data.
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << cd_name << cd_type )) cd_detected_attributes;
+ struct cd_detected : euml_event<cd_detected>,cd_detected_attributes
+ {
+ cd_detected(){}
+ cd_detected(std::string name, DiskTypeEnum diskType)
+ {
+ get_attribute(cd_name)=name;
+ get_attribute(cd_type)=diskType;
+ }
+ };
+
+
+ // Concrete FSM implementation
+
+ // The list of FSM states
+ typedef BOOST_TYPEOF(build_state(Empty_Entry(),Empty_Exit())) Empty;
+
+ typedef BOOST_TYPEOF(build_state( Open_Entry(),Open_Exit() )) Open_def;
+ struct Open : public Open_def
+ {
+ // declare a constructor for use in the following transition table
+ Open(){}
+ typedef BOOST_TYPEOF(build_stt((
+ Open() + open_close() [internal_guard1()] / internal_action1() ,
+ Open() + open_close() [internal_guard2()] / internal_action2() ,
+ Open() + internal_event() / internal_action()
+ ) ) ) internal_transition_table;
+ };
+
+ typedef BOOST_TYPEOF(build_state( Stopped_Entry(),Stopped_Exit() )) Stopped;
+
+ typedef BOOST_TYPEOF(build_state( (Playing_Entry()),(Playing_Exit()) )) Playing;
+
+ // state not needing any entry or exit
+ typedef BOOST_TYPEOF(build_state( )) Paused;
+
+ // guard conditions
+ struct good_disk_format : euml_action<good_disk_format>
+ {
+ template <class FSM,class EVT,class SourceState,class TargetState>
+ bool operator()(EVT const& evt,FSM&,SourceState& ,TargetState& )
+ {
+ // to test a guard condition, let's say we understand only CDs, not DVD
+ if (evt.get_attribute(cd_type)!=DISK_CD)
+ {
+ std::cout << "wrong disk, sorry" << std::endl;
+ // just for logging, does not block any transition
+ return true;
+ }
+ std::cout << "good disk" << std::endl;
+ return true;
+ }
+ };
+ // replaces the old transition table
+ typedef BOOST_TYPEOF(build_stt
+ ((Stopped() + play() / start_playback() == Playing() ,
+ Stopped() + open_close() / open_drawer() == Open() ,
+ Stopped() + stop() == Stopped() ,
+ // +------------------------------------------------------------------------------+
+ Open() + open_close() / close_drawer() == Empty() ,
+ // +------------------------------------------------------------------------------+
+ Empty() + open_close() / open_drawer() == Open() ,
+ Empty() + cd_detected()
+ [good_disk_format()&&(attribute_(event_(),cd_type)==Int_<DISK_CD>())]
+ / (store_cd_info(),process_(play()))
+ == Stopped() ,
+ // +------------------------------------------------------------------------------+
+ Playing() + stop() / stop_playback() == Stopped() ,
+ Playing() + pause() / pause_playback() == Paused() ,
+ Playing() + open_close() / stop_and_open() == Open() ,
+ // +------------------------------------------------------------------------------+
+ Paused() + end_pause() / resume_playback() == Playing() ,
+ Paused() + stop() / stop_playback() == Stopped() ,
+ Paused() + open_close() / stop_and_open() == Open()
+ // +------------------------------------------------------------------------------+
+ ) ) ) transition_table;
+
+
+
+ // create a state machine "on the fly"
+ // VC9 sometimes cannot compile the typedef with build_sm
+#ifndef BOOST_MSVC
+ // create a state machine "on the fly" for player
+ typedef BOOST_TYPEOF(build_sm( transition_table(), //STT
+ init_ << Empty(), // Init State
+ NoAction(), // Entry
+ NoAction(), // Exit
+ attributes_ << no_attributes_, // Attributes
+ configure_ << no_configure_,
+ Log_No_Transition() // no_transition handler
+ )) player_;
+#else
+ // but this definition is ok
+ struct player_ : public BOOST_TYPEOF(build_sm( transition_table(), //STT
+ init_ << Empty(), // Init State
+ NoAction(), // Entry
+ NoAction(), // Exit
+ attributes_ << no_attributes_, // Attributes
+ configure_ << no_configure_, // configuration
+ Log_No_Transition() // no_transition handler
+ ))
+ {
+ };
+#endif
+ // choice of back-end
+ typedef msm::back::state_machine<player_> player;
+
+ //
+ // Testing utilities.
+ //
+ static char const* const state_names[] = { "Stopped", "Open", "Empty", "Playing", "Paused" };
+ void pstate(player const& p)
+ {
+ std::cout << " -> " << state_names[p.current_state()[0]] << std::endl;
+ }
+
+ void test()
+ {
+ player p;
+ // needed to start the highest-level SM. This will call on_entry and mark the start of the SM
+ p.start();
+ // go to Open, call on_exit on Empty, then action, then on_entry on Open
+ p.process_event(open_close()); pstate(p);
+ std::cout << "sending internal event (not rejected)" << std::endl;
+ p.process_event(internal_event());
+ std::cout << "sending open_close event. Conflict with internal transitions (rejecting event)" << std::endl;
+ p.process_event(open_close()); pstate(p);
+ // will be rejected, wrong disk type
+ p.process_event(
+ cd_detected("louie, louie",DISK_DVD)); pstate(p);
+ p.process_event(
+ cd_detected("louie, louie",DISK_CD)); pstate(p);
+ // no need to call play() as the previous event does it in its action method
+ //p.process_event(play());
+
+ // at this point, Play is active
+ p.process_event(pause()); pstate(p);
+ // go back to Playing
+ p.process_event(end_pause()); pstate(p);
+ p.process_event(pause()); pstate(p);
+ p.process_event(stop()); pstate(p);
+ // event leading to the same state
+ // no action method called as none is defined in the transition table
+ p.process_event(stop()); pstate(p);
+ // test call to no_transition
+ p.process_event(pause()); pstate(p);
+ }
+}
+
+int main()
+{
+ test();
+ return 0;
+}

Modified: sandbox/msm/libs/msm/doc/FlagsTutorialEuml.cpp
==============================================================================
--- sandbox/msm/libs/msm/doc/FlagsTutorialEuml.cpp (original)
+++ sandbox/msm/libs/msm/doc/FlagsTutorialEuml.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -22,15 +22,16 @@
     struct previous_song : euml_event<previous_song>{};
 
     // A "complicated" event type that carries some data.
- typedef BOOST_TYPEOF(build_attributes(attributes_ << std::string() << DiskTypeEnum() )) cd_detected_attributes;
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << cd_name << cd_type )) cd_detected_attributes;
     struct cd_detected : euml_event<cd_detected>,cd_detected_attributes
-
     {
         cd_detected(){}
         cd_detected(std::string name, DiskTypeEnum diskType)
         {
- get_attribute<0>()=name;
- get_attribute<1>()=diskType;
+ get_attribute(cd_name)=name;
+ get_attribute(cd_type)=diskType;
         }
     };
 
@@ -73,10 +74,10 @@
     // Playing has a transition table
     typedef BOOST_TYPEOF(build_stt(
         // +------------------------------------------------------------------------------+
- ( Song1() + next_song() == Song2() / start_next_song(),
- Song2() + previous_song() == Song1() / start_prev_song(),
- Song2() + next_song() == Song3() / start_next_song(),
- Song3() + previous_song() == Song2() / start_prev_song()
+ ( Song2() == Song1() + next_song() / start_next_song(),
+ Song1() == Song2() + previous_song() / start_prev_song(),
+ Song3() == Song2() + next_song() / start_next_song(),
+ Song2() == Song3() + previous_song() / start_prev_song()
         // +------------------------------------------------------------------------------+
         ) ) ) playing_transition_table;
 
@@ -101,25 +102,43 @@
     // choice of back-end
     typedef msm::back::state_machine<Playing_> Playing;
 
+ // guard conditions
+ struct good_disk_format : euml_action<good_disk_format>
+ {
+ template <class FSM,class EVT,class SourceState,class TargetState>
+ bool operator()(EVT const& evt,FSM&,SourceState& ,TargetState& )
+ {
+ // to test a guard condition, let's say we understand only CDs, not DVD
+ if (evt.get_attribute(cd_type)!=DISK_CD)
+ {
+ std::cout << "wrong disk, sorry" << std::endl;
+ // just for logging, does not block any transition
+ return true;
+ }
+ std::cout << "good disk" << std::endl;
+ return true;
+ }
+ };
     // replaces the old transition table
- typedef BOOST_TYPEOF(build_stt
- ((Stopped() + play() == Playing() / start_playback() ,
- Stopped() + open_close() == Open() / open_drawer(),
- Stopped() + stop() == Stopped(),
+ typedef BOOST_TYPEOF(build_stt((
+ Playing() == Stopped() + play() / start_playback() ,
+ Playing() == Paused() + end_pause() / resume_playback(),
+ // +------------------------------------------------------------------------------+
+ Empty() == Open() + open_close() / close_drawer(),
           // +------------------------------------------------------------------------------+
- Open() + open_close() == Empty() / close_drawer(),
+ Open() == Empty() + open_close() / open_drawer(),
+ Open() == Paused() + open_close() / stop_and_open(),
+ Open() == Stopped() + open_close() / open_drawer(),
+ Open() == Playing() + open_close() / stop_and_open(),
           // +------------------------------------------------------------------------------+
- Empty() + open_close() == Open() / open_drawer(),
- Empty() + cd_detected() == Stopped() [good_disk_format()&&(Event_<1>()==Int_<DISK_CD>())]
- / (store_cd_info(),process_(play())),
- // +------------------------------------------------------------------------------+
- Playing() + stop() == Stopped() / stop_playback(),
- Playing() + pause() == Paused() / pause_playback(),
- Playing() + open_close() == Open() / stop_and_open(),
+ Paused() == Playing() + pause() / pause_playback(),
           // +------------------------------------------------------------------------------+
- Paused() + end_pause() == Playing() / resume_playback(),
- Paused() + stop() == Stopped() / stop_playback(),
- Paused() + open_close() == Open() / stop_and_open()
+ Stopped() == Playing() + stop() / stop_playback(),
+ Stopped() == Paused() + stop() / stop_playback(),
+ Stopped() == Empty() + cd_detected() [good_disk_format()&&
+ (event_(cd_type)==Int_<DISK_CD>())]
+ / (store_cd_info(),process_(play())),
+ Stopped() == Stopped() + stop()
           // +------------------------------------------------------------------------------+
                     ) ) ) transition_table;
 
@@ -143,7 +162,7 @@
     //
     // Testing utilities.
     //
- static char const* const state_names[] = { "Stopped", "Open", "Empty", "Playing", "Paused" };
+ static char const* const state_names[] = { "Stopped", "Paused", "Open", "Empty", "Playing" };
     void pstate(player const& p)
     {
         std::cout << " -> " << state_names[p.current_state()[0]] << std::endl;

Modified: sandbox/msm/libs/msm/doc/HistoryEuml.cpp
==============================================================================
--- sandbox/msm/libs/msm/doc/HistoryEuml.cpp (original)
+++ sandbox/msm/libs/msm/doc/HistoryEuml.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -22,18 +22,20 @@
     struct previous_song : euml_event<previous_song>{};
 
     // A "complicated" event type that carries some data.
- typedef BOOST_TYPEOF(build_attributes(attributes_ << std::string() << DiskTypeEnum() )) cd_detected_def;
- struct cd_detected : euml_event<cd_detected>,cd_detected_def
-
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << cd_name << cd_type )) cd_detected_attributes;
+ struct cd_detected : euml_event<cd_detected>,cd_detected_attributes
     {
         cd_detected(){}
         cd_detected(std::string name, DiskTypeEnum diskType)
         {
- get_attribute<0>()=name;
- get_attribute<1>()=diskType;
+ get_attribute(cd_name)=name;
+ get_attribute(cd_type)=diskType;
         }
     };
 
+
     // Seems to correct random VC9 bug
     struct PlayingPaused: euml_flag<PlayingPaused>{};
 
@@ -87,6 +89,23 @@
     // choice of back-end
     typedef msm::back::state_machine<Playing_,msm::back::ShallowHistory<mpl::vector<end_pause> > > Playing;
 
+ // guard conditions
+ struct good_disk_format : euml_action<good_disk_format>
+ {
+ template <class FSM,class EVT,class SourceState,class TargetState>
+ bool operator()(EVT const& evt,FSM&,SourceState& ,TargetState& )
+ {
+ // to test a guard condition, let's say we understand only CDs, not DVD
+ if (evt.get_attribute(cd_type)!=DISK_CD)
+ {
+ std::cout << "wrong disk, sorry" << std::endl;
+ // just for logging, does not block any transition
+ return true;
+ }
+ std::cout << "good disk" << std::endl;
+ return true;
+ }
+ };
     // replaces the old transition table
     typedef BOOST_TYPEOF(build_stt((
           Playing() == Stopped() + play() / start_playback() ,
@@ -103,7 +122,8 @@
           // +------------------------------------------------------------------------------+
           Stopped() == Playing() + stop() / stop_playback(),
           Stopped() == Paused() + stop() / stop_playback(),
- Stopped() == Empty() + cd_detected() [good_disk_format()&&(Event_<1>()==Int_<DISK_CD>())]
+ Stopped() == Empty() + cd_detected() [good_disk_format()&&
+ (event_(cd_type)==Int_<DISK_CD>())]
                                                     / (store_cd_info(),process_(play())),
           Stopped() == Stopped() + stop()
           // +------------------------------------------------------------------------------+

Modified: sandbox/msm/libs/msm/doc/OrthogonalDeferredEuml.cpp
==============================================================================
--- sandbox/msm/libs/msm/doc/OrthogonalDeferredEuml.cpp (original)
+++ sandbox/msm/libs/msm/doc/OrthogonalDeferredEuml.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -25,15 +25,16 @@
     struct error_found : euml_event<error_found> {};
 
     // A "complicated" event type that carries some data.
- typedef BOOST_TYPEOF(build_attributes(attributes_ << std::string() << DiskTypeEnum() )) cd_detected_attr;
- struct cd_detected : euml_event<cd_detected>,cd_detected_attr
-
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << cd_name << cd_type )) cd_detected_attributes;
+ struct cd_detected : euml_event<cd_detected>,cd_detected_attributes
     {
         cd_detected(){}
         cd_detected(std::string name, DiskTypeEnum diskType)
         {
- get_attribute<0>()=name;
- get_attribute<1>()=diskType;
+ get_attribute(cd_name)=name;
+ get_attribute(cd_type)=diskType;
         }
     };
 
@@ -116,6 +117,23 @@
     // choice of back-end
     typedef msm::back::state_machine<Playing_> Playing;
 
+ // guard conditions
+ struct good_disk_format : euml_action<good_disk_format>
+ {
+ template <class FSM,class EVT,class SourceState,class TargetState>
+ bool operator()(EVT const& evt,FSM&,SourceState& ,TargetState& )
+ {
+ // to test a guard condition, let's say we understand only CDs, not DVD
+ if (evt.get_attribute(cd_type)!=DISK_CD)
+ {
+ std::cout << "wrong disk, sorry" << std::endl;
+ // just for logging, does not block any transition
+ return true;
+ }
+ std::cout << "good disk" << std::endl;
+ return true;
+ }
+ };
     // replaces the old transition table
     typedef BOOST_TYPEOF(build_stt((
           Playing() == Stopped() + play() / start_playback() ,
@@ -132,9 +150,12 @@
           // +------------------------------------------------------------------------------+
           Stopped() == Playing() + stop() / stop_playback(),
           Stopped() == Paused() + stop() / stop_playback(),
- Stopped() == Empty() + cd_detected() [good_disk_format()&&(Event_<1>()==Int_<DISK_CD>())]
+ Stopped() == Empty() + cd_detected() [good_disk_format()&&
+ (event_(cd_type)==Int_<DISK_CD>())]
                                                     / (store_cd_info(),process_(play())),
- Stopped() == Stopped() + stop()
+ Stopped() == Stopped() + stop(),
+ ErrorMode() == AllOk() + error_found() / report_error(),
+ AllOk() == ErrorMode()+ end_error() / report_end_error()
           // +------------------------------------------------------------------------------+
                     ) ) ) transition_table;
 
@@ -158,7 +179,7 @@
     //
     // Testing utilities.
     //
- static char const* const state_names[] = { "Stopped", "Paused", "Open", "Empty", "Playing" };
+ static char const* const state_names[] = { "Stopped", "Paused", "Open", "Empty", "Playing","AllOk","ErrorMode" };
     void pstate(player const& p)
     {
         // we have now several active states, which we show
@@ -173,9 +194,6 @@
                 player p;
         // needed to start the highest-level SM. This will call on_entry and mark the start of the SM
         p.start();
- // test deferred event
- // deferred in Empty and Open, will be handled only after event cd_detected
- p.process_event(play());
 
         // tests some flags
         std::cout << "CDLoaded active:" << std::boolalpha << p.is_flag_active<CDLoaded>() << std::endl; //=> false (no CD yet)

Modified: sandbox/msm/libs/msm/doc/SimpleTimer.cpp
==============================================================================
--- sandbox/msm/libs/msm/doc/SimpleTimer.cpp (original)
+++ sandbox/msm/libs/msm/doc/SimpleTimer.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -10,31 +10,28 @@
 
 // how long the timer will ring when countdown elapsed.
 #define RINGING_TIME 5
-// the different attribute indexes (more readable than just 0)
-#define m_timer 0
-#define m_tick 0
-#define m_counter 0
-#define m_ringing_cpt 0
 
 namespace // Concrete FSM implementation
 {
     // events
- typedef BOOST_TYPEOF(build_attributes(attributes_ << int() /*m_timer*/ )) start_timer_attr;
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(int,m_timer)
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << m_timer )) start_timer_attr;
     struct start_timer : euml_event<start_timer>, start_timer_attr
     {
         start_timer(int counter=0)
         {
- get_attribute<m_timer>()=counter;
+ get_attribute(m_timer)=counter;
         }
     };
     struct stop_timer : euml_event<stop_timer>{};
 
- typedef BOOST_TYPEOF(build_attributes(attributes_ << int() /*m_tick*/ )) tick_attr;
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(int,m_tick)
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << m_tick )) tick_attr;
     struct tick : euml_event<tick>,tick_attr
     {
         tick(int counter=0)
         {
- get_attribute<m_tick>()=counter;
+ get_attribute(m_tick)=counter;
         }
     };
     struct start_ringing : euml_event<start_ringing>{};
@@ -60,7 +57,9 @@
             std::cout << "entering: Started" << std::endl;
         }
     };
- typedef BOOST_TYPEOF(build_state( Started_Entry(),NoAction(), attributes_ << int()/*m_counter*/ )) Started;
+
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(int,m_counter)
+ typedef BOOST_TYPEOF(build_state( Started_Entry(),NoAction(), attributes_ << m_counter )) Started;
 
     struct Ringing_Entry : euml_action<Ringing_Entry>
     {
@@ -70,31 +69,33 @@
             std::cout << "entering: Ringing" << std::endl;
         }
     };
- typedef BOOST_TYPEOF(build_state( Ringing_Entry(), NoAction(), attributes_ << int()/*M_RINGING_CPT*/ )) Ringing;
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(int,m_ringing_cpt)
+ typedef BOOST_TYPEOF(build_state( Ringing_Entry(), NoAction(), attributes_ << m_ringing_cpt )) Ringing;
 
     // replaces the old transition table
     typedef BOOST_TYPEOF(build_stt((
         // +------------------------------------------------------------------------------+
           // When we start the countdown, the countdown value is not hardcoded but contained in the start_timer event.
           // We copy this value into Started
- Started() == Stopped() + start_timer() / (Target_<m_counter>()= Event_<m_timer>()) ,
- Stopped() == Started() + stop_timer() ,
+ Started() == Stopped() + start_timer() /(target_(m_counter)= event_(m_timer)) ,
+ Stopped() == Started() + stop_timer() ,
           // internal transition
           Started() + tick()
                     // we here use the message queue to move to Started when the countdown is finished
                     // to do this we put start_ringing into the message queue
- / if_then_( (Source_<m_counter>() -= Event_<m_tick>()) <= Int_<0>(),
- process_(start_ringing()) ) ,
+ / if_then_( (source_(m_counter) -= event_(m_tick) ) <= Int_<0>(),
+ process_(start_ringing()) ) ,
           // when we start ringing, we give to the state its hard-coded ringing time.
- Ringing() == Started() + start_ringing() / (Target_<m_ringing_cpt>() = Int_<RINGING_TIME>()),
+ Ringing() == Started() + start_ringing()
+ / (target_(m_ringing_cpt) = Int_<RINGING_TIME>()) ,
           // to change a bit, we now do not use the message queue but a transition conflict to solve the same problem.
           // When tick is fired, we have an internal transition Ringing -> Ringing, as long as Counter > 0
- Ringing() + tick() [ Source_<m_ringing_cpt>() - Event_<m_tick>() > Int_<0>() ]
- / (Source_<m_ringing_cpt>() -= Event_<m_tick>() ) ,
+ Ringing() + tick() [ source_(m_ringing_cpt) - event_(m_tick) > Int_<0>() ]
+ /(target_(m_ringing_cpt) -= event_(m_tick) ) ,
           // And we move to Stopped when the counter is 0
- Stopped() == Ringing() + tick() [ Source_<m_ringing_cpt>()-Event_<m_tick>() <= Int_<0>() ],
+ Stopped() == Ringing() + tick()[source_(m_ringing_cpt)-event_(m_tick) <= Int_<0>()] ,
           // we let the user manually stop the ringing by pressing any button
- Stopped() == Ringing() + stop_timer() ,
+ Stopped() == Ringing() + stop_timer() ,
           Stopped() == Ringing() + start_timer()
           // +------------------------------------------------------------------------------+
                     ) ) ) transition_table;

Modified: sandbox/msm/libs/msm/doc/SimpleTutorialEuml.cpp
==============================================================================
--- sandbox/msm/libs/msm/doc/SimpleTutorialEuml.cpp (original)
+++ sandbox/msm/libs/msm/doc/SimpleTutorialEuml.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -22,25 +22,27 @@
     struct open_close : euml_event<open_close>{};
 
     // A "complicated" event type that carries some data.
- // first define the attributes
- typedef BOOST_TYPEOF(build_attributes(attributes_ << std::string() << DiskTypeEnum() )) cd_detected_def;
- // pass the attributes to the event
- struct cd_detected : euml_event<cd_detected>,cd_detected_def
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << cd_name << cd_type )) cd_detected_attributes;
+ struct cd_detected : euml_event<cd_detected>,cd_detected_attributes
     {
         cd_detected(){}
         cd_detected(std::string name, DiskTypeEnum diskType)
         {
- // 1st attribute, a string
- get_attribute<0>()=name;
- // 2nd attribute, a DiskTypeEnum
- get_attribute<1>()=diskType;
+ get_attribute(cd_name)=name;
+ get_attribute(cd_type)=diskType;
         }
     };
 
+
     // Concrete FSM implementation
 
     // The list of FSM states
 
+ // state not needing any entry or exit
+ typedef BOOST_TYPEOF(build_state( )) Paused;
+
     typedef BOOST_TYPEOF(build_state(Empty_Entry(),Empty_Exit())) Empty;
 
     typedef BOOST_TYPEOF(build_state( Open_Entry(),Open_Exit() )) Open;
@@ -49,9 +51,23 @@
 
     typedef BOOST_TYPEOF(build_state( (Playing_Entry()),(Playing_Exit()) )) Playing;
     
- // state not needing any entry or exit
- typedef BOOST_TYPEOF(build_state( )) Paused;
-
+ // guard conditions
+ struct good_disk_format : euml_action<good_disk_format>
+ {
+ template <class FSM,class EVT,class SourceState,class TargetState>
+ bool operator()(EVT const& evt,FSM&,SourceState& ,TargetState& )
+ {
+ // to test a guard condition, let's say we understand only CDs, not DVD
+ if (evt.get_attribute(cd_type)!=DISK_CD)
+ {
+ std::cout << "wrong disk, sorry" << std::endl;
+ // just for logging, does not block any transition
+ return true;
+ }
+ std::cout << "good disk" << std::endl;
+ return true;
+ }
+ };
     // replaces the old transition table
     typedef BOOST_TYPEOF(build_stt((
           Playing() == Stopped() + play() / start_playback() ,
@@ -68,7 +84,8 @@
           // +------------------------------------------------------------------------------+
           Stopped() == Playing() + stop() / stop_playback(),
           Stopped() == Paused() + stop() / stop_playback(),
- Stopped() == Empty() + cd_detected() [good_disk_format()&&(Event_<1>()==Int_<DISK_CD>())]
+ Stopped() == Empty() + cd_detected() [good_disk_format()&&
+ (event_(cd_type)==Int_<DISK_CD>())]
                                                     / (store_cd_info(),process_(play())),
           Stopped() == Stopped() + stop()
           // +------------------------------------------------------------------------------+

Modified: sandbox/msm/libs/msm/doc/SimpleTutorialEuml2.cpp
==============================================================================
--- sandbox/msm/libs/msm/doc/SimpleTutorialEuml2.cpp (original)
+++ sandbox/msm/libs/msm/doc/SimpleTutorialEuml2.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -22,21 +22,20 @@
     struct open_close : euml_event<open_close>{};
 
     // A "complicated" event type that carries some data.
- // first define the attributes
- typedef BOOST_TYPEOF(build_attributes(attributes_ << std::string() << DiskTypeEnum() )) cd_detected_def;
- // pass the attributes to the event
- struct cd_detected : euml_event<cd_detected>,cd_detected_def
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << cd_name << cd_type )) cd_detected_attributes;
+ struct cd_detected : euml_event<cd_detected>,cd_detected_attributes
     {
         cd_detected(){}
         cd_detected(std::string name, DiskTypeEnum diskType)
         {
- // 1st attribute, a string
- get_attribute<0>()=name;
- // 2nd attribute, a DiskTypeEnum
- get_attribute<1>()=diskType;
+ get_attribute(cd_name)=name;
+ get_attribute(cd_type)=diskType;
         }
     };
 
+
     // Concrete FSM implementation
 
     // The list of FSM states
@@ -52,7 +51,23 @@
 
     typedef BOOST_TYPEOF(build_state( (Playing_Entry()),(Playing_Exit()) )) Playing;
     
-
+ // guard conditions
+ struct good_disk_format : euml_action<good_disk_format>
+ {
+ template <class FSM,class EVT,class SourceState,class TargetState>
+ bool operator()(EVT const& evt,FSM&,SourceState& ,TargetState& )
+ {
+ // to test a guard condition, let's say we understand only CDs, not DVD
+ if (evt.get_attribute(cd_type)!=DISK_CD)
+ {
+ std::cout << "wrong disk, sorry" << std::endl;
+ // just for logging, does not block any transition
+ return true;
+ }
+ std::cout << "good disk" << std::endl;
+ return true;
+ }
+ };
     // replaces the old transition table
     typedef BOOST_TYPEOF(build_stt((
           Stopped() + play() / start_playback() == Playing() ,
@@ -63,7 +78,7 @@
           // +------------------------------------------------------------------------------+
           Empty() + open_close() / open_drawer() == Open() ,
           Empty() + cd_detected()
- [good_disk_format()&&(Event_<1>()==Int_<DISK_CD>())]
+ [good_disk_format()&&(attribute_(event_(),cd_type)==Int_<DISK_CD>())]
             / (store_cd_info(),process_(play())) == Stopped() ,
          // +------------------------------------------------------------------------------+
           Playing() + stop() / stop_playback() == Stopped() ,

Modified: sandbox/msm/libs/msm/doc/SimpleTutorialInternal.cpp
==============================================================================
--- sandbox/msm/libs/msm/doc/SimpleTutorialInternal.cpp (original)
+++ sandbox/msm/libs/msm/doc/SimpleTutorialInternal.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -16,6 +16,7 @@
     struct stop {};
     struct pause {};
     struct open_close {};
+ struct to_ignore {};
 
     // A "complicated" event type that carries some data.
         enum DiskTypeEnum
@@ -145,6 +146,7 @@
           a_row < Empty , open_close , Open , &p::open_drawer >,
             row < Empty , cd_detected , Stopped , &p::store_cd_info ,&p::good_disk_format >,
            irow < Empty , cd_detected , &p::internal_action ,&p::internal_guard >,
+ _irow < Empty , to_ignore >,
          g_irow < Empty , cd_detected ,&p::internal_guard >,
             Row < Empty , cd_detected , none , internal_action_fct ,internal_guard_fct >,
             // +---------+-------------+---------+---------------------+----------------------+
@@ -184,6 +186,8 @@
                 player p;
         // needed to start the highest-level SM. This will call on_entry and mark the start of the SM
         p.start();
+ // this event will be ignored and not call no_transition
+ p.process_event(to_ignore());
         // go to Open, call on_exit on Empty, then action, then on_entry on Open
         p.process_event(open_close()); pstate(p);
         p.process_event(open_close()); pstate(p);

Modified: sandbox/msm/libs/msm/doc/TestInternal.cpp
==============================================================================
--- sandbox/msm/libs/msm/doc/TestInternal.cpp (original)
+++ sandbox/msm/libs/msm/doc/TestInternal.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -1,4 +1,6 @@
 #include <iostream>
+#include "boost/mpl/vector/vector30.hpp"
+
 // back-end
 #include <boost/msm/back/state_machine.hpp>
 //front-end
@@ -20,6 +22,7 @@
     struct open_close {};
     struct NextSong {};
     struct PreviousSong {};
+ struct to_ignore {};
 
     // A "complicated" event type that carries some data.
         enum DiskTypeEnum
@@ -106,7 +109,8 @@
             struct internal_transition_table : mpl::vector<
                 // Start Event Next Action Guard
                 Row < Empty , cd_detected , none , internal_action_fct ,internal_guard_fct >,
- Internal < cd_detected , internal_action_fct ,internal_guard_fct >
+ Internal < cd_detected , internal_action_fct ,internal_guard_fct >,
+ _internal< to_ignore >
                 // +---------+-------------+---------+---------------------+----------------------+
> {};
         };
@@ -287,6 +291,8 @@
                 player p;
         // needed to start the highest-level SM. This will call on_entry and mark the start of the SM
         p.start();
+ // this event will be ignored and not call no_transition
+ p.process_event(to_ignore());
         // go to Open, call on_exit on Empty, then action, then on_entry on Open
         p.process_event(open_close()); pstate(p);
         p.process_event(open_close()); pstate(p);

Modified: sandbox/msm/libs/msm/doc/iPodSearchEuml.cpp
==============================================================================
--- sandbox/msm/libs/msm/doc/iPodSearchEuml.cpp (original)
+++ sandbox/msm/libs/msm/doc/iPodSearchEuml.cpp 2010-02-11 06:19:49 EST (Thu, 11 Feb 2010)
@@ -16,51 +16,52 @@
 // how long the timer will ring when countdown elapsed.
 #define RINGING_TIME 5
 
-#define m_src_container 0
-#define m_tgt_container 1
-#define m_song 0
-#define m_letters 0
-#define m_src_it 0
-
 namespace // Concrete FSM implementation
 {
     // events
- typedef BOOST_TYPEOF(build_attributes(attributes_ << string()/*m_song*/ )) OneSongDef;
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_song)
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << m_song )) OneSongDef;
     struct OneSong : euml_event<OneSong>,OneSongDef
     {
         OneSong(){}
         OneSong(const string& asong)
         {
- get_attribute<m_song>()=asong;
+ get_attribute(m_song)=asong;
         }
         OneSong(const char* asong)
         {
- get_attribute<m_song>()=asong;
+ get_attribute(m_song)=asong;
         }
         OneSong(const OneSong& asong)
         {
- get_attribute<m_song>()=asong.get_attribute<m_song>();
+ get_attribute(m_song)=asong.get_attribute(m_song);
         }
- const string& get_data() const {return get_attribute<m_song>();}
+ const string& get_data() const {return get_attribute(m_song);}
     };
+ // attribute definitions
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(vector<OneSong>,m_src_container)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(vector<OneSong>,m_tgt_container)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_letters)
+ BOOST_MSM_EUML_DECLARE_ATTRIBUTE(vector<OneSong>::iterator,m_src_it)
 
- typedef BOOST_TYPEOF(build_attributes(attributes_ << string()/*m_song*/ )) NotFoundDef;
+ // the same attribute name can be reused
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << m_song )) NotFoundDef;
     struct NotFound : euml_event<NotFound>,NotFoundDef
     {
         NotFound(){}
         NotFound (const string& data)
         {
- get_attribute<m_song>()=data;
+ get_attribute(m_song)=data;
         }
     };
 
- typedef BOOST_TYPEOF(build_attributes(attributes_ << string()/*m_song*/ )) FoundDef;
+ typedef BOOST_TYPEOF(build_attributes(attributes_ << m_song )) FoundDef;
     struct Found : euml_event<Found>,FoundDef
     {
         Found(){}
         Found (const string& data)
         {
- get_attribute<m_song>()=data;
+ get_attribute(m_song)=data;
         }
     };
     struct Done : euml_event<Done> {};
@@ -69,20 +70,22 @@
     // Concrete FSM implementation
 
     // The list of FSM states
- typedef BOOST_TYPEOF(build_state( (push_back_(Fsm_<m_tgt_container>(),Event_<m_song>()) ,process_(Done())),
+ typedef BOOST_TYPEOF(build_state( (push_back_(fsm_(m_tgt_container),event_(m_song))
+ ,process_(Done())),
                                        NoAction() )) Insert;
 
 
- typedef BOOST_TYPEOF(build_state( if_then_else_( string_find_(Event_<m_song>(),State_<m_letters>()) != Npos_<string>() ,
- process2_(Found(),Event_<m_song>()),
- process2_(NotFound(),Event_<m_song>()) ) ,
+ typedef BOOST_TYPEOF(build_state( if_then_else_( string_find_(event_(m_song),state_(m_letters))
+ != Npos_<string>() ,
+ process2_(Found(),event_(m_song)),
+ process2_(NotFound(),event_(m_song)) ) ,
                                      NoAction(),
- attributes_ << string()/*m_letters*/ )) StringFind;
+ attributes_ << m_letters )) StringFind;
 
- typedef BOOST_TYPEOF(build_state( if_then_( State_<m_src_it>() != end_(Fsm_<m_src_container>()),
- process2_(OneSong(),*(State_<m_src_it>()++)) ),
+ typedef BOOST_TYPEOF(build_state( if_then_( state_(m_src_it) != end_(fsm_(m_src_container)),
+ process2_(OneSong(),*(state_(m_src_it)++)) ),
                                       NoAction(),
- attributes_ << vector<OneSong>::iterator()/*m_src_it*/ )) Foreach;
+ attributes_ << m_src_it )) Foreach;
 
 
     // replaces the old transition table
@@ -90,7 +93,7 @@
           StringFind() == Foreach() + OneSong() ,
           Insert() == StringFind() + Found() ,
           Foreach() == StringFind() + NotFound() ,
- Foreach() == Insert() + Done()
+ Foreach() == Insert() + Done()
           // +------------------------------------------------------------------------------+
                     ) ) ) transition_table;
     struct Log_No_Transition : euml_action<Log_No_Transition>
@@ -106,22 +109,22 @@
     typedef BOOST_TYPEOF(build_sm( transition_table(), //STT
                                     init_ << Foreach(), // Init
                                     (
- clear_(attribute_(fsm_(),Int_<m_src_container>())), //clear source
- clear_(attribute_(fsm_(),Int_<m_tgt_container>())), //clear results
- push_back_(attribute_(fsm_(),Int_<m_src_container>()),
+ clear_(fsm_(m_src_container)), //clear source
+ clear_(fsm_(m_tgt_container)), //clear results
+ push_back_(fsm_(m_src_container),
                                                String_<mpl::string<'Let ','it ','be'> >()),//add a song
- push_back_(attribute_(fsm_(),Int_<m_src_container>()),
+ push_back_(fsm_(m_src_container),
                                                String_<mpl::string<'Yell','ow s','ubma','rine'> >()),//add a song
- push_back_(attribute_(fsm_(),Int_<m_src_container>()),
+ push_back_(fsm_(m_src_container),
                                                String_<mpl::string<'Twis','t an','d Sh','out'> >()),//add a song
- push_back_(attribute_(fsm_(),Int_<m_src_container>()),
+ push_back_(fsm_(m_src_container),
                                                String_<mpl::string<'She ','love','s yo','u'> >()),//add a song
- attribute_(substate_(Foreach()),Int_<m_src_it>())
- = begin_(attribute_(fsm_(),Int_<m_src_container>())) //set the search begin
+ attribute_(substate_(Foreach()),m_src_it)
+ = begin_(fsm_(m_src_container)) //set the search begin
                                     ), // Entry
                                     NoAction(), // Exit
- attributes_ << vector<OneSong>() /*m_src_container*/ // song list
- << vector<OneSong>() /*m_tgt_container*/, // result
+ attributes_ << m_src_container // song list
+ << m_tgt_container, // result
                                     configure_<< no_configure_,
                                     Log_No_Transition()
                                     )) iPodSearch_;
@@ -135,24 +138,24 @@
         iPodSearch search;
 
         // look for "She Loves You" using the first letters
- search.get_state<StringFind&>().get_attribute<m_letters>()="Sh";// will find 2 songs
+ search.get_state<StringFind&>().get_attribute(m_letters)="Sh";// will find 2 songs
 
         // needed to start the highest-level SM. This will call on_entry and mark the start of the SM
         search.start();
         // display all the songs
- for (vector<OneSong>::const_iterator it = search.get_attribute<m_tgt_container>().begin();
- it != search.get_attribute<m_tgt_container>().end();++it)
+ for (vector<OneSong>::const_iterator it = search.get_attribute(m_tgt_container).begin();
+ it != search.get_attribute(m_tgt_container).end();++it)
         {
             cout << "candidate song:" << (*it).get_data() << endl;
         }
 
         cout << "search using more letters" << endl;
         // look for "She Loves You" using more letters
- search.get_state<StringFind&>().get_attribute<m_letters>()="She";// will find 1 song
+ search.get_state<StringFind&>().get_attribute(m_letters)="She";// will find 1 song
         search.start();
         // display all the songs
- for (vector<OneSong>::const_iterator it = search.get_attribute<m_tgt_container>().begin();
- it != search.get_attribute<m_tgt_container>().end();++it)
+ for (vector<OneSong>::const_iterator it = search.get_attribute(m_tgt_container).begin();
+ it != search.get_attribute(m_tgt_container).end();++it)
         {
             cout << "candidate song:" << (*it).get_data() << endl;
         }


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