1 // Copyright 2008 Christophe Henry 2 // henry UNDERSCORE christophe AT hotmail DOT com 3 // This is an extended version of the state machine available in the boost::mpl library 4 // Distributed under the same license as the original. 5 // Copyright for the original version: 6 // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed 7 // under the Boost Software License, Version 1.0. (See accompanying 8 // file LICENSE_1_0.txt or copy at 9 // http://www.boost.org/LICENSE_1_0.txt) 10 11 #ifndef BOOST_MSM_FRONT_EUML_OPERATOR_H 12 #define BOOST_MSM_FRONT_EUML_OPERATOR_H 13 14 #include <iterator> 15 #include <boost/msm/front/euml/common.hpp> 16 #include <boost/type_traits/remove_reference.hpp> 17 #include <boost/utility/enable_if.hpp> 18 #include <boost/mpl/has_key.hpp> 19 #include <boost/mpl/eval_if.hpp> 20 #include <boost/mpl/set.hpp> 21 #include <boost/type_traits.hpp> 22 23 BOOST_MPL_HAS_XXX_TRAIT_DEF(reference) 24 BOOST_MPL_HAS_XXX_TRAIT_DEF(key_type) 25 26 namespace boost { namespace msm { namespace front { namespace euml 27 { 28 29 template <class T1,class T2> 30 struct Or_ : euml_action<Or_<T1,T2> > 31 { 32 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::Or_33 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt) 34 { 35 return (T1()(evt,fsm,src,tgt) || T2()(evt,fsm,src,tgt)); 36 } 37 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::Or_38 bool operator()(Event const& evt,FSM& fsm,STATE& state) 39 { 40 return (T1()(evt,fsm,state) || T2()(evt,fsm,state)); 41 } 42 }; 43 template <class T1,class T2> 44 struct And_ : euml_action<And_<T1,T2> > 45 { 46 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::And_47 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt) 48 { 49 return (T1()(evt,fsm,src,tgt) && T2()(evt,fsm,src,tgt)); 50 } 51 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::And_52 bool operator()(Event const& evt,FSM& fsm,STATE& state) 53 { 54 return (T1()(evt,fsm,state) && T2()(evt,fsm,state)); 55 } 56 }; 57 template <class T1> 58 struct Not_ : euml_action<Not_<T1> > 59 { 60 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::Not_61 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt) 62 { 63 return !(T1()(evt,fsm,src,tgt)); 64 } 65 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::Not_66 bool operator()(Event const& evt,FSM& fsm,STATE& state) 67 { 68 return !(T1()(evt,fsm,state)); 69 } 70 }; 71 72 template <class Condition,class Action1,class Action2, class Enable=void > 73 struct If_Else_ : euml_action<If_Else_<Condition,Action1,Action2,Enable> > {}; 74 75 template <class Condition,class Action1,class Action2> 76 struct If_Else_<Condition,Action1,Action2 77 , typename ::boost::enable_if<typename has_tag_type<Action1>::type >::type> 78 : euml_action<If_Else_<Condition,Action1,Action2> > 79 { 80 template <class Event,class FSM,class STATE > 81 struct state_action_result 82 { 83 typedef typename get_result_type2<Action1,Event,FSM,STATE>::type type; 84 }; 85 template <class EVT,class FSM,class SourceState,class TargetState> 86 struct transition_action_result 87 { 88 typedef typename get_result_type<Action1,EVT,FSM,SourceState,TargetState>::type type; 89 }; 90 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 91 92 template <class EVT,class FSM,class SourceState,class TargetState> 93 typename ::boost::enable_if< 94 typename ::boost::mpl::has_key< 95 typename Action1::tag_type,action_tag>::type, 96 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::If_Else_97 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 98 { 99 if (Condition()(evt,fsm,src,tgt)) 100 { 101 return Action1()(evt,fsm,src,tgt); 102 } 103 return Action2()(evt,fsm,src,tgt); 104 } 105 template <class Event,class FSM,class STATE> 106 typename ::boost::enable_if< 107 typename ::boost::mpl::has_key< 108 typename Action1::tag_type,state_action_tag>::type, 109 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::If_Else_110 operator()(Event const& evt,FSM& fsm,STATE& state )const 111 { 112 if (Condition()(evt,fsm,state)) 113 { 114 return Action1()(evt,fsm,state); 115 } 116 return Action2()(evt,fsm,state); 117 } 118 }; 119 120 template <class Condition,class Action1,class Action2> 121 struct If_Else_<Condition,Action1,Action2 122 , typename ::boost::disable_if<typename has_tag_type<Action1>::type >::type> 123 : euml_action<If_Else_<Condition,Action1,Action2> > 124 { 125 template <class Event,class FSM,class STATE > 126 struct state_action_result 127 { 128 typedef bool type; 129 }; 130 template <class EVT,class FSM,class SourceState,class TargetState> 131 struct transition_action_result 132 { 133 typedef bool type; 134 }; 135 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 136 137 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::If_Else_138 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 139 { 140 if (Condition()(evt,fsm,src,tgt)) 141 { 142 return Action1()(evt,fsm,src,tgt); 143 } 144 return Action2()(evt,fsm,src,tgt); 145 } 146 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::If_Else_147 bool operator()(Event const& evt,FSM& fsm,STATE& state )const 148 { 149 if (Condition()(evt,fsm,state)) 150 { 151 return Action1()(evt,fsm,state); 152 } 153 return Action2()(evt,fsm,state); 154 } 155 }; 156 157 struct if_tag 158 { 159 }; 160 struct If : proto::extends<proto::terminal<if_tag>::type, If, boost::msm::sm_domain> 161 { Ifboost::msm::front::euml::If162 If(){} 163 using proto::extends< proto::terminal<if_tag>::type, If, boost::msm::sm_domain>::operator=; 164 template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 165 #ifdef BOOST_MSVC 166 ,class Arg6 167 #endif 168 > 169 struct In 170 { 171 typedef If_Else_<Arg1,Arg2,Arg3> type; 172 }; 173 }; 174 If const if_then_else_; 175 176 template <class Condition,class Action1, class Enable=void > 177 struct If_Then_ : euml_action<If_Then_<Condition,Action1,Enable> > {}; 178 179 template <class Condition,class Action1> 180 struct If_Then_<Condition,Action1 181 , typename ::boost::enable_if<typename has_tag_type<Action1>::type >::type> 182 : euml_action<If_Then_<Condition,Action1> > 183 { 184 template <class Event,class FSM,class STATE > 185 struct state_action_result 186 { 187 typedef typename get_result_type2<Action1,Event,FSM,STATE>::type type; 188 }; 189 template <class EVT,class FSM,class SourceState,class TargetState> 190 struct transition_action_result 191 { 192 typedef typename get_result_type<Action1,EVT,FSM,SourceState,TargetState>::type type; 193 }; 194 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 195 196 template <class EVT,class FSM,class SourceState,class TargetState> 197 typename ::boost::enable_if< 198 typename ::boost::mpl::has_key< 199 typename Action1::tag_type,action_tag>::type, 200 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::If_Then_201 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 202 { 203 if (Condition()(evt,fsm,src,tgt)) 204 { 205 return Action1()(evt,fsm,src,tgt); 206 } 207 } 208 template <class Event,class FSM,class STATE> 209 typename ::boost::enable_if< 210 typename ::boost::mpl::has_key< 211 typename Action1::tag_type,state_action_tag>::type, 212 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::If_Then_213 operator()(Event const& evt,FSM& fsm,STATE& state )const 214 { 215 if (Condition()(evt,fsm,state)) 216 { 217 return Action1()(evt,fsm,state); 218 } 219 } 220 }; 221 222 template <class Condition,class Action1> 223 struct If_Then_<Condition,Action1 224 , typename ::boost::disable_if<typename has_tag_type<Action1>::type >::type> 225 : euml_action<If_Then_<Condition,Action1> > 226 { 227 template <class Event,class FSM,class STATE > 228 struct state_action_result 229 { 230 typedef bool type; 231 }; 232 template <class EVT,class FSM,class SourceState,class TargetState> 233 struct transition_action_result 234 { 235 typedef bool type; 236 }; 237 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 238 239 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::If_Then_240 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 241 { 242 if (Condition()(evt,fsm,src,tgt)) 243 { 244 return Action1()(evt,fsm,src,tgt); 245 } 246 } 247 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::If_Then_248 bool operator()(Event const& evt,FSM& fsm,STATE& state )const 249 { 250 if (Condition()(evt,fsm,state)) 251 { 252 return Action1()(evt,fsm,state); 253 } 254 } 255 }; 256 struct if_then_tag 257 { 258 }; 259 struct If_Then : proto::extends< proto::terminal<if_then_tag>::type, If_Then, boost::msm::sm_domain> 260 { If_Thenboost::msm::front::euml::If_Then261 If_Then(){} 262 using proto::extends< proto::terminal<if_then_tag>::type, If_Then, boost::msm::sm_domain>::operator=; 263 template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 264 #ifdef BOOST_MSVC 265 ,class Arg6 266 #endif 267 > 268 struct In 269 { 270 typedef If_Then_<Arg1,Arg2> type; 271 }; 272 }; 273 If_Then const if_then_; 274 275 template <class Condition,class Body> 276 struct While_Do_ : euml_action<While_Do_<Condition,Body> > 277 { 278 template <class Event,class FSM,class STATE > 279 struct state_action_result 280 { 281 typedef void type; 282 }; 283 template <class EVT,class FSM,class SourceState,class TargetState> 284 struct transition_action_result 285 { 286 typedef void type; 287 }; 288 289 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 290 291 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::While_Do_292 void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 293 { 294 Body body_; 295 Condition cond_; 296 while (cond_(evt,fsm,src,tgt)) 297 { 298 body_(evt,fsm,src,tgt); 299 } 300 } 301 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::While_Do_302 void operator()(Event const& evt,FSM& fsm,STATE& state )const 303 { 304 Body body_; 305 Condition cond_; 306 while (cond_(evt,fsm,state)) 307 { 308 body_(evt,fsm,state); 309 } 310 } 311 }; 312 struct while_do_tag 313 { 314 }; 315 struct While_Do_Helper : proto::extends< proto::terminal<while_do_tag>::type, While_Do_Helper, boost::msm::sm_domain> 316 { While_Do_Helperboost::msm::front::euml::While_Do_Helper317 While_Do_Helper(){} 318 using proto::extends< proto::terminal<while_do_tag>::type, While_Do_Helper, boost::msm::sm_domain>::operator=; 319 template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 320 #ifdef BOOST_MSVC 321 ,class Arg6 322 #endif 323 > 324 struct In 325 { 326 typedef While_Do_<Arg1,Arg2> type; 327 }; 328 }; 329 While_Do_Helper const while_; 330 331 template <class Condition,class Body> 332 struct Do_While_ : euml_action<Do_While_<Condition,Body> > 333 { 334 template <class Event,class FSM,class STATE > 335 struct state_action_result 336 { 337 typedef void type; 338 }; 339 template <class EVT,class FSM,class SourceState,class TargetState> 340 struct transition_action_result 341 { 342 typedef void type; 343 }; 344 345 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 346 347 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::Do_While_348 void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 349 { 350 Condition cond_; 351 Body body_; 352 do 353 { 354 body_(evt,fsm,src,tgt); 355 } while (cond_(evt,fsm,src,tgt)); 356 } 357 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::Do_While_358 void operator()(Event const& evt,FSM& fsm,STATE& state )const 359 { 360 Condition cond_; 361 Body body_; 362 do 363 { 364 body_(evt,fsm,state); 365 } while (cond_(evt,fsm,state)); 366 } 367 }; 368 struct do_while_tag 369 { 370 }; 371 struct Do_While_Helper : proto::extends< proto::terminal<do_while_tag>::type, Do_While_Helper, boost::msm::sm_domain> 372 { Do_While_Helperboost::msm::front::euml::Do_While_Helper373 Do_While_Helper(){} 374 using proto::extends< proto::terminal<do_while_tag>::type, Do_While_Helper, boost::msm::sm_domain>::operator=; 375 template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 376 #ifdef BOOST_MSVC 377 ,class Arg6 378 #endif 379 > 380 struct In 381 { 382 typedef Do_While_<Arg1,Arg2> type; 383 }; 384 }; 385 Do_While_Helper const do_while_; 386 387 template <class Begin,class End,class EndLoop,class Body> 388 struct For_Loop_ : euml_action<For_Loop_<Begin,End,EndLoop,Body> > 389 { 390 template <class Event,class FSM,class STATE > 391 struct state_action_result 392 { 393 typedef void type; 394 }; 395 template <class EVT,class FSM,class SourceState,class TargetState> 396 struct transition_action_result 397 { 398 typedef void type; 399 }; 400 401 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 402 403 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::For_Loop_404 void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 405 { 406 End end_; 407 EndLoop end_loop_; 408 Body body_; 409 for(Begin()(evt,fsm,src,tgt);end_(evt,fsm,src,tgt);end_loop_(evt,fsm,src,tgt)) 410 { 411 body_(evt,fsm,src,tgt); 412 } 413 } 414 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::For_Loop_415 void operator()(Event const& evt,FSM& fsm,STATE& state )const 416 { 417 End end_; 418 EndLoop end_loop_; 419 Body body_; 420 for(Begin()(evt,fsm,state);end_(evt,fsm,state);end_loop_(evt,fsm,state)) 421 { 422 body_(evt,fsm,state); 423 } 424 } 425 }; 426 struct for_loop_tag 427 { 428 }; 429 struct For_Loop_Helper : proto::extends< proto::terminal<for_loop_tag>::type, For_Loop_Helper, boost::msm::sm_domain> 430 { For_Loop_Helperboost::msm::front::euml::For_Loop_Helper431 For_Loop_Helper(){} 432 using proto::extends< proto::terminal<for_loop_tag>::type, For_Loop_Helper, boost::msm::sm_domain>::operator=; 433 template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 434 #ifdef BOOST_MSVC 435 ,class Arg6 436 #endif 437 > 438 struct In 439 { 440 typedef For_Loop_<Arg1,Arg2,Arg3,Arg4> type; 441 }; 442 }; 443 For_Loop_Helper const for_; 444 445 446 447 448 template <class T> 449 struct Deref_ : euml_action<Deref_<T> > 450 { Deref_boost::msm::front::euml::Deref_451 Deref_(){} 452 using euml_action<Deref_<T> >::operator=; 453 template <class Event,class FSM,class STATE > 454 struct state_action_result 455 { 456 typedef typename ::boost::add_reference< 457 typename std::iterator_traits < 458 typename ::boost::remove_reference< 459 typename get_result_type2<T,Event,FSM,STATE>::type>::type>::value_type>::type type; 460 }; 461 template <class EVT,class FSM,class SourceState,class TargetState> 462 struct transition_action_result 463 { 464 typedef typename ::boost::add_reference< 465 typename std::iterator_traits< 466 typename ::boost::remove_reference< 467 typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type 468 >::value_type 469 >::type type; 470 }; 471 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 472 473 template <class EVT,class FSM,class SourceState,class TargetState> 474 typename ::boost::enable_if< 475 typename ::boost::mpl::has_key< 476 typename T::tag_type,action_tag>::type, 477 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Deref_478 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 479 { 480 return *(T()(evt,fsm,src,tgt)); 481 } 482 template <class Event,class FSM,class STATE> 483 typename ::boost::enable_if< 484 typename ::boost::mpl::has_key< 485 typename T::tag_type,state_action_tag>::type, 486 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Deref_487 operator()(Event const& evt,FSM& fsm,STATE& state )const 488 { 489 return *(T()(evt,fsm,state)); 490 } 491 }; 492 493 template <class T> 494 struct Pre_inc_ : euml_action<Pre_inc_<T> > 495 { 496 using euml_action<Pre_inc_<T> >::operator=; 497 498 template <class Event,class FSM,class STATE > 499 struct state_action_result 500 { 501 typedef typename get_result_type2<T,Event,FSM,STATE>::type type; 502 }; 503 template <class EVT,class FSM,class SourceState,class TargetState> 504 struct transition_action_result 505 { 506 typedef typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type type; 507 }; 508 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 509 510 template <class EVT,class FSM,class SourceState,class TargetState> 511 typename ::boost::enable_if< 512 typename ::boost::mpl::has_key< 513 typename T::tag_type,action_tag>::type, 514 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Pre_inc_515 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 516 { 517 return ++T()(evt,fsm,src,tgt); 518 } 519 template <class Event,class FSM,class STATE> 520 typename ::boost::enable_if< 521 typename ::boost::mpl::has_key< 522 typename T::tag_type,state_action_tag>::type, 523 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Pre_inc_524 operator()(Event const& evt,FSM& fsm,STATE& state )const 525 { 526 return ++T()(evt,fsm,state); 527 } 528 }; 529 template <class T> 530 struct Pre_dec_ : euml_action<Pre_dec_<T> > 531 { 532 using euml_action<Pre_dec_<T> >::operator=; 533 534 template <class Event,class FSM,class STATE > 535 struct state_action_result 536 { 537 typedef typename get_result_type2<T,Event,FSM,STATE>::type type; 538 }; 539 template <class EVT,class FSM,class SourceState,class TargetState> 540 struct transition_action_result 541 { 542 typedef typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type type; 543 }; 544 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 545 546 template <class EVT,class FSM,class SourceState,class TargetState> 547 typename ::boost::enable_if< 548 typename ::boost::mpl::has_key< 549 typename T::tag_type,action_tag>::type, 550 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Pre_dec_551 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 552 { 553 return --T()(evt,fsm,src,tgt); 554 } 555 template <class Event,class FSM,class STATE> 556 typename ::boost::enable_if< 557 typename ::boost::mpl::has_key< 558 typename T::tag_type,state_action_tag>::type, 559 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Pre_dec_560 operator()(Event const& evt,FSM& fsm,STATE& state )const 561 { 562 return --T()(evt,fsm,state); 563 } 564 }; 565 template <class T> 566 struct Post_inc_ : euml_action<Post_inc_<T> > 567 { 568 using euml_action<Post_inc_<T> >::operator=; 569 570 template <class Event,class FSM,class STATE > 571 struct state_action_result 572 { 573 typedef typename ::boost::remove_reference< 574 typename get_result_type2<T,Event,FSM,STATE>::type>::type type; 575 }; 576 template <class EVT,class FSM,class SourceState,class TargetState> 577 struct transition_action_result 578 { 579 typedef typename ::boost::remove_reference< 580 typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type type; 581 }; 582 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 583 584 template <class EVT,class FSM,class SourceState,class TargetState> 585 typename ::boost::enable_if< 586 typename ::boost::mpl::has_key< 587 typename T::tag_type,action_tag>::type, 588 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Post_inc_589 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 590 { 591 return T()(evt,fsm,src,tgt)++; 592 } 593 template <class Event,class FSM,class STATE> 594 typename ::boost::enable_if< 595 typename ::boost::mpl::has_key< 596 typename T::tag_type,state_action_tag>::type, 597 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Post_inc_598 operator()(Event const& evt,FSM& fsm,STATE& state )const 599 { 600 return T()(evt,fsm,state)++; 601 } 602 }; 603 template <class T> 604 struct Post_dec_ : euml_action<Post_dec_<T> > 605 { 606 using euml_action<Post_dec_<T> >::operator=; 607 608 template <class Event,class FSM,class STATE > 609 struct state_action_result 610 { 611 typedef typename ::boost::remove_reference< 612 typename get_result_type2<T,Event,FSM,STATE>::type>::type type; 613 }; 614 template <class EVT,class FSM,class SourceState,class TargetState> 615 struct transition_action_result 616 { 617 typedef typename ::boost::remove_reference< 618 typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type type; 619 }; 620 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 621 622 template <class EVT,class FSM,class SourceState,class TargetState> 623 typename ::boost::enable_if< 624 typename ::boost::mpl::has_key< 625 typename T::tag_type,action_tag>::type, 626 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Post_dec_627 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 628 { 629 return T()(evt,fsm,src,tgt)--; 630 } 631 template <class Event,class FSM,class STATE> 632 typename ::boost::enable_if< 633 typename ::boost::mpl::has_key< 634 typename T::tag_type,state_action_tag>::type, 635 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Post_dec_636 operator()(Event const& evt,FSM& fsm,STATE& state )const 637 { 638 return T()(evt,fsm,state)--; 639 } 640 }; 641 642 template <class T1,class T2> 643 struct Plus_ : euml_action<Plus_<T1,T2> > 644 { 645 template <class Event,class FSM,class STATE > 646 struct state_action_result 647 { 648 typedef typename ::boost::remove_reference< 649 typename get_result_type2<T1,Event,FSM,STATE>::type>::type type; 650 }; 651 template <class EVT,class FSM,class SourceState,class TargetState> 652 struct transition_action_result 653 { 654 typedef typename ::boost::remove_reference< 655 typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type; 656 }; 657 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 658 659 template <class EVT,class FSM,class SourceState,class TargetState> 660 typename ::boost::enable_if< 661 typename ::boost::mpl::has_key< 662 typename T1::tag_type,action_tag>::type, 663 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Plus_664 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 665 { 666 return T1()(evt,fsm,src,tgt)+T2()(evt,fsm,src,tgt); 667 } 668 template <class Event,class FSM,class STATE> 669 typename ::boost::enable_if< 670 typename ::boost::mpl::has_key< 671 typename T1::tag_type,state_action_tag>::type, 672 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Plus_673 operator()(Event const& evt,FSM& fsm,STATE& state )const 674 { 675 return T1()(evt,fsm,state)+T2()(evt,fsm,state); 676 } 677 }; 678 template <class T1,class T2> 679 struct Minus_ : euml_action<Minus_<T1,T2> > 680 { 681 template <class Event,class FSM,class STATE > 682 struct state_action_result 683 { 684 typedef typename ::boost::remove_reference< 685 typename get_result_type2<T1,Event,FSM,STATE>::type>::type type; 686 }; 687 template <class EVT,class FSM,class SourceState,class TargetState> 688 struct transition_action_result 689 { 690 typedef typename ::boost::remove_reference< 691 typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type; 692 }; 693 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 694 695 template <class EVT,class FSM,class SourceState,class TargetState> 696 typename ::boost::enable_if< 697 typename ::boost::mpl::has_key< 698 typename T1::tag_type,action_tag>::type, 699 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Minus_700 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 701 { 702 return T1()(evt,fsm,src,tgt)-T2()(evt,fsm,src,tgt); 703 } 704 template <class Event,class FSM,class STATE> 705 typename ::boost::enable_if< 706 typename ::boost::mpl::has_key< 707 typename T1::tag_type,state_action_tag>::type, 708 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Minus_709 operator()(Event const& evt,FSM& fsm,STATE& state )const 710 { 711 return T1()(evt,fsm,state)-T2()(evt,fsm,state); 712 } 713 }; 714 template <class T1,class T2> 715 struct Multiplies_ : euml_action<Multiplies_<T1,T2> > 716 { 717 template <class Event,class FSM,class STATE > 718 struct state_action_result 719 { 720 typedef typename ::boost::remove_reference< 721 typename get_result_type2<T1,Event,FSM,STATE>::type>::type type; 722 }; 723 template <class EVT,class FSM,class SourceState,class TargetState> 724 struct transition_action_result 725 { 726 typedef typename ::boost::remove_reference< 727 typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type; 728 }; 729 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 730 731 template <class EVT,class FSM,class SourceState,class TargetState> 732 typename ::boost::enable_if< 733 typename ::boost::mpl::has_key< 734 typename T1::tag_type,action_tag>::type, 735 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Multiplies_736 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 737 { 738 return T1()(evt,fsm,src,tgt)*T2()(evt,fsm,src,tgt); 739 } 740 template <class Event,class FSM,class STATE> 741 typename ::boost::enable_if< 742 typename ::boost::mpl::has_key< 743 typename T1::tag_type,state_action_tag>::type, 744 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Multiplies_745 operator()(Event const& evt,FSM& fsm,STATE& state )const 746 { 747 return T1()(evt,fsm,state)*T2()(evt,fsm,state); 748 } 749 }; 750 template <class T1,class T2> 751 struct Divides_ : euml_action<Divides_<T1,T2> > 752 { 753 template <class Event,class FSM,class STATE > 754 struct state_action_result 755 { 756 typedef typename ::boost::remove_reference< 757 typename get_result_type2<T1,Event,FSM,STATE>::type>::type type; 758 }; 759 template <class EVT,class FSM,class SourceState,class TargetState> 760 struct transition_action_result 761 { 762 typedef typename ::boost::remove_reference< 763 typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type; 764 }; 765 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 766 767 template <class EVT,class FSM,class SourceState,class TargetState> 768 typename ::boost::enable_if< 769 typename ::boost::mpl::has_key< 770 typename T1::tag_type,action_tag>::type, 771 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Divides_772 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 773 { 774 return T1()(evt,fsm,src,tgt)/T2()(evt,fsm,src,tgt); 775 } 776 template <class Event,class FSM,class STATE> 777 typename ::boost::enable_if< 778 typename ::boost::mpl::has_key< 779 typename T1::tag_type,state_action_tag>::type, 780 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Divides_781 operator()(Event const& evt,FSM& fsm,STATE& state )const 782 { 783 return T1()(evt,fsm,state)/T2()(evt,fsm,state); 784 } 785 }; 786 template <class T1,class T2> 787 struct Modulus_ : euml_action<Modulus_<T1,T2> > 788 { 789 template <class Event,class FSM,class STATE > 790 struct state_action_result 791 { 792 typedef typename ::boost::remove_reference< 793 typename get_result_type2<T1,Event,FSM,STATE>::type>::type type; 794 }; 795 template <class EVT,class FSM,class SourceState,class TargetState> 796 struct transition_action_result 797 { 798 typedef typename ::boost::remove_reference< 799 typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type; 800 }; 801 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 802 803 template <class EVT,class FSM,class SourceState,class TargetState> 804 typename ::boost::enable_if< 805 typename ::boost::mpl::has_key< 806 typename T1::tag_type,action_tag>::type, 807 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Modulus_808 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 809 { 810 return T1()(evt,fsm,src,tgt)%T2()(evt,fsm,src,tgt); 811 } 812 template <class Event,class FSM,class STATE> 813 typename ::boost::enable_if< 814 typename ::boost::mpl::has_key< 815 typename T1::tag_type,state_action_tag>::type, 816 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Modulus_817 operator()(Event const& evt,FSM& fsm,STATE& state )const 818 { 819 return T1()(evt,fsm,state)%T2()(evt,fsm,state); 820 } 821 }; 822 template <class T1,class T2> 823 struct Bitwise_And_ : euml_action<Bitwise_And_<T1,T2> > 824 { 825 template <class Event,class FSM,class STATE > 826 struct state_action_result 827 { 828 typedef typename ::boost::remove_reference< 829 typename get_result_type2<T1,Event,FSM,STATE>::type>::type type; 830 }; 831 template <class EVT,class FSM,class SourceState,class TargetState> 832 struct transition_action_result 833 { 834 typedef typename ::boost::remove_reference< 835 typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type; 836 }; 837 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 838 839 template <class EVT,class FSM,class SourceState,class TargetState> 840 typename ::boost::enable_if< 841 typename ::boost::mpl::has_key< 842 typename T1::tag_type,action_tag>::type, 843 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Bitwise_And_844 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 845 { 846 return T1()(evt,fsm,src,tgt)&T2()(evt,fsm,src,tgt); 847 } 848 template <class Event,class FSM,class STATE> 849 typename ::boost::enable_if< 850 typename ::boost::mpl::has_key< 851 typename T1::tag_type,state_action_tag>::type, 852 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Bitwise_And_853 operator()(Event const& evt,FSM& fsm,STATE& state )const 854 { 855 return T1()(evt,fsm,state)&T2()(evt,fsm,state); 856 } 857 }; 858 template <class T1,class T2> 859 struct Bitwise_Or_ : euml_action<Bitwise_Or_<T1,T2> > 860 { 861 template <class Event,class FSM,class STATE > 862 struct state_action_result 863 { 864 typedef typename ::boost::remove_reference< 865 typename get_result_type2<T1,Event,FSM,STATE>::type>::type type; 866 }; 867 template <class EVT,class FSM,class SourceState,class TargetState> 868 struct transition_action_result 869 { 870 typedef typename ::boost::remove_reference< 871 typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type; 872 }; 873 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 874 875 template <class EVT,class FSM,class SourceState,class TargetState> 876 typename ::boost::enable_if< 877 typename ::boost::mpl::has_key< 878 typename T1::tag_type,action_tag>::type, 879 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Bitwise_Or_880 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 881 { 882 return T1()(evt,fsm,src,tgt)|T2()(evt,fsm,src,tgt); 883 } 884 template <class Event,class FSM,class STATE> 885 typename ::boost::enable_if< 886 typename ::boost::mpl::has_key< 887 typename T1::tag_type,state_action_tag>::type, 888 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Bitwise_Or_889 operator()(Event const& evt,FSM& fsm,STATE& state )const 890 { 891 return T1()(evt,fsm,state)|T2()(evt,fsm,state); 892 } 893 }; 894 template <class T1,class T2> 895 struct Bitwise_Xor_ : euml_action<Bitwise_Xor_<T1,T2> > 896 { 897 template <class Event,class FSM,class STATE > 898 struct state_action_result 899 { 900 typedef typename ::boost::remove_reference< 901 typename get_result_type2<T1,Event,FSM,STATE>::type>::type type; 902 }; 903 template <class EVT,class FSM,class SourceState,class TargetState> 904 struct transition_action_result 905 { 906 typedef typename ::boost::remove_reference< 907 typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type; 908 }; 909 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 910 911 template <class EVT,class FSM,class SourceState,class TargetState> 912 typename ::boost::enable_if< 913 typename ::boost::mpl::has_key< 914 typename T1::tag_type,action_tag>::type, 915 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Bitwise_Xor_916 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 917 { 918 return T1()(evt,fsm,src,tgt)^T2()(evt,fsm,src,tgt); 919 } 920 template <class Event,class FSM,class STATE> 921 typename ::boost::enable_if< 922 typename ::boost::mpl::has_key< 923 typename T1::tag_type,state_action_tag>::type, 924 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Bitwise_Xor_925 operator()(Event const& evt,FSM& fsm,STATE& state )const 926 { 927 return T1()(evt,fsm,state)^T2()(evt,fsm,state); 928 } 929 }; 930 template <class T1,class T2> 931 struct Subscript_ : euml_action<Subscript_<T1,T2> > 932 { 933 template <class T> 934 struct get_reference 935 { 936 typedef typename T::reference type; 937 }; 938 template <class T> 939 struct get_mapped_type 940 { 941 typedef typename T::value_type::second_type& type; 942 }; 943 template <class Event,class FSM,class STATE > 944 struct state_action_result 945 { 946 typedef typename ::boost::remove_reference< 947 typename get_result_type2<T1,Event,FSM,STATE>::type>::type container_type; 948 typedef typename ::boost::mpl::eval_if< 949 typename has_key_type<container_type>::type, 950 get_mapped_type<container_type>, 951 ::boost::mpl::eval_if< 952 typename ::boost::is_pointer<container_type>::type, 953 ::boost::add_reference<typename ::boost::remove_pointer<container_type>::type >, 954 get_reference<container_type> 955 > 956 >::type type; 957 }; 958 template <class EVT,class FSM,class SourceState,class TargetState> 959 struct transition_action_result 960 { 961 typedef typename ::boost::remove_reference< 962 typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type container_type; 963 typedef typename ::boost::mpl::eval_if< 964 typename has_key_type<container_type>::type, 965 get_mapped_type<container_type>, 966 ::boost::mpl::eval_if< 967 typename ::boost::is_pointer<container_type>::type, 968 ::boost::add_reference<typename ::boost::remove_pointer<container_type>::type >, 969 get_reference<container_type> 970 > 971 >::type type; 972 }; 973 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 974 975 template <class EVT,class FSM,class SourceState,class TargetState> 976 typename ::boost::enable_if< 977 typename ::boost::mpl::has_key< 978 typename T1::tag_type,action_tag>::type, 979 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Subscript_980 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 981 { 982 return T1()(evt,fsm,src,tgt)[T2()(evt,fsm,src,tgt)]; 983 } 984 template <class Event,class FSM,class STATE> 985 typename ::boost::enable_if< 986 typename ::boost::mpl::has_key< 987 typename T1::tag_type,state_action_tag>::type, 988 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Subscript_989 operator()(Event const& evt,FSM& fsm,STATE& state )const 990 { 991 return T1()(evt,fsm,state)[T2()(evt,fsm,state)]; 992 } 993 }; 994 template <class T1,class T2> 995 struct Plus_Assign_ : euml_action<Plus_Assign_<T1,T2> > 996 { 997 template <class Event,class FSM,class STATE > 998 struct state_action_result 999 { 1000 typedef typename get_result_type2<T1,Event,FSM,STATE>::type type; 1001 }; 1002 template <class EVT,class FSM,class SourceState,class TargetState> 1003 struct transition_action_result 1004 { 1005 typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type; 1006 }; 1007 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1008 1009 template <class EVT,class FSM,class SourceState,class TargetState> 1010 typename ::boost::enable_if< 1011 typename ::boost::mpl::has_key< 1012 typename T1::tag_type,action_tag>::type, 1013 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Plus_Assign_1014 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1015 { 1016 return (T1()(evt,fsm,src,tgt)+=T2()(evt,fsm,src,tgt)); 1017 } 1018 template <class Event,class FSM,class STATE> 1019 typename ::boost::enable_if< 1020 typename ::boost::mpl::has_key< 1021 typename T1::tag_type,state_action_tag>::type, 1022 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Plus_Assign_1023 operator()(Event const& evt,FSM& fsm,STATE& state )const 1024 { 1025 return (T1()(evt,fsm,state)+=T2()(evt,fsm,state)); 1026 } 1027 }; 1028 template <class T1,class T2> 1029 struct Minus_Assign_ : euml_action<Minus_Assign_<T1,T2> > 1030 { 1031 template <class Event,class FSM,class STATE > 1032 struct state_action_result 1033 { 1034 typedef typename get_result_type2<T1,Event,FSM,STATE>::type type; 1035 }; 1036 template <class EVT,class FSM,class SourceState,class TargetState> 1037 struct transition_action_result 1038 { 1039 typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type; 1040 }; 1041 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1042 1043 template <class EVT,class FSM,class SourceState,class TargetState> 1044 typename ::boost::enable_if< 1045 typename ::boost::mpl::has_key< 1046 typename T1::tag_type,action_tag>::type, 1047 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Minus_Assign_1048 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1049 { 1050 return (T1()(evt,fsm,src,tgt)-=T2()(evt,fsm,src,tgt)); 1051 } 1052 template <class Event,class FSM,class STATE> 1053 typename ::boost::enable_if< 1054 typename ::boost::mpl::has_key< 1055 typename T1::tag_type,state_action_tag>::type, 1056 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Minus_Assign_1057 operator()(Event const& evt,FSM& fsm,STATE& state )const 1058 { 1059 return (T1()(evt,fsm,state)-=T2()(evt,fsm,state)); 1060 } 1061 }; 1062 template <class T1,class T2> 1063 struct Multiplies_Assign_ : euml_action<Multiplies_Assign_<T1,T2> > 1064 { 1065 template <class Event,class FSM,class STATE > 1066 struct state_action_result 1067 { 1068 typedef typename get_result_type2<T1,Event,FSM,STATE>::type type; 1069 }; 1070 template <class EVT,class FSM,class SourceState,class TargetState> 1071 struct transition_action_result 1072 { 1073 typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type; 1074 }; 1075 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1076 1077 template <class EVT,class FSM,class SourceState,class TargetState> 1078 typename ::boost::enable_if< 1079 typename ::boost::mpl::has_key< 1080 typename T1::tag_type,action_tag>::type, 1081 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Multiplies_Assign_1082 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1083 { 1084 return (T1()(evt,fsm,src,tgt)*=T2()(evt,fsm,src,tgt)); 1085 } 1086 template <class Event,class FSM,class STATE> 1087 typename ::boost::enable_if< 1088 typename ::boost::mpl::has_key< 1089 typename T1::tag_type,state_action_tag>::type, 1090 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Multiplies_Assign_1091 operator()(Event const& evt,FSM& fsm,STATE& state )const 1092 { 1093 return (T1()(evt,fsm,state)*=T2()(evt,fsm,state)); 1094 } 1095 }; 1096 template <class T1,class T2> 1097 struct Divides_Assign_ : euml_action<Divides_Assign_<T1,T2> > 1098 { 1099 template <class Event,class FSM,class STATE > 1100 struct state_action_result 1101 { 1102 typedef typename get_result_type2<T1,Event,FSM,STATE>::type type; 1103 }; 1104 template <class EVT,class FSM,class SourceState,class TargetState> 1105 struct transition_action_result 1106 { 1107 typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type; 1108 }; 1109 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1110 1111 template <class EVT,class FSM,class SourceState,class TargetState> 1112 typename ::boost::enable_if< 1113 typename ::boost::mpl::has_key< 1114 typename T1::tag_type,action_tag>::type, 1115 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Divides_Assign_1116 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1117 { 1118 return (T1()(evt,fsm,src,tgt)/=T2()(evt,fsm,src,tgt)); 1119 } 1120 template <class Event,class FSM,class STATE> 1121 typename ::boost::enable_if< 1122 typename ::boost::mpl::has_key< 1123 typename T1::tag_type,state_action_tag>::type, 1124 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Divides_Assign_1125 operator()(Event const& evt,FSM& fsm,STATE& state )const 1126 { 1127 return (T1()(evt,fsm,state)/=T2()(evt,fsm,state)); 1128 } 1129 }; 1130 template <class T1,class T2> 1131 struct Modulus_Assign_ : euml_action<Modulus_Assign_<T1,T2> > 1132 { 1133 template <class Event,class FSM,class STATE > 1134 struct state_action_result 1135 { 1136 typedef typename get_result_type2<T1,Event,FSM,STATE>::type type; 1137 }; 1138 template <class EVT,class FSM,class SourceState,class TargetState> 1139 struct transition_action_result 1140 { 1141 typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type; 1142 }; 1143 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1144 1145 template <class EVT,class FSM,class SourceState,class TargetState> 1146 typename ::boost::enable_if< 1147 typename ::boost::mpl::has_key< 1148 typename T1::tag_type,action_tag>::type, 1149 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Modulus_Assign_1150 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1151 { 1152 return (T1()(evt,fsm,src,tgt)%=T2()(evt,fsm,src,tgt)); 1153 } 1154 template <class Event,class FSM,class STATE> 1155 typename ::boost::enable_if< 1156 typename ::boost::mpl::has_key< 1157 typename T1::tag_type,state_action_tag>::type, 1158 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Modulus_Assign_1159 operator()(Event const& evt,FSM& fsm,STATE& state )const 1160 { 1161 return (T1()(evt,fsm,state)%=T2()(evt,fsm,state)); 1162 } 1163 }; 1164 template <class T1,class T2> 1165 struct ShiftLeft_Assign_ : euml_action<ShiftLeft_Assign_<T1,T2> > 1166 { 1167 template <class Event,class FSM,class STATE > 1168 struct state_action_result 1169 { 1170 typedef typename get_result_type2<T1,Event,FSM,STATE>::type type; 1171 }; 1172 template <class EVT,class FSM,class SourceState,class TargetState> 1173 struct transition_action_result 1174 { 1175 typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type; 1176 }; 1177 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1178 1179 template <class EVT,class FSM,class SourceState,class TargetState> 1180 typename ::boost::enable_if< 1181 typename ::boost::mpl::has_key< 1182 typename T1::tag_type,action_tag>::type, 1183 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::ShiftLeft_Assign_1184 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1185 { 1186 return (T1()(evt,fsm,src,tgt)<<=T2()(evt,fsm,src,tgt)); 1187 } 1188 template <class Event,class FSM,class STATE> 1189 typename ::boost::enable_if< 1190 typename ::boost::mpl::has_key< 1191 typename T1::tag_type,state_action_tag>::type, 1192 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::ShiftLeft_Assign_1193 operator()(Event const& evt,FSM& fsm,STATE& state )const 1194 { 1195 return (T1()(evt,fsm,state)<<=T2()(evt,fsm,state)); 1196 } 1197 }; 1198 template <class T1,class T2> 1199 struct ShiftRight_Assign_ : euml_action<ShiftRight_Assign_<T1,T2> > 1200 { 1201 template <class Event,class FSM,class STATE > 1202 struct state_action_result 1203 { 1204 typedef typename get_result_type2<T1,Event,FSM,STATE>::type type; 1205 }; 1206 template <class EVT,class FSM,class SourceState,class TargetState> 1207 struct transition_action_result 1208 { 1209 typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type; 1210 }; 1211 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1212 1213 template <class EVT,class FSM,class SourceState,class TargetState> 1214 typename ::boost::enable_if< 1215 typename ::boost::mpl::has_key< 1216 typename T1::tag_type,action_tag>::type, 1217 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::ShiftRight_Assign_1218 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1219 { 1220 return (T1()(evt,fsm,src,tgt)>>=T2()(evt,fsm,src,tgt)); 1221 } 1222 template <class Event,class FSM,class STATE> 1223 typename ::boost::enable_if< 1224 typename ::boost::mpl::has_key< 1225 typename T1::tag_type,state_action_tag>::type, 1226 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::ShiftRight_Assign_1227 operator()(Event const& evt,FSM& fsm,STATE& state )const 1228 { 1229 return (T1()(evt,fsm,state)>>=T2()(evt,fsm,state)); 1230 } 1231 }; 1232 template <class T1,class T2> 1233 struct ShiftLeft_ : euml_action<ShiftLeft_<T1,T2> > 1234 { 1235 template <class Event,class FSM,class STATE > 1236 struct state_action_result 1237 { 1238 typedef typename get_result_type2<T1,Event,FSM,STATE>::type type; 1239 }; 1240 template <class EVT,class FSM,class SourceState,class TargetState> 1241 struct transition_action_result 1242 { 1243 typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type; 1244 }; 1245 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1246 1247 template <class EVT,class FSM,class SourceState,class TargetState> 1248 typename ::boost::enable_if< 1249 typename ::boost::mpl::has_key< 1250 typename T1::tag_type,action_tag>::type, 1251 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::ShiftLeft_1252 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1253 { 1254 return (T1()(evt,fsm,src,tgt)<<T2()(evt,fsm,src,tgt)); 1255 } 1256 template <class Event,class FSM,class STATE> 1257 typename ::boost::enable_if< 1258 typename ::boost::mpl::has_key< 1259 typename T1::tag_type,state_action_tag>::type, 1260 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::ShiftLeft_1261 operator()(Event const& evt,FSM& fsm,STATE& state )const 1262 { 1263 return (T1()(evt,fsm,state)<<T2()(evt,fsm,state)); 1264 } 1265 }; 1266 template <class T1,class T2> 1267 struct ShiftRight_ : euml_action<ShiftRight_<T1,T2> > 1268 { 1269 template <class Event,class FSM,class STATE > 1270 struct state_action_result 1271 { 1272 typedef typename get_result_type2<T1,Event,FSM,STATE>::type type; 1273 }; 1274 template <class EVT,class FSM,class SourceState,class TargetState> 1275 struct transition_action_result 1276 { 1277 typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type; 1278 }; 1279 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1280 1281 template <class EVT,class FSM,class SourceState,class TargetState> 1282 typename ::boost::enable_if< 1283 typename ::boost::mpl::has_key< 1284 typename T1::tag_type,action_tag>::type, 1285 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::ShiftRight_1286 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1287 { 1288 return (T1()(evt,fsm,src,tgt)>>T2()(evt,fsm,src,tgt)); 1289 } 1290 template <class Event,class FSM,class STATE> 1291 typename ::boost::enable_if< 1292 typename ::boost::mpl::has_key< 1293 typename T1::tag_type,state_action_tag>::type, 1294 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::ShiftRight_1295 operator()(Event const& evt,FSM& fsm,STATE& state )const 1296 { 1297 return (T1()(evt,fsm,state)>>T2()(evt,fsm,state)); 1298 } 1299 }; 1300 template <class T1,class T2> 1301 struct Assign_ : euml_action<Assign_<T1,T2> > 1302 { 1303 using euml_action< Assign_<T1,T2> >::operator=; 1304 template <class Event,class FSM,class STATE > 1305 struct state_action_result 1306 { 1307 typedef typename get_result_type2<T1,Event,FSM,STATE>::type type; 1308 }; 1309 template <class EVT,class FSM,class SourceState,class TargetState> 1310 struct transition_action_result 1311 { 1312 typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type; 1313 }; 1314 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1315 1316 template <class EVT,class FSM,class SourceState,class TargetState> 1317 typename ::boost::enable_if< 1318 typename ::boost::mpl::has_key< 1319 typename T1::tag_type,action_tag>::type, 1320 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Assign_1321 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1322 { 1323 return (T1()(evt,fsm,src,tgt)=T2()(evt,fsm,src,tgt)); 1324 } 1325 template <class Event,class FSM,class STATE> 1326 typename ::boost::enable_if< 1327 typename ::boost::mpl::has_key< 1328 typename T1::tag_type,state_action_tag>::type, 1329 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Assign_1330 operator()(Event const& evt,FSM& fsm,STATE& state )const 1331 { 1332 return (T1()(evt,fsm,state)=T2()(evt,fsm,state)); 1333 } 1334 }; 1335 template <class T1> 1336 struct Unary_Plus_ : euml_action<Unary_Plus_<T1> > 1337 { 1338 template <class Event,class FSM,class STATE > 1339 struct state_action_result 1340 { 1341 typedef typename ::boost::remove_reference< 1342 typename get_result_type2<T1,Event,FSM,STATE>::type>::type type; 1343 }; 1344 template <class EVT,class FSM,class SourceState,class TargetState> 1345 struct transition_action_result 1346 { 1347 typedef typename ::boost::remove_reference< 1348 typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type; 1349 }; 1350 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1351 1352 template <class EVT,class FSM,class SourceState,class TargetState> 1353 typename ::boost::enable_if< 1354 typename ::boost::mpl::has_key< 1355 typename T1::tag_type,action_tag>::type, 1356 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Unary_Plus_1357 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1358 { 1359 return +T1()(evt,fsm,src,tgt); 1360 } 1361 template <class Event,class FSM,class STATE> 1362 typename ::boost::enable_if< 1363 typename ::boost::mpl::has_key< 1364 typename T1::tag_type,state_action_tag>::type, 1365 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Unary_Plus_1366 operator()(Event const& evt,FSM& fsm,STATE& state )const 1367 { 1368 return +T1()(evt,fsm,state); 1369 } 1370 }; 1371 template <class T1> 1372 struct Unary_Minus_ : euml_action<Unary_Minus_<T1> > 1373 { 1374 template <class Event,class FSM,class STATE > 1375 struct state_action_result 1376 { 1377 typedef typename ::boost::remove_reference< 1378 typename get_result_type2<T1,Event,FSM,STATE>::type>::type type; 1379 }; 1380 template <class EVT,class FSM,class SourceState,class TargetState> 1381 struct transition_action_result 1382 { 1383 typedef typename ::boost::remove_reference< 1384 typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type; 1385 }; 1386 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1387 1388 template <class EVT,class FSM,class SourceState,class TargetState> 1389 typename ::boost::enable_if< 1390 typename ::boost::mpl::has_key< 1391 typename T1::tag_type,action_tag>::type, 1392 typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type operator ()boost::msm::front::euml::Unary_Minus_1393 operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1394 { 1395 return -(T1()(evt,fsm,src,tgt)); 1396 } 1397 template <class Event,class FSM,class STATE> 1398 typename ::boost::enable_if< 1399 typename ::boost::mpl::has_key< 1400 typename T1::tag_type,state_action_tag>::type, 1401 typename state_action_result<Event,FSM,STATE>::type >::type operator ()boost::msm::front::euml::Unary_Minus_1402 operator()(Event const& evt,FSM& fsm,STATE& state )const 1403 { 1404 return -(T1()(evt,fsm,state)); 1405 } 1406 }; 1407 template <class T1,class T2> 1408 struct Less_ : euml_action<Less_<T1,T2> > 1409 { 1410 template <class Event,class FSM,class STATE > 1411 struct state_action_result 1412 { 1413 typedef bool type; 1414 }; 1415 template <class EVT,class FSM,class SourceState,class TargetState> 1416 struct transition_action_result 1417 { 1418 typedef bool type; 1419 }; 1420 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1421 1422 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::Less_1423 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1424 { 1425 return (T1()(evt,fsm,src,tgt) < T2()(evt,fsm,src,tgt)); 1426 } 1427 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::Less_1428 bool operator()(Event const& evt,FSM& fsm,STATE& state)const 1429 { 1430 return (T1()(evt,fsm,state) < T2()(evt,fsm,state)); 1431 } 1432 }; 1433 template <class T1,class T2> 1434 struct LessEqual_ : euml_action<LessEqual_<T1,T2> > 1435 { 1436 template <class Event,class FSM,class STATE > 1437 struct state_action_result 1438 { 1439 typedef bool type; 1440 }; 1441 template <class EVT,class FSM,class SourceState,class TargetState> 1442 struct transition_action_result 1443 { 1444 typedef bool type; 1445 }; 1446 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1447 1448 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::LessEqual_1449 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1450 { 1451 return (T1()(evt,fsm,src,tgt) <= T2()(evt,fsm,src,tgt)); 1452 } 1453 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::LessEqual_1454 bool operator()(Event const& evt,FSM& fsm,STATE& state)const 1455 { 1456 return (T1()(evt,fsm,state) <= T2()(evt,fsm,state)); 1457 } 1458 }; 1459 template <class T1,class T2> 1460 struct Greater_ : euml_action<Greater_<T1,T2> > 1461 { 1462 template <class Event,class FSM,class STATE > 1463 struct state_action_result 1464 { 1465 typedef bool type; 1466 }; 1467 template <class EVT,class FSM,class SourceState,class TargetState> 1468 struct transition_action_result 1469 { 1470 typedef bool type; 1471 }; 1472 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1473 1474 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::Greater_1475 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1476 { 1477 return (T1()(evt,fsm,src,tgt) > T2()(evt,fsm,src,tgt)); 1478 } 1479 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::Greater_1480 bool operator()(Event const& evt,FSM& fsm,STATE& state)const 1481 { 1482 return (T1()(evt,fsm,state) > T2()(evt,fsm,state)); 1483 } 1484 }; 1485 template <class T1,class T2> 1486 struct GreaterEqual_ : euml_action<GreaterEqual_<T1,T2> > 1487 { 1488 template <class Event,class FSM,class STATE > 1489 struct state_action_result 1490 { 1491 typedef bool type; 1492 }; 1493 template <class EVT,class FSM,class SourceState,class TargetState> 1494 struct transition_action_result 1495 { 1496 typedef bool type; 1497 }; 1498 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1499 1500 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::GreaterEqual_1501 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1502 { 1503 return (T1()(evt,fsm,src,tgt) >= T2()(evt,fsm,src,tgt)); 1504 } 1505 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::GreaterEqual_1506 bool operator()(Event const& evt,FSM& fsm,STATE& state)const 1507 { 1508 return (T1()(evt,fsm,state) >= T2()(evt,fsm,state)); 1509 } 1510 }; 1511 template <class T1,class T2> 1512 struct EqualTo_ : euml_action<EqualTo_<T1,T2> > 1513 { 1514 template <class Event,class FSM,class STATE > 1515 struct state_action_result 1516 { 1517 typedef bool type; 1518 }; 1519 template <class EVT,class FSM,class SourceState,class TargetState> 1520 struct transition_action_result 1521 { 1522 typedef bool type; 1523 }; 1524 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1525 1526 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::EqualTo_1527 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1528 { 1529 return (T1()(evt,fsm,src,tgt) == T2()(evt,fsm,src,tgt)); 1530 } 1531 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::EqualTo_1532 bool operator()(Event const& evt,FSM& fsm,STATE& state)const 1533 { 1534 return (T1()(evt,fsm,state) == T2()(evt,fsm,state)); 1535 } 1536 }; 1537 template <class T1,class T2> 1538 struct NotEqualTo_ : euml_action<NotEqualTo_<T1,T2> > 1539 { 1540 template <class Event,class FSM,class STATE > 1541 struct state_action_result 1542 { 1543 typedef bool type; 1544 }; 1545 template <class EVT,class FSM,class SourceState,class TargetState> 1546 struct transition_action_result 1547 { 1548 typedef bool type; 1549 }; 1550 typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type; 1551 1552 template <class EVT,class FSM,class SourceState,class TargetState> operator ()boost::msm::front::euml::NotEqualTo_1553 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const 1554 { 1555 return (T1()(evt,fsm,src,tgt) != T2()(evt,fsm,src,tgt)); 1556 } 1557 template <class Event,class FSM,class STATE> operator ()boost::msm::front::euml::NotEqualTo_1558 bool operator()(Event const& evt,FSM& fsm,STATE& state)const 1559 { 1560 return (T1()(evt,fsm,state) != T2()(evt,fsm,state)); 1561 } 1562 }; 1563 1564 }}}} 1565 1566 #endif // BOOST_MSM_FRONT_EUML_OPERATOR_H 1567