| 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_COMMON_H |
| 12 | #define BOOST_MSM_FRONT_EUML_COMMON_H |
| 13 | |
| 14 | #include <boost/config.hpp> |
| 15 | #include <boost/msm/proto_config.hpp> |
| 16 | |
| 17 | #include <iterator> |
| 18 | #include <utility> |
| 19 | |
| 20 | #include <boost/proto/core.hpp> |
| 21 | #include <boost/proto/transform.hpp> |
| 22 | |
| 23 | #include <boost/utility/enable_if.hpp> |
| 24 | #include <boost/type_traits/is_same.hpp> |
| 25 | #include <boost/type_traits/remove_reference.hpp> |
| 26 | #include <boost/type_traits/add_const.hpp> |
| 27 | |
| 28 | #include <boost/mpl/vector.hpp> |
| 29 | #include <boost/mpl/set.hpp> |
| 30 | #include <boost/mpl/has_key.hpp> |
| 31 | #include <boost/mpl/int.hpp> |
| 32 | #include <boost/mpl/less_equal.hpp> |
| 33 | |
| 34 | #if BOOST_VERSION >= 104000 |
| 35 | #include <boost/mpl/string.hpp> |
| 36 | #endif |
| 37 | |
| 38 | #include <boost/fusion/container/vector.hpp> |
| 39 | #include <boost/fusion/container/set.hpp> |
| 40 | #include <boost/fusion/include/at_c.hpp> |
| 41 | #include <boost/fusion/include/make_map.hpp> |
| 42 | #include <boost/fusion/include/pair.hpp> |
| 43 | #include <boost/fusion/include/as_vector.hpp> |
| 44 | #include <boost/fusion/include/pair.hpp> |
| 45 | #include <boost/fusion/include/is_sequence.hpp> |
| 46 | |
| 47 | #include <boost/type_traits/remove_reference.hpp> |
| 48 | |
| 49 | #include <boost/preprocessor/repetition/enum_params.hpp> |
| 50 | #include <boost/preprocessor/arithmetic/sub.hpp> |
| 51 | #include <boost/preprocessor/punctuation/comma_if.hpp> |
| 52 | #include <boost/preprocessor/control/expr_if.hpp> |
| 53 | #include <boost/preprocessor/punctuation/comma.hpp> |
| 54 | #include <boost/preprocessor/arithmetic/add.hpp> |
| 55 | #include <boost/preprocessor/cat.hpp> |
| 56 | #include <boost/preprocessor/comparison/less.hpp> |
| 57 | #include <boost/preprocessor/arithmetic/dec.hpp> |
| 58 | #include <boost/preprocessor/repetition/repeat_from_to.hpp> |
| 59 | #include <boost/preprocessor/cat.hpp> |
| 60 | |
| 61 | #include <boost/msm/msm_grammar.hpp> |
| 62 | #include <boost/msm/active_state_switching_policies.hpp> |
| 63 | #include <boost/msm/event_traits.hpp> |
| 64 | #include <boost/msm/front/functor_row.hpp> |
| 65 | |
| 66 | namespace proto = boost::proto; |
| 67 | |
| 68 | BOOST_MPL_HAS_XXX_TRAIT_DEF(tag_type) |
| 69 | BOOST_MPL_HAS_XXX_TRAIT_DEF(action_name) |
| 70 | BOOST_MPL_HAS_XXX_TRAIT_DEF(not_intern_euml_state) |
| 71 | |
| 72 | namespace boost { namespace msm { namespace front { namespace euml |
| 73 | { |
| 74 | template <class T> |
| 75 | struct get_iterator |
| 76 | { |
| 77 | typedef typename T::iterator type; |
| 78 | }; |
| 79 | template <class T> |
| 80 | struct get_reverse_iterator |
| 81 | { |
| 82 | typedef typename T::reverse_iterator type; |
| 83 | }; |
| 84 | template <class T> |
| 85 | struct get_reference |
| 86 | { |
| 87 | typedef typename T::reference type; |
| 88 | }; |
| 89 | template <class T> |
| 90 | struct get_size_type |
| 91 | { |
| 92 | typedef typename T::size_type type; |
| 93 | }; |
| 94 | template <class T> |
| 95 | struct get_value_type |
| 96 | { |
| 97 | typedef typename T::value_type type; |
| 98 | }; |
| 99 | template <class T> |
| 100 | struct get_first_type |
| 101 | { |
| 102 | typedef typename T::first_type type; |
| 103 | }; |
| 104 | template <class T> |
| 105 | struct get_second_type |
| 106 | { |
| 107 | typedef typename T::second_type type; |
| 108 | }; |
| 109 | template <class T> |
| 110 | struct get_action_tag_type |
| 111 | { |
| 112 | typedef typename ::boost::mpl::has_key< |
| 113 | typename T::tag_type,action_tag>::type type; |
| 114 | }; |
| 115 | template <class T> |
| 116 | struct get_state_action_tag_type |
| 117 | { |
| 118 | typedef typename ::boost::mpl::has_key< |
| 119 | typename T::tag_type,state_action_tag>::type type; |
| 120 | }; |
| 121 | |
| 122 | template <class T,class EVT,class FSM,class SourceState,class TargetState> |
| 123 | struct get_result_type |
| 124 | { |
| 125 | typedef typename T::template transition_action_result<EVT,FSM,SourceState,TargetState>::type type; |
| 126 | }; |
| 127 | template <class T,class Event,class FSM,class STATE> |
| 128 | struct get_result_type2 |
| 129 | { |
| 130 | typedef typename T::template state_action_result<Event,FSM,STATE>::type type; |
| 131 | }; |
| 132 | template<class SEQ> |
| 133 | struct get_sequence |
| 134 | { |
| 135 | typedef typename SEQ::sequence type; |
| 136 | }; |
| 137 | |
| 138 | template <class T> |
| 139 | struct get_attributes_type |
| 140 | { |
| 141 | typedef typename T::attributes_type type; |
| 142 | }; |
| 143 | |
| 144 | template <class T> |
| 145 | struct get_euml_tag_type |
| 146 | { |
| 147 | typedef typename T::euml_tag_type type; |
| 148 | }; |
| 149 | |
| 150 | template <class T,class Arg1=void,class Arg2=void,class Arg3=void,class Arg4=void,class Arg5=void |
| 151 | #ifdef BOOST_MSVC |
| 152 | ,class Arg6=void |
| 153 | #endif |
| 154 | > |
| 155 | struct get_fct |
| 156 | { |
| 157 | typedef typename T::template In<Arg1,Arg2,Arg3,Arg4,Arg5 |
| 158 | #ifdef BOOST_MSVC |
| 159 | ,Arg6 |
| 160 | #endif |
| 161 | >::type type; |
| 162 | }; |
| 163 | |
| 164 | // used to differentiate between different types of euml_state's |
| 165 | template <class T,class Enable=void> |
| 166 | struct get_state_name |
| 167 | { |
| 168 | typedef T type; |
| 169 | }; |
| 170 | |
| 171 | template <class T> |
| 172 | struct get_state_name<T,typename ::boost::enable_if<has_not_intern_euml_state<T> >::type> |
| 173 | { |
| 174 | typedef typename T::In::type type; |
| 175 | }; |
| 176 | |
| 177 | template <class T> |
| 178 | struct get_action_name |
| 179 | { |
| 180 | typedef typename T::action_name type; |
| 181 | }; |
| 182 | template <class T> |
| 183 | struct get_event_name |
| 184 | { |
| 185 | typedef typename T::event_name type; |
| 186 | }; |
| 187 | |
| 188 | template <class EVT> |
| 189 | struct euml_event: proto::extends<typename proto::terminal<event_tag>::type, EVT, boost::msm::sm_domain> |
| 190 | { |
| 191 | typedef event_tag euml_tag_type; |
| 192 | typedef EVT event_name; |
| 193 | using proto::extends<typename proto::terminal<event_tag>::type, EVT, boost::msm::sm_domain>::operator=; |
| 194 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 195 | #ifdef BOOST_MSVC |
| 196 | ,class Arg6 |
| 197 | #endif |
| 198 | > |
| 199 | struct In |
| 200 | { |
| 201 | typedef EVT type; |
| 202 | }; |
| 203 | }; |
| 204 | |
| 205 | template <class STATE> |
| 206 | struct euml_state_intern: proto::extends<typename proto::terminal< boost::msm::state_tag>::type, STATE, boost::msm::state_domain> |
| 207 | { |
| 208 | typedef state_tag euml_tag_type; |
| 209 | using proto::extends<typename proto::terminal<state_tag>::type, STATE, boost::msm::state_domain>::operator=; |
| 210 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 211 | #ifdef BOOST_MSVC |
| 212 | ,class Arg6 |
| 213 | #endif |
| 214 | > |
| 215 | struct In |
| 216 | { |
| 217 | typedef STATE type; |
| 218 | }; |
| 219 | }; |
| 220 | template <class STATE> |
| 221 | struct euml_state: proto::extends<typename proto::terminal< boost::msm::state_tag>::type, STATE, boost::msm::state_domain> |
| 222 | { |
| 223 | typedef state_tag euml_tag_type; |
| 224 | typedef int not_intern_euml_state; |
| 225 | using proto::extends<typename proto::terminal<state_tag>::type, STATE, boost::msm::state_domain>::operator=; |
| 226 | struct In |
| 227 | { |
| 228 | typedef STATE type; |
| 229 | }; |
| 230 | }; |
| 231 | template <class ACTION> |
| 232 | struct euml_action: proto::extends<typename proto::terminal<action_tag>::type, ACTION, boost::msm::sm_domain> |
| 233 | { |
| 234 | typedef action_tag euml_tag_type; |
| 235 | typedef ACTION action_name; |
| 236 | using proto::extends<typename proto::terminal<action_tag>::type, ACTION, boost::msm::sm_domain>::operator=; |
| 237 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 238 | #ifdef BOOST_MSVC |
| 239 | ,class Arg6 |
| 240 | #endif |
| 241 | > |
| 242 | struct In |
| 243 | { |
| 244 | typedef ACTION type; |
| 245 | }; |
| 246 | }; |
| 247 | template <class FLAG> |
| 248 | struct euml_flag: proto::extends<typename proto::terminal<flag_tag>::type, FLAG, boost::msm::sm_domain> |
| 249 | { |
| 250 | typedef flag_tag euml_tag_type; |
| 251 | using proto::extends<typename proto::terminal<flag_tag>::type, FLAG, boost::msm::sm_domain>::operator=; |
| 252 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 253 | #ifdef BOOST_MSVC |
| 254 | ,class Arg6 |
| 255 | #endif |
| 256 | > |
| 257 | struct In |
| 258 | { |
| 259 | typedef FLAG type; |
| 260 | }; |
| 261 | }; |
| 262 | |
| 263 | template <class CONFIG> |
| 264 | struct euml_config: proto::extends<typename proto::terminal<config_tag>::type, CONFIG, boost::msm::sm_domain> |
| 265 | { |
| 266 | typedef config_tag euml_tag_type; |
| 267 | using proto::extends<typename proto::terminal<config_tag>::type, CONFIG, boost::msm::sm_domain>::operator=; |
| 268 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 269 | #ifdef BOOST_MSVC |
| 270 | ,class Arg6 |
| 271 | #endif |
| 272 | > |
| 273 | struct In |
| 274 | { |
| 275 | typedef CONFIG type; |
| 276 | }; |
| 277 | }; |
| 278 | |
| 279 | struct No_Exception : euml_config<No_Exception> |
| 280 | { |
| 281 | typedef int no_exception_thrown; |
| 282 | No_Exception(){} |
| 283 | }; |
| 284 | struct No_Msg_Queue : euml_config<No_Msg_Queue> |
| 285 | { |
| 286 | typedef int no_message_queue; |
| 287 | No_Msg_Queue(){} |
| 288 | }; |
| 289 | struct Deferred_Events : euml_config<Deferred_Events> |
| 290 | { |
| 291 | typedef int activate_deferred_events; |
| 292 | Deferred_Events(){} |
| 293 | }; |
| 294 | No_Exception const no_exception=No_Exception(); |
| 295 | No_Msg_Queue const no_msg_queue=No_Msg_Queue(); |
| 296 | Deferred_Events const deferred_events=Deferred_Events(); |
| 297 | |
| 298 | struct ActiveStateSwitchBeforeTransition : euml_config<ActiveStateSwitchBeforeTransition> |
| 299 | { |
| 300 | typedef boost::msm::active_state_switch_before_transition active_state_switch_policy; |
| 301 | ActiveStateSwitchBeforeTransition(){} |
| 302 | }; |
| 303 | ActiveStateSwitchBeforeTransition const switch_active_before_transition = ActiveStateSwitchBeforeTransition(); |
| 304 | |
| 305 | struct ActiveStateSwitchAfterExit : euml_config<ActiveStateSwitchAfterExit> |
| 306 | { |
| 307 | typedef boost::msm::active_state_switch_after_exit active_state_switch_policy; |
| 308 | ActiveStateSwitchAfterExit(){} |
| 309 | }; |
| 310 | ActiveStateSwitchAfterExit const switch_active_after_exit = ActiveStateSwitchAfterExit(); |
| 311 | |
| 312 | struct ActiveStateSwitchAfterAction : euml_config<ActiveStateSwitchAfterAction> |
| 313 | { |
| 314 | typedef boost::msm::active_state_switch_after_transition_action active_state_switch_policy; |
| 315 | ActiveStateSwitchAfterAction(){} |
| 316 | }; |
| 317 | ActiveStateSwitchAfterAction const switch_active_after_action = ActiveStateSwitchAfterAction(); |
| 318 | |
| 319 | |
| 320 | struct invalid_type{}; |
| 321 | struct make_invalid_type |
| 322 | { |
| 323 | typedef invalid_type type; |
| 324 | }; |
| 325 | |
| 326 | template <class ROW> |
| 327 | struct make_vector_one_row |
| 328 | { |
| 329 | typedef boost::fusion::vector<ROW> type; |
| 330 | }; |
| 331 | template <class T> |
| 332 | T make_T(T t) {return t;} |
| 333 | |
| 334 | struct make_vector_no_row |
| 335 | { |
| 336 | typedef boost::fusion::vector<> type; |
| 337 | }; |
| 338 | |
| 339 | struct NoAction : euml_action<NoAction> |
| 340 | { |
| 341 | NoAction(){} |
| 342 | // return value if used inside a state action (entry/exit) |
| 343 | template <class Event,class FSM,class STATE > |
| 344 | struct state_action_result |
| 345 | { |
| 346 | typedef bool type; |
| 347 | }; |
| 348 | // return value if used inside a transition (action/guard) |
| 349 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 350 | struct transition_action_result |
| 351 | { |
| 352 | typedef bool type; |
| 353 | }; |
| 354 | // this functor can be used in both modes, state action and transition action |
| 355 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 356 | |
| 357 | template <class Event,class FSM,class STATE> |
| 358 | bool operator()(Event const&,FSM&,STATE& ) |
| 359 | { |
| 360 | // does nothing |
| 361 | return true; |
| 362 | } |
| 363 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 364 | bool operator()(EVT const& ,FSM& ,SourceState& ,TargetState&)const |
| 365 | { |
| 366 | // does nothing |
| 367 | return true; |
| 368 | } |
| 369 | }; |
| 370 | NoAction const no_action = NoAction(); |
| 371 | |
| 372 | struct fsm_artefact_tag {}; |
| 373 | template <class Index=void> |
| 374 | struct GetSource_ : euml_action<GetSource_<Index> > |
| 375 | { |
| 376 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 377 | struct transition_action_result |
| 378 | { |
| 379 | typedef typename ::boost::fusion::result_of::at_key<typename SourceState::attributes_type, |
| 380 | Index >::type type; |
| 381 | }; |
| 382 | typedef ::boost::fusion::set<action_tag> tag_type; |
| 383 | |
| 384 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 385 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type |
| 386 | operator()(EVT const& ,FSM& ,SourceState& src,TargetState&)const |
| 387 | { |
| 388 | return src.get_attribute(Index()); |
| 389 | } |
| 390 | }; |
| 391 | template<> |
| 392 | struct GetSource_<void> : euml_action<GetSource_<void> > |
| 393 | { |
| 394 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 395 | struct transition_action_result |
| 396 | { |
| 397 | typedef SourceState& type; |
| 398 | }; |
| 399 | typedef ::boost::fusion::set<action_tag> tag_type; |
| 400 | |
| 401 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 402 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type |
| 403 | operator()(EVT const& , FSM&,SourceState& src,TargetState& )const |
| 404 | { |
| 405 | return src; |
| 406 | } |
| 407 | }; |
| 408 | struct GetSource_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, GetSource_Helper, boost::msm::sm_domain> |
| 409 | { |
| 410 | GetSource_Helper(){} |
| 411 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 412 | #ifdef BOOST_MSVC |
| 413 | ,class Arg6 |
| 414 | #endif |
| 415 | > |
| 416 | struct In |
| 417 | { |
| 418 | typedef GetSource_<Arg1> type; |
| 419 | }; |
| 420 | }; |
| 421 | GetSource_Helper const source_ = GetSource_Helper(); |
| 422 | |
| 423 | template <class Index=void> |
| 424 | struct GetTarget_ : euml_action<GetTarget_<Index> > |
| 425 | { |
| 426 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 427 | struct transition_action_result |
| 428 | { |
| 429 | typedef typename ::boost::fusion::result_of::at_key<typename TargetState::attributes_type, |
| 430 | Index >::type type; |
| 431 | }; |
| 432 | typedef ::boost::fusion::set<action_tag> tag_type; |
| 433 | |
| 434 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 435 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type |
| 436 | operator()(EVT const& ,FSM& ,SourceState& ,TargetState& tgt)const |
| 437 | { |
| 438 | return tgt.get_attribute(Index()); |
| 439 | } |
| 440 | }; |
| 441 | template<> |
| 442 | struct GetTarget_<void> : euml_action<GetTarget_<void> > |
| 443 | { |
| 444 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 445 | struct transition_action_result |
| 446 | { |
| 447 | typedef TargetState& type; |
| 448 | }; |
| 449 | typedef ::boost::fusion::set<action_tag> tag_type; |
| 450 | |
| 451 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 452 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type |
| 453 | operator()(EVT const& , FSM&,SourceState& ,TargetState& tgt)const |
| 454 | { |
| 455 | return tgt; |
| 456 | } |
| 457 | }; |
| 458 | struct GetTarget_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, GetTarget_Helper, boost::msm::sm_domain> |
| 459 | { |
| 460 | GetTarget_Helper(){} |
| 461 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 462 | #ifdef BOOST_MSVC |
| 463 | ,class Arg6 |
| 464 | #endif |
| 465 | > |
| 466 | struct In |
| 467 | { |
| 468 | typedef GetTarget_<Arg1> type; |
| 469 | }; |
| 470 | }; |
| 471 | GetTarget_Helper const target_ = GetTarget_Helper(); |
| 472 | |
| 473 | template <class Index=void> |
| 474 | struct GetState_ : euml_action<GetState_<Index> > |
| 475 | { |
| 476 | template <class Event,class FSM,class STATE > |
| 477 | struct state_action_result |
| 478 | { |
| 479 | typedef typename ::boost::fusion::result_of::at_key<typename STATE::attributes_type, |
| 480 | Index >::type type; |
| 481 | }; |
| 482 | typedef ::boost::fusion::set<state_action_tag> tag_type; |
| 483 | |
| 484 | template <class Event,class FSM,class STATE> |
| 485 | typename state_action_result<Event,FSM,STATE>::type |
| 486 | operator()(Event const&,FSM& ,STATE& state ) |
| 487 | { |
| 488 | return state.get_attribute(Index()); |
| 489 | } |
| 490 | }; |
| 491 | template<> |
| 492 | struct GetState_<void> : euml_action<GetState_<void> > |
| 493 | { |
| 494 | using euml_action<GetState_ >::operator=; |
| 495 | |
| 496 | template <class Event,class FSM,class STATE > |
| 497 | struct state_action_result |
| 498 | { |
| 499 | typedef STATE& type; |
| 500 | }; |
| 501 | typedef ::boost::fusion::set<state_action_tag> tag_type; |
| 502 | |
| 503 | template <class Event,class FSM,class STATE> |
| 504 | typename state_action_result<Event,FSM,STATE>::type |
| 505 | operator()(Event const&,FSM& ,STATE& state ) |
| 506 | { |
| 507 | return state; |
| 508 | } |
| 509 | }; |
| 510 | struct GetState_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, GetState_Helper, boost::msm::sm_domain> |
| 511 | { |
| 512 | GetState_Helper(){} |
| 513 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 514 | #ifdef BOOST_MSVC |
| 515 | ,class Arg6 |
| 516 | #endif |
| 517 | > |
| 518 | struct In |
| 519 | { |
| 520 | typedef GetState_<Arg1> type; |
| 521 | }; |
| 522 | }; |
| 523 | GetState_Helper const state_ = GetState_Helper(); |
| 524 | |
| 525 | template <class Index=void> |
| 526 | struct GetEvent_ : euml_action<GetEvent_<Index> > |
| 527 | { |
| 528 | template <class Event,class FSM,class STATE > |
| 529 | struct state_action_result |
| 530 | { |
| 531 | typedef typename ::boost::add_const< |
| 532 | typename ::boost::fusion::result_of::at_key<typename Event::attributes_type, |
| 533 | Index >::type>::type type; |
| 534 | }; |
| 535 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 536 | struct transition_action_result |
| 537 | { |
| 538 | typedef typename ::boost::add_const< |
| 539 | typename ::boost::fusion::result_of::at_key<typename EVT::attributes_type, |
| 540 | Index >::type>::type type; |
| 541 | }; |
| 542 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 543 | |
| 544 | template <class Event,class FSM,class STATE> |
| 545 | typename state_action_result<Event,FSM,STATE>::type |
| 546 | operator()(Event const& evt,FSM& ,STATE& ) |
| 547 | { |
| 548 | return evt.get_attribute(Index()); |
| 549 | } |
| 550 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 551 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type |
| 552 | operator()(EVT const& evt ,FSM& ,SourceState& ,TargetState&)const |
| 553 | { |
| 554 | return evt.get_attribute(Index()); |
| 555 | } |
| 556 | }; |
| 557 | template <> |
| 558 | struct GetEvent_<void> : euml_action<GetEvent_<void> > |
| 559 | { |
| 560 | template <class Event,class FSM,class STATE > |
| 561 | struct state_action_result |
| 562 | { |
| 563 | typedef Event const& type; |
| 564 | }; |
| 565 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 566 | struct transition_action_result |
| 567 | { |
| 568 | typedef EVT const& type; |
| 569 | }; |
| 570 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 571 | |
| 572 | template <class Event,class FSM,class STATE> |
| 573 | typename state_action_result<Event,FSM,STATE>::type |
| 574 | operator()(Event const& evt,FSM& ,STATE& ) |
| 575 | { |
| 576 | return evt; |
| 577 | } |
| 578 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 579 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type |
| 580 | operator()(EVT const& evt ,FSM& ,SourceState& ,TargetState&)const |
| 581 | { |
| 582 | return evt; |
| 583 | } |
| 584 | }; |
| 585 | struct GetEvent_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, GetEvent_Helper, boost::msm::sm_domain> |
| 586 | { |
| 587 | GetEvent_Helper(){} |
| 588 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 589 | #ifdef BOOST_MSVC |
| 590 | ,class Arg6 |
| 591 | #endif |
| 592 | > |
| 593 | struct In |
| 594 | { |
| 595 | typedef GetEvent_<Arg1> type; |
| 596 | }; |
| 597 | }; |
| 598 | GetEvent_Helper const event_ = GetEvent_Helper(); |
| 599 | |
| 600 | template <class Index=void> |
| 601 | struct GetFsm_ : euml_action<GetFsm_<Index> > |
| 602 | { |
| 603 | template <class Event,class FSM,class STATE > |
| 604 | struct state_action_result |
| 605 | { |
| 606 | typedef typename ::boost::fusion::result_of::at_key<typename FSM::attributes_type, |
| 607 | Index >::type type; |
| 608 | }; |
| 609 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 610 | struct transition_action_result |
| 611 | { |
| 612 | typedef typename ::boost::fusion::result_of::at_key<typename FSM::attributes_type, |
| 613 | Index >::type type; |
| 614 | }; |
| 615 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 616 | |
| 617 | template <class Event,class FSM,class STATE> |
| 618 | typename state_action_result<Event,FSM,STATE>::type |
| 619 | operator()(Event const&,FSM& fsm,STATE& ) |
| 620 | { |
| 621 | return fsm.get_attribute(Index()); |
| 622 | } |
| 623 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 624 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type |
| 625 | operator()(EVT const& ,FSM& fsm,SourceState& ,TargetState&)const |
| 626 | { |
| 627 | return fsm.get_attribute(Index()); |
| 628 | } |
| 629 | }; |
| 630 | template<> |
| 631 | struct GetFsm_<void> : euml_action<GetFsm_<void> > |
| 632 | { |
| 633 | using euml_action<GetFsm_>::operator=; |
| 634 | |
| 635 | template <class Event,class FSM,class STATE > |
| 636 | struct state_action_result |
| 637 | { |
| 638 | typedef FSM& type; |
| 639 | }; |
| 640 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 641 | struct transition_action_result |
| 642 | { |
| 643 | typedef FSM& type; |
| 644 | }; |
| 645 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 646 | |
| 647 | template <class Event,class FSM,class STATE> |
| 648 | typename state_action_result<Event,FSM,STATE>::type |
| 649 | operator()(Event const&,FSM& fsm,STATE& ) |
| 650 | { |
| 651 | return fsm; |
| 652 | } |
| 653 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 654 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type |
| 655 | operator()(EVT const& ,FSM& fsm,SourceState& ,TargetState&)const |
| 656 | { |
| 657 | return fsm; |
| 658 | } |
| 659 | }; |
| 660 | struct GetFsm_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, GetFsm_Helper, boost::msm::sm_domain> |
| 661 | { |
| 662 | GetFsm_Helper(){} |
| 663 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 664 | #ifdef BOOST_MSVC |
| 665 | ,class Arg6 |
| 666 | #endif |
| 667 | > |
| 668 | struct In |
| 669 | { |
| 670 | typedef GetFsm_<Arg1> type; |
| 671 | }; |
| 672 | }; |
| 673 | GetFsm_Helper const fsm_ = GetFsm_Helper(); |
| 674 | |
| 675 | template <class StateName,class Param1> |
| 676 | struct SubState_ : euml_action<SubState_<StateName, Param1> > |
| 677 | { |
| 678 | template <class Event,class FSM,class STATE > |
| 679 | struct state_action_result |
| 680 | { |
| 681 | typedef StateName& type; |
| 682 | }; |
| 683 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 684 | struct transition_action_result |
| 685 | { |
| 686 | typedef StateName& type; |
| 687 | }; |
| 688 | |
| 689 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 690 | |
| 691 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 692 | StateName& operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 693 | { |
| 694 | return (Param1()(evt,fsm,src,tgt)).template get_state<StateName&>(); |
| 695 | } |
| 696 | template <class Event,class FSM,class STATE> |
| 697 | StateName& operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 698 | { |
| 699 | return (Param1()(evt,fsm,state)).template get_state<StateName&>(); |
| 700 | } |
| 701 | }; |
| 702 | template <class StateName> |
| 703 | struct SubState_ <StateName,void> |
| 704 | : euml_action<SubState_<StateName, void > > |
| 705 | { |
| 706 | template <class Event,class FSM,class STATE > |
| 707 | struct state_action_result |
| 708 | { |
| 709 | typedef StateName& type; |
| 710 | }; |
| 711 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 712 | struct transition_action_result |
| 713 | { |
| 714 | typedef StateName& type; |
| 715 | }; |
| 716 | |
| 717 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 718 | |
| 719 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 720 | StateName& operator()(EVT const&,FSM& fsm,SourceState& ,TargetState& )const |
| 721 | { |
| 722 | return fsm.template get_state<StateName&>(); |
| 723 | } |
| 724 | template <class Event,class FSM,class STATE> |
| 725 | StateName& operator()(Event const& ,FSM& fsm,STATE& )const |
| 726 | { |
| 727 | return fsm.template get_state<StateName&>(); |
| 728 | } |
| 729 | }; |
| 730 | |
| 731 | struct SubState_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, SubState_Helper, boost::msm::sm_domain> |
| 732 | { |
| 733 | SubState_Helper(){} |
| 734 | using proto::extends< proto::terminal<fsm_artefact_tag>::type, SubState_Helper, boost::msm::sm_domain>::operator=; |
| 735 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 736 | #ifdef BOOST_MSVC |
| 737 | ,class Arg6 |
| 738 | #endif |
| 739 | > |
| 740 | struct In |
| 741 | { |
| 742 | typedef SubState_<Arg1,Arg2> type; |
| 743 | }; |
| 744 | }; |
| 745 | SubState_Helper const substate_ = SubState_Helper(); |
| 746 | |
| 747 | template <class Target,class Index> |
| 748 | struct GetAttribute_ : euml_action<GetAttribute_<Target, Index> > |
| 749 | { |
| 750 | using euml_action<GetAttribute_<Target,Index> >::operator=; |
| 751 | template <class Event,class FSM,class STATE > |
| 752 | struct state_action_result |
| 753 | { |
| 754 | typedef typename |
| 755 | ::boost::fusion::result_of::at_key< |
| 756 | typename get_attributes_type< |
| 757 | typename ::boost::remove_reference< |
| 758 | typename get_result_type2<Target,Event,FSM,STATE>::type>::type>::type, |
| 759 | Index >::type type; |
| 760 | }; |
| 761 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 762 | struct transition_action_result |
| 763 | { |
| 764 | typedef typename |
| 765 | ::boost::fusion::result_of::at_key< |
| 766 | typename get_attributes_type< |
| 767 | typename ::boost::remove_reference< |
| 768 | typename get_result_type<Target,EVT,FSM,SourceState,TargetState>::type>::type>::type, |
| 769 | Index >::type type; |
| 770 | }; |
| 771 | |
| 772 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 773 | |
| 774 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 775 | typename ::boost::enable_if< |
| 776 | typename ::boost::mpl::has_key< |
| 777 | typename Target::tag_type,action_tag>::type, |
| 778 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type |
| 779 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const |
| 780 | { |
| 781 | return (Target()(evt,fsm,src,tgt)).get_attribute(Index()); |
| 782 | } |
| 783 | template <class Event,class FSM,class STATE> |
| 784 | typename ::boost::enable_if< |
| 785 | typename ::boost::mpl::has_key< |
| 786 | typename Target::tag_type,state_action_tag>::type, |
| 787 | typename state_action_result<Event,FSM,STATE>::type >::type |
| 788 | operator()(Event const& evt,FSM& fsm,STATE& state )const |
| 789 | { |
| 790 | return (Target()(evt,fsm,state)).get_attribute(Index()); |
| 791 | } |
| 792 | }; |
| 793 | |
| 794 | struct GetAttribute_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, GetAttribute_Helper, boost::msm::sm_domain> |
| 795 | { |
| 796 | GetAttribute_Helper(){} |
| 797 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 798 | #ifdef BOOST_MSVC |
| 799 | ,class Arg6 |
| 800 | #endif |
| 801 | > |
| 802 | struct In |
| 803 | { |
| 804 | typedef GetAttribute_<Arg1,Arg2> type; |
| 805 | }; |
| 806 | }; |
| 807 | GetAttribute_Helper const attribute_ = GetAttribute_Helper(); |
| 808 | |
| 809 | template <class Index> |
| 810 | struct Source_ : euml_action<Source_<Index> > |
| 811 | { |
| 812 | using euml_action<Source_<Index> >::operator=; |
| 813 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 814 | struct transition_action_result |
| 815 | { |
| 816 | typedef typename |
| 817 | ::boost::fusion::result_of::at_key<typename SourceState::attributes_type, |
| 818 | Index >::type type; |
| 819 | }; |
| 820 | typedef ::boost::fusion::set<action_tag> tag_type; |
| 821 | |
| 822 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 823 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type |
| 824 | operator()(EVT const& , FSM&,SourceState& src,TargetState& )const |
| 825 | { |
| 826 | return src.get_attribute(Index()); |
| 827 | } |
| 828 | }; |
| 829 | template <class Index> |
| 830 | struct Target_ : euml_action<Target_<Index> > |
| 831 | { |
| 832 | using euml_action<Target_<Index> >::operator=; |
| 833 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 834 | struct transition_action_result |
| 835 | { |
| 836 | typedef typename |
| 837 | ::boost::fusion::result_of::at_key<typename TargetState::attributes_type, |
| 838 | Index >::type type; |
| 839 | }; |
| 840 | typedef ::boost::fusion::set<action_tag> tag_type; |
| 841 | |
| 842 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 843 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type |
| 844 | operator()(EVT const& ,FSM& ,SourceState& ,TargetState& tgt)const |
| 845 | { |
| 846 | return tgt.get_attribute(Index()); |
| 847 | } |
| 848 | }; |
| 849 | template <class Index> |
| 850 | struct State_ : euml_action<State_<Index> > |
| 851 | { |
| 852 | using euml_action<State_<Index> >::operator=; |
| 853 | |
| 854 | template <class Event,class FSM,class STATE > |
| 855 | struct state_action_result |
| 856 | { |
| 857 | typedef typename |
| 858 | ::boost::fusion::result_of::at_key<typename STATE::attributes_type, |
| 859 | Index >::type type; |
| 860 | }; |
| 861 | typedef ::boost::fusion::set<state_action_tag> tag_type; |
| 862 | |
| 863 | template <class Event,class FSM,class STATE> |
| 864 | typename state_action_result<Event,FSM,STATE>::type |
| 865 | operator()(Event const&,FSM& ,STATE& state ) |
| 866 | { |
| 867 | return state.get_attribute(Index()); |
| 868 | } |
| 869 | }; |
| 870 | template <class Index> |
| 871 | struct Event_ : euml_action<Event_<Index> > |
| 872 | { |
| 873 | using euml_action<Event_<Index> >::operator=; |
| 874 | |
| 875 | template <class Event,class FSM,class STATE > |
| 876 | struct state_action_result |
| 877 | { |
| 878 | typedef typename ::boost::add_const< |
| 879 | typename ::boost::fusion::result_of::at_key<typename Event::attributes_type, |
| 880 | Index >::type>::type type; |
| 881 | }; |
| 882 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 883 | struct transition_action_result |
| 884 | { |
| 885 | typedef typename ::boost::add_const< |
| 886 | typename ::boost::fusion::result_of::at_key<typename EVT::attributes_type, |
| 887 | Index >::type>::type type; |
| 888 | }; |
| 889 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 890 | |
| 891 | template <class Event,class FSM,class STATE> |
| 892 | typename state_action_result<Event,FSM,STATE>::type |
| 893 | operator()(Event const& evt,FSM& ,STATE& ) |
| 894 | { |
| 895 | return evt.get_attribute(Index()); |
| 896 | } |
| 897 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 898 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type |
| 899 | operator()(EVT const& evt ,FSM& ,SourceState& ,TargetState&)const |
| 900 | { |
| 901 | return evt.get_attribute(Index()); |
| 902 | } |
| 903 | }; |
| 904 | template <class StateType,class Index> |
| 905 | struct State_Attribute_ : euml_action<State_Attribute_<StateType,Index> > |
| 906 | { |
| 907 | using euml_action<State_Attribute_<StateType,Index> >::operator=; |
| 908 | |
| 909 | template <class Event,class FSM,class STATE > |
| 910 | struct state_action_result |
| 911 | { |
| 912 | typedef typename |
| 913 | ::boost::fusion::result_of::at_key<typename StateType::attributes_type, |
| 914 | Index >::type type; |
| 915 | }; |
| 916 | typedef ::boost::fusion::set<state_action_tag> tag_type; |
| 917 | |
| 918 | template <class Event,class FSM,class STATE> |
| 919 | typename state_action_result<Event,FSM,STATE>::type |
| 920 | operator()(Event const&,FSM& fsm,STATE& ) |
| 921 | { |
| 922 | return fsm.template get_state<StateType&>().get_attribute(Index()); |
| 923 | } |
| 924 | }; |
| 925 | |
| 926 | template <class Index> |
| 927 | struct Fsm_ : euml_action<Fsm_<Index> > |
| 928 | { |
| 929 | using euml_action<Fsm_<Index> >::operator=; |
| 930 | |
| 931 | template <class Event,class FSM,class STATE > |
| 932 | struct state_action_result |
| 933 | { |
| 934 | typedef typename |
| 935 | ::boost::fusion::result_of::at_key<typename FSM::attributes_type, |
| 936 | Index >::type type; |
| 937 | }; |
| 938 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 939 | struct transition_action_result |
| 940 | { |
| 941 | typedef typename |
| 942 | ::boost::fusion::result_of::at_key<typename FSM::attributes_type, |
| 943 | Index >::type type; |
| 944 | }; |
| 945 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 946 | |
| 947 | template <class Event,class FSM,class STATE> |
| 948 | typename state_action_result<Event,FSM,STATE>::type |
| 949 | operator()(Event const&,FSM& fsm,STATE& ) |
| 950 | { |
| 951 | return fsm.get_attribute(Index()); |
| 952 | } |
| 953 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 954 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type |
| 955 | operator()(EVT const& ,FSM& fsm,SourceState& ,TargetState&)const |
| 956 | { |
| 957 | return fsm.get_attribute(Index()); |
| 958 | } |
| 959 | }; |
| 960 | |
| 961 | struct True_ : euml::euml_action<True_> |
| 962 | { |
| 963 | using euml_action<True_>::operator=; |
| 964 | True_(){} |
| 965 | |
| 966 | template <class Event,class FSM,class STATE > |
| 967 | struct state_action_result |
| 968 | { |
| 969 | typedef bool type; |
| 970 | }; |
| 971 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 972 | struct transition_action_result |
| 973 | { |
| 974 | typedef bool type; |
| 975 | }; |
| 976 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 977 | |
| 978 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 979 | bool operator()(EVT const&,FSM&,SourceState& ,TargetState& ) |
| 980 | { |
| 981 | return true; |
| 982 | } |
| 983 | template <class Event,class FSM,class STATE> |
| 984 | bool operator()(Event const&,FSM&,STATE& ) |
| 985 | { |
| 986 | return true; |
| 987 | } |
| 988 | }; |
| 989 | True_ const true_ = True_(); |
| 990 | |
| 991 | struct False_ : euml::euml_action<False_> |
| 992 | { |
| 993 | using euml_action<False_>::operator=; |
| 994 | False_(){} |
| 995 | |
| 996 | template <class Event,class FSM,class STATE > |
| 997 | struct state_action_result |
| 998 | { |
| 999 | typedef bool type; |
| 1000 | }; |
| 1001 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1002 | struct transition_action_result |
| 1003 | { |
| 1004 | typedef bool type; |
| 1005 | }; |
| 1006 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1007 | |
| 1008 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1009 | bool operator()(EVT const&,FSM&,SourceState& ,TargetState& ) |
| 1010 | { |
| 1011 | return false; |
| 1012 | } |
| 1013 | template <class Event,class FSM,class STATE> |
| 1014 | bool operator()(Event const&,FSM&,STATE& ) |
| 1015 | { |
| 1016 | return false; |
| 1017 | } |
| 1018 | }; |
| 1019 | False_ const false_ = False_(); |
| 1020 | |
| 1021 | template <int Val> |
| 1022 | struct Int_ : euml_action<Int_<Val> > |
| 1023 | { |
| 1024 | using euml_action<Int_<Val> >::operator=; |
| 1025 | typedef ::boost::mpl::int_<Val> value_type; |
| 1026 | enum {value = Val}; |
| 1027 | |
| 1028 | template <class Event,class FSM,class STATE > |
| 1029 | struct state_action_result |
| 1030 | { |
| 1031 | typedef int type; |
| 1032 | }; |
| 1033 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1034 | struct transition_action_result |
| 1035 | { |
| 1036 | typedef int type; |
| 1037 | }; |
| 1038 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1039 | |
| 1040 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1041 | int operator()(EVT const& , FSM& ,SourceState& ,TargetState& ) |
| 1042 | { |
| 1043 | return Val; |
| 1044 | } |
| 1045 | template <class Event,class FSM,class STATE> |
| 1046 | int operator()(Event const& ,FSM& ,STATE& ) |
| 1047 | { |
| 1048 | return Val; |
| 1049 | } |
| 1050 | }; |
| 1051 | |
| 1052 | template <char Val> |
| 1053 | struct Char_ : euml_action<Char_<Val> > |
| 1054 | { |
| 1055 | using euml_action<Char_<Val> >::operator=; |
| 1056 | |
| 1057 | template <class Event,class FSM,class STATE > |
| 1058 | struct state_action_result |
| 1059 | { |
| 1060 | typedef char type; |
| 1061 | }; |
| 1062 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1063 | struct transition_action_result |
| 1064 | { |
| 1065 | typedef char type; |
| 1066 | }; |
| 1067 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1068 | |
| 1069 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1070 | char operator()(EVT const& , FSM& ,SourceState& ,TargetState& ) |
| 1071 | { |
| 1072 | return Val; |
| 1073 | } |
| 1074 | template <class Event,class FSM,class STATE> |
| 1075 | char operator()(Event const& ,FSM& ,STATE& ) |
| 1076 | { |
| 1077 | return Val; |
| 1078 | } |
| 1079 | }; |
| 1080 | |
| 1081 | template <size_t Val> |
| 1082 | struct Size_t_ : euml_action<Size_t_<Val> > |
| 1083 | { |
| 1084 | using euml_action<Size_t_<Val> >::operator=; |
| 1085 | |
| 1086 | template <class Event,class FSM,class STATE > |
| 1087 | struct state_action_result |
| 1088 | { |
| 1089 | typedef size_t type; |
| 1090 | }; |
| 1091 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1092 | struct transition_action_result |
| 1093 | { |
| 1094 | typedef size_t type; |
| 1095 | }; |
| 1096 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1097 | |
| 1098 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1099 | size_t operator()(EVT const& , FSM& ,SourceState& ,TargetState& ) |
| 1100 | { |
| 1101 | return Val; |
| 1102 | } |
| 1103 | template <class Event,class FSM,class STATE> |
| 1104 | size_t operator()(Event const& ,FSM& ,STATE& ) |
| 1105 | { |
| 1106 | return Val; |
| 1107 | } |
| 1108 | }; |
| 1109 | |
| 1110 | #if BOOST_VERSION >= 104000 |
| 1111 | |
| 1112 | template <class T> |
| 1113 | struct String_ : euml_action<String_<T> > |
| 1114 | { |
| 1115 | using euml_action<String_<T> >::operator=; |
| 1116 | |
| 1117 | template <class Event,class FSM,class STATE > |
| 1118 | struct state_action_result |
| 1119 | { |
| 1120 | typedef char const* type; |
| 1121 | }; |
| 1122 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1123 | struct transition_action_result |
| 1124 | { |
| 1125 | typedef char const* type; |
| 1126 | }; |
| 1127 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1128 | |
| 1129 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1130 | char const* operator()(EVT const& , FSM& ,SourceState& ,TargetState& ) |
| 1131 | { |
| 1132 | return ::boost::mpl::c_str<T>::value; |
| 1133 | } |
| 1134 | template <class Event,class FSM,class STATE> |
| 1135 | char const* operator()(Event const& ,FSM& ,STATE& ) |
| 1136 | { |
| 1137 | return ::boost::mpl::c_str<T>::value; |
| 1138 | } |
| 1139 | }; |
| 1140 | #endif |
| 1141 | |
| 1142 | |
| 1143 | template <class T> |
| 1144 | struct Predicate_ : euml_action<Predicate_<T> > |
| 1145 | { |
| 1146 | using euml_action<Predicate_<T> >::operator=; |
| 1147 | |
| 1148 | template <class Event,class FSM,class STATE > |
| 1149 | struct state_action_result |
| 1150 | { |
| 1151 | typedef T type; |
| 1152 | }; |
| 1153 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1154 | struct transition_action_result |
| 1155 | { |
| 1156 | typedef T type; |
| 1157 | }; |
| 1158 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1159 | |
| 1160 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1161 | T operator()(EVT const& , FSM& ,SourceState& ,TargetState& ) |
| 1162 | { |
| 1163 | return T(); |
| 1164 | } |
| 1165 | template <class Event,class FSM,class STATE> |
| 1166 | T operator()(Event const& ,FSM& ,STATE& ) |
| 1167 | { |
| 1168 | return T(); |
| 1169 | } |
| 1170 | }; |
| 1171 | |
| 1172 | template <class ToProcessEvt,class Param1, class Param2, class Param3, class Param4> |
| 1173 | struct Process_ : euml_action<Process_<ToProcessEvt, Param1, Param2, Param3, Param4> > |
| 1174 | { |
| 1175 | template <class Event,class FSM,class STATE > |
| 1176 | struct state_action_result |
| 1177 | { |
| 1178 | typedef void type; |
| 1179 | }; |
| 1180 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1181 | struct transition_action_result |
| 1182 | { |
| 1183 | typedef void type; |
| 1184 | }; |
| 1185 | |
| 1186 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1187 | |
| 1188 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1189 | void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1190 | { |
| 1191 | (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); |
| 1192 | (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); |
| 1193 | (Param3()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); |
| 1194 | (Param4()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); |
| 1195 | } |
| 1196 | template <class Event,class FSM,class STATE> |
| 1197 | void operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1198 | { |
| 1199 | (Param1()(evt,fsm,state)).process_event(ToProcessEvt()); |
| 1200 | (Param2()(evt,fsm,state)).process_event(ToProcessEvt()); |
| 1201 | (Param3()(evt,fsm,state)).process_event(ToProcessEvt()); |
| 1202 | (Param4()(evt,fsm,state)).process_event(ToProcessEvt()); |
| 1203 | } |
| 1204 | }; |
| 1205 | template <class ToProcessEvt> |
| 1206 | struct Process_ <ToProcessEvt,void,void,void,void> |
| 1207 | : euml_action<Process_<ToProcessEvt, void, void, void, void > > |
| 1208 | { |
| 1209 | template <class Event,class FSM,class STATE > |
| 1210 | struct state_action_result |
| 1211 | { |
| 1212 | typedef void type; |
| 1213 | }; |
| 1214 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1215 | struct transition_action_result |
| 1216 | { |
| 1217 | typedef void type; |
| 1218 | }; |
| 1219 | |
| 1220 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1221 | |
| 1222 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1223 | void operator()(EVT const&,FSM& fsm,SourceState& ,TargetState& )const |
| 1224 | { |
| 1225 | fsm.process_event(ToProcessEvt()); |
| 1226 | } |
| 1227 | template <class Event,class FSM,class STATE> |
| 1228 | void operator()(Event const& ,FSM& fsm,STATE& )const |
| 1229 | { |
| 1230 | fsm.process_event(ToProcessEvt()); |
| 1231 | } |
| 1232 | }; |
| 1233 | |
| 1234 | template <class ToProcessEvt,class Param1> |
| 1235 | struct Process_ <ToProcessEvt,Param1,void,void,void> |
| 1236 | : euml_action<Process_<ToProcessEvt, Param1, void, void, void> > |
| 1237 | { |
| 1238 | template <class Event,class FSM,class STATE > |
| 1239 | struct state_action_result |
| 1240 | { |
| 1241 | typedef void type; |
| 1242 | }; |
| 1243 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1244 | struct transition_action_result |
| 1245 | { |
| 1246 | typedef void type; |
| 1247 | }; |
| 1248 | |
| 1249 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1250 | |
| 1251 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1252 | void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1253 | { |
| 1254 | (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); |
| 1255 | } |
| 1256 | template <class Event,class FSM,class STATE> |
| 1257 | void operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1258 | { |
| 1259 | (Param1()(evt,fsm,state)).process_event(ToProcessEvt()); |
| 1260 | } |
| 1261 | }; |
| 1262 | |
| 1263 | template <class ToProcessEvt,class Param1, class Param2> |
| 1264 | struct Process_ <ToProcessEvt,Param1,Param2,void,void> |
| 1265 | : euml_action<Process_<ToProcessEvt, Param1, Param2, void, void> > |
| 1266 | { |
| 1267 | template <class Event,class FSM,class STATE > |
| 1268 | struct state_action_result |
| 1269 | { |
| 1270 | typedef void type; |
| 1271 | }; |
| 1272 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1273 | struct transition_action_result |
| 1274 | { |
| 1275 | typedef void type; |
| 1276 | }; |
| 1277 | |
| 1278 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1279 | |
| 1280 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1281 | void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1282 | { |
| 1283 | (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); |
| 1284 | (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); |
| 1285 | } |
| 1286 | template <class Event,class FSM,class STATE> |
| 1287 | void operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1288 | { |
| 1289 | (Param1()(evt,fsm,state)).process_event(ToProcessEvt()); |
| 1290 | (Param2()(evt,fsm,state)).process_event(ToProcessEvt()); |
| 1291 | } |
| 1292 | }; |
| 1293 | |
| 1294 | template <class ToProcessEvt,class Param1, class Param2, class Param3> |
| 1295 | struct Process_ <ToProcessEvt,Param1,Param2,Param3,void> |
| 1296 | : euml_action<Process_<ToProcessEvt, Param1, Param2, Param3, void> > |
| 1297 | { |
| 1298 | template <class Event,class FSM,class STATE > |
| 1299 | struct state_action_result |
| 1300 | { |
| 1301 | typedef void type; |
| 1302 | }; |
| 1303 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1304 | struct transition_action_result |
| 1305 | { |
| 1306 | typedef void type; |
| 1307 | }; |
| 1308 | |
| 1309 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1310 | |
| 1311 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1312 | void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1313 | { |
| 1314 | (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); |
| 1315 | (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); |
| 1316 | (Param3()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); |
| 1317 | } |
| 1318 | template <class Event,class FSM,class STATE> |
| 1319 | void operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1320 | { |
| 1321 | (Param1()(evt,fsm,state)).process_event(ToProcessEvt()); |
| 1322 | (Param2()(evt,fsm,state)).process_event(ToProcessEvt()); |
| 1323 | (Param3()(evt,fsm,state)).process_event(ToProcessEvt()); |
| 1324 | } |
| 1325 | }; |
| 1326 | |
| 1327 | //version for process_(event_) |
| 1328 | template <> |
| 1329 | struct Process_ <GetEvent_<void>,void,void,void,void> |
| 1330 | : euml_action<Process_<GetEvent_<void>, void, void, void, void > > |
| 1331 | { |
| 1332 | template <class Event,class FSM,class STATE > |
| 1333 | struct state_action_result |
| 1334 | { |
| 1335 | typedef void type; |
| 1336 | }; |
| 1337 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1338 | struct transition_action_result |
| 1339 | { |
| 1340 | typedef void type; |
| 1341 | }; |
| 1342 | |
| 1343 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1344 | |
| 1345 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1346 | void operator()(EVT const& evt,FSM& fsm,SourceState& ,TargetState& )const |
| 1347 | { |
| 1348 | fsm.process_event(evt); |
| 1349 | } |
| 1350 | template <class Event,class FSM,class STATE> |
| 1351 | void operator()(Event const& evt,FSM& fsm,STATE& )const |
| 1352 | { |
| 1353 | fsm.process_event(evt); |
| 1354 | } |
| 1355 | }; |
| 1356 | |
| 1357 | struct process_tag {}; |
| 1358 | struct Process_Helper: proto::extends< proto::terminal<process_tag>::type, Process_Helper, boost::msm::sm_domain> |
| 1359 | { |
| 1360 | Process_Helper(){} |
| 1361 | using proto::extends< proto::terminal<process_tag>::type, Process_Helper, boost::msm::sm_domain>::operator=; |
| 1362 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 1363 | #ifdef BOOST_MSVC |
| 1364 | ,class Arg6 |
| 1365 | #endif |
| 1366 | > |
| 1367 | struct In |
| 1368 | { |
| 1369 | typedef Process_<Arg1,Arg2,Arg3,Arg4,Arg5> type; |
| 1370 | }; |
| 1371 | }; |
| 1372 | Process_Helper const process_ = Process_Helper(); |
| 1373 | |
| 1374 | template <class Param1, class Param2, class Param3, class Param4> |
| 1375 | struct Reprocess_ : euml_action<Reprocess_<Param1, Param2, Param3, Param4> > |
| 1376 | { |
| 1377 | template <class Event,class FSM,class STATE > |
| 1378 | struct state_action_result |
| 1379 | { |
| 1380 | typedef void type; |
| 1381 | }; |
| 1382 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1383 | struct transition_action_result |
| 1384 | { |
| 1385 | typedef void type; |
| 1386 | }; |
| 1387 | |
| 1388 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1389 | |
| 1390 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1391 | void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1392 | { |
| 1393 | (Param1()(evt,fsm,src,tgt)).process_event(evt); |
| 1394 | (Param2()(evt,fsm,src,tgt)).process_event(evt); |
| 1395 | (Param3()(evt,fsm,src,tgt)).process_event(evt); |
| 1396 | (Param4()(evt,fsm,src,tgt)).process_event(evt); |
| 1397 | } |
| 1398 | template <class Event,class FSM,class STATE> |
| 1399 | void operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1400 | { |
| 1401 | (Param1()(evt,fsm,state)).process_event(evt); |
| 1402 | (Param2()(evt,fsm,state)).process_event(evt); |
| 1403 | (Param3()(evt,fsm,state)).process_event(evt); |
| 1404 | (Param4()(evt,fsm,state)).process_event(evt); |
| 1405 | } |
| 1406 | }; |
| 1407 | template <> |
| 1408 | struct Reprocess_ <void,void,void,void> |
| 1409 | : euml_action<Reprocess_<void, void, void, void > > |
| 1410 | { |
| 1411 | template <class Event,class FSM,class STATE > |
| 1412 | struct state_action_result |
| 1413 | { |
| 1414 | typedef void type; |
| 1415 | }; |
| 1416 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1417 | struct transition_action_result |
| 1418 | { |
| 1419 | typedef void type; |
| 1420 | }; |
| 1421 | |
| 1422 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1423 | |
| 1424 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1425 | void operator()(EVT const& evt,FSM& fsm,SourceState& ,TargetState& )const |
| 1426 | { |
| 1427 | fsm.process_event(evt); |
| 1428 | } |
| 1429 | template <class Event,class FSM,class STATE> |
| 1430 | void operator()(Event const& evt,FSM& fsm,STATE& )const |
| 1431 | { |
| 1432 | fsm.process_event(evt); |
| 1433 | } |
| 1434 | }; |
| 1435 | |
| 1436 | template <class Param1> |
| 1437 | struct Reprocess_ <Param1,void,void,void> |
| 1438 | : euml_action<Reprocess_<Param1, void, void, void> > |
| 1439 | { |
| 1440 | template <class Event,class FSM,class STATE > |
| 1441 | struct state_action_result |
| 1442 | { |
| 1443 | typedef void type; |
| 1444 | }; |
| 1445 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1446 | struct transition_action_result |
| 1447 | { |
| 1448 | typedef void type; |
| 1449 | }; |
| 1450 | |
| 1451 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1452 | |
| 1453 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1454 | void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1455 | { |
| 1456 | (Param1()(evt,fsm,src,tgt)).process_event(evt); |
| 1457 | } |
| 1458 | template <class Event,class FSM,class STATE> |
| 1459 | void operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1460 | { |
| 1461 | (Param1()(evt,fsm,state)).process_event(evt); |
| 1462 | } |
| 1463 | }; |
| 1464 | |
| 1465 | template <class Param1, class Param2> |
| 1466 | struct Reprocess_ <Param1,Param2,void,void> |
| 1467 | : euml_action<Reprocess_<Param1, Param2, void, void> > |
| 1468 | { |
| 1469 | template <class Event,class FSM,class STATE > |
| 1470 | struct state_action_result |
| 1471 | { |
| 1472 | typedef void type; |
| 1473 | }; |
| 1474 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1475 | struct transition_action_result |
| 1476 | { |
| 1477 | typedef void type; |
| 1478 | }; |
| 1479 | |
| 1480 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1481 | |
| 1482 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1483 | void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1484 | { |
| 1485 | (Param1()(evt,fsm,src,tgt)).process_event(evt); |
| 1486 | (Param2()(evt,fsm,src,tgt)).process_event(evt); |
| 1487 | } |
| 1488 | template <class Event,class FSM,class STATE> |
| 1489 | void operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1490 | { |
| 1491 | (Param1()(evt,fsm,state)).process_event(evt); |
| 1492 | (Param2()(evt,fsm,state)).process_event(evt); |
| 1493 | } |
| 1494 | }; |
| 1495 | |
| 1496 | template <class Param1, class Param2, class Param3> |
| 1497 | struct Reprocess_ <Param1,Param2,Param3,void> |
| 1498 | : euml_action<Reprocess_<Param1, Param2, Param3, void> > |
| 1499 | { |
| 1500 | template <class Event,class FSM,class STATE > |
| 1501 | struct state_action_result |
| 1502 | { |
| 1503 | typedef void type; |
| 1504 | }; |
| 1505 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1506 | struct transition_action_result |
| 1507 | { |
| 1508 | typedef void type; |
| 1509 | }; |
| 1510 | |
| 1511 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1512 | |
| 1513 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1514 | void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1515 | { |
| 1516 | (Param1()(evt,fsm,src,tgt)).process_event(evt); |
| 1517 | (Param2()(evt,fsm,src,tgt)).process_event(evt); |
| 1518 | (Param3()(evt,fsm,src,tgt)).process_event(evt); |
| 1519 | } |
| 1520 | template <class Event,class FSM,class STATE> |
| 1521 | void operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1522 | { |
| 1523 | (Param1()(evt,fsm,state)).process_event(evt); |
| 1524 | (Param2()(evt,fsm,state)).process_event(evt); |
| 1525 | (Param3()(evt,fsm,state)).process_event(evt); |
| 1526 | } |
| 1527 | }; |
| 1528 | struct reprocess_tag {}; |
| 1529 | struct Reprocess_Helper: proto::extends< proto::terminal<reprocess_tag>::type, Reprocess_Helper, boost::msm::sm_domain> |
| 1530 | { |
| 1531 | Reprocess_Helper(){} |
| 1532 | using proto::extends< proto::terminal<reprocess_tag>::type, Reprocess_Helper, boost::msm::sm_domain>::operator=; |
| 1533 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 1534 | #ifdef BOOST_MSVC |
| 1535 | ,class Arg6 |
| 1536 | #endif |
| 1537 | > |
| 1538 | struct In |
| 1539 | { |
| 1540 | typedef Reprocess_<Arg1,Arg2,Arg3,Arg4> type; |
| 1541 | }; |
| 1542 | }; |
| 1543 | Reprocess_Helper const reprocess_ = Reprocess_Helper(); |
| 1544 | |
| 1545 | template <class ToProcessEvt,class Value,class Param1, class Param2, class Param3> |
| 1546 | struct Process2_ : euml_action<Process2_<ToProcessEvt,Value, Param1, Param2, Param3> > |
| 1547 | { |
| 1548 | template <class Event,class FSM,class STATE > |
| 1549 | struct state_action_result |
| 1550 | { |
| 1551 | typedef void type; |
| 1552 | }; |
| 1553 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1554 | struct transition_action_result |
| 1555 | { |
| 1556 | typedef void type; |
| 1557 | }; |
| 1558 | |
| 1559 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1560 | |
| 1561 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1562 | void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1563 | { |
| 1564 | (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); |
| 1565 | (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); |
| 1566 | (Param3()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); |
| 1567 | } |
| 1568 | template <class Event,class FSM,class STATE> |
| 1569 | void operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1570 | { |
| 1571 | (Param1()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state))); |
| 1572 | (Param2()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state))); |
| 1573 | (Param3()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state))); |
| 1574 | } |
| 1575 | }; |
| 1576 | |
| 1577 | template <class ToProcessEvt,class Value> |
| 1578 | struct Process2_ <ToProcessEvt,Value,void,void,void> |
| 1579 | : euml_action<Process2_<ToProcessEvt,Value, void, void, void > > |
| 1580 | { |
| 1581 | template <class Event,class FSM,class STATE > |
| 1582 | struct state_action_result |
| 1583 | { |
| 1584 | typedef void type; |
| 1585 | }; |
| 1586 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1587 | struct transition_action_result |
| 1588 | { |
| 1589 | typedef void type; |
| 1590 | }; |
| 1591 | |
| 1592 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1593 | |
| 1594 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1595 | void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1596 | { |
| 1597 | fsm.process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); |
| 1598 | } |
| 1599 | template <class Event,class FSM,class STATE> |
| 1600 | void operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1601 | { |
| 1602 | fsm.process_event(ToProcessEvt(Value()(evt,fsm,state))); |
| 1603 | } |
| 1604 | }; |
| 1605 | |
| 1606 | template <class ToProcessEvt,class Value,class Param1> |
| 1607 | struct Process2_ <ToProcessEvt,Value,Param1,void,void> |
| 1608 | : euml_action<Process2_<ToProcessEvt,Value, Param1, void, void> > |
| 1609 | { |
| 1610 | template <class Event,class FSM,class STATE > |
| 1611 | struct state_action_result |
| 1612 | { |
| 1613 | typedef void type; |
| 1614 | }; |
| 1615 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1616 | struct transition_action_result |
| 1617 | { |
| 1618 | typedef void type; |
| 1619 | }; |
| 1620 | |
| 1621 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1622 | |
| 1623 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1624 | void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1625 | { |
| 1626 | (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); |
| 1627 | } |
| 1628 | template <class Event,class FSM,class STATE> |
| 1629 | void operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1630 | { |
| 1631 | (Param1()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state))); |
| 1632 | } |
| 1633 | }; |
| 1634 | |
| 1635 | template <class ToProcessEvt,class Value,class Param1, class Param2> |
| 1636 | struct Process2_ <ToProcessEvt,Value,Param1,Param2,void> |
| 1637 | : euml_action<Process2_<ToProcessEvt,Value, Param1, Param2, void> > |
| 1638 | { |
| 1639 | template <class Event,class FSM,class STATE > |
| 1640 | struct state_action_result |
| 1641 | { |
| 1642 | typedef void type; |
| 1643 | }; |
| 1644 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1645 | struct transition_action_result |
| 1646 | { |
| 1647 | typedef void type; |
| 1648 | }; |
| 1649 | |
| 1650 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1651 | |
| 1652 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1653 | void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1654 | { |
| 1655 | (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); |
| 1656 | (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); |
| 1657 | } |
| 1658 | template <class Event,class FSM,class STATE> |
| 1659 | void operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1660 | { |
| 1661 | (Param1()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state))); |
| 1662 | (Param2()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state))); |
| 1663 | } |
| 1664 | }; |
| 1665 | |
| 1666 | struct process2_tag {}; |
| 1667 | struct Process2_Helper : proto::extends< proto::terminal<process2_tag>::type, Process2_Helper, boost::msm::sm_domain> |
| 1668 | { |
| 1669 | Process2_Helper(){} |
| 1670 | using proto::extends< proto::terminal<process2_tag>::type, Process2_Helper, boost::msm::sm_domain>::operator=; |
| 1671 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 1672 | #ifdef BOOST_MSVC |
| 1673 | ,class Arg6 |
| 1674 | #endif |
| 1675 | > |
| 1676 | struct In |
| 1677 | { |
| 1678 | typedef Process2_<Arg1,Arg2,Arg3,Arg4,Arg5> type; |
| 1679 | }; |
| 1680 | }; |
| 1681 | Process2_Helper const process2_ = Process2_Helper(); |
| 1682 | |
| 1683 | template <class Flag,class Param1=void, class Enable=void > |
| 1684 | struct Get_Flag_ : euml_action<Get_Flag_<Flag,Param1,Enable> > {}; |
| 1685 | |
| 1686 | template <class Flag,class Param1> |
| 1687 | struct Get_Flag_ <Flag,Param1 |
| 1688 | , typename ::boost::enable_if<typename ::boost::is_same<Param1,void>::type >::type> |
| 1689 | : euml_action<Get_Flag_<Flag, Param1> > |
| 1690 | { |
| 1691 | template <class Event,class FSM,class STATE > |
| 1692 | struct state_action_result |
| 1693 | { |
| 1694 | typedef bool type; |
| 1695 | }; |
| 1696 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1697 | struct transition_action_result |
| 1698 | { |
| 1699 | typedef bool type; |
| 1700 | }; |
| 1701 | |
| 1702 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1703 | |
| 1704 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1705 | bool operator()(EVT const&,FSM& fsm,SourceState& ,TargetState& )const |
| 1706 | { |
| 1707 | return fsm.template is_flag_active<Flag>(); |
| 1708 | } |
| 1709 | template <class Event,class FSM,class STATE> |
| 1710 | bool operator()(Event const& ,FSM& fsm,STATE& )const |
| 1711 | { |
| 1712 | return fsm.template is_flag_active<Flag>(); |
| 1713 | } |
| 1714 | }; |
| 1715 | |
| 1716 | template <class Flag,class Param1> |
| 1717 | struct Get_Flag_ <Flag,Param1 |
| 1718 | , typename ::boost::disable_if< |
| 1719 | typename ::boost::is_same<Param1,void>::type |
| 1720 | >::type> |
| 1721 | : euml_action<Get_Flag_<Flag, Param1> > |
| 1722 | { |
| 1723 | template <class Event,class FSM,class STATE > |
| 1724 | struct state_action_result |
| 1725 | { |
| 1726 | typedef bool type; |
| 1727 | }; |
| 1728 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1729 | struct transition_action_result |
| 1730 | { |
| 1731 | typedef bool type; |
| 1732 | }; |
| 1733 | |
| 1734 | typedef ::boost::fusion::set<state_action_tag,action_tag> tag_type; |
| 1735 | |
| 1736 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1737 | bool operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const |
| 1738 | { |
| 1739 | return (Param1()(evt,fsm,src,tgt)).template is_flag_active<Flag>(); |
| 1740 | } |
| 1741 | template <class Event,class FSM,class STATE> |
| 1742 | bool operator()(Event const& evt,FSM& fsm,STATE& state)const |
| 1743 | { |
| 1744 | return (Param1()(evt,fsm,state)).template is_flag_active<Flag>(); |
| 1745 | } |
| 1746 | }; |
| 1747 | |
| 1748 | struct Get_Flag_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, Get_Flag_Helper, boost::msm::sm_domain> |
| 1749 | { |
| 1750 | Get_Flag_Helper(){} |
| 1751 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 1752 | #ifdef BOOST_MSVC |
| 1753 | ,class Arg6 |
| 1754 | #endif |
| 1755 | > |
| 1756 | struct In |
| 1757 | { |
| 1758 | typedef Get_Flag_<Arg1,Arg2> type; |
| 1759 | }; |
| 1760 | }; |
| 1761 | Get_Flag_Helper const is_flag_ = Get_Flag_Helper(); |
| 1762 | |
| 1763 | // deferring an event |
| 1764 | struct DeferEvent_ : euml_action< DeferEvent_ > |
| 1765 | { |
| 1766 | typedef ::boost::fusion::set<action_tag> tag_type; |
| 1767 | // mark as deferring to avoid stack overflows in certain conditions |
| 1768 | typedef int deferring_action; |
| 1769 | template <class EVT,class FSM,class SourceState,class TargetState> |
| 1770 | void operator()(EVT const& evt,FSM& fsm,SourceState& ,TargetState& ) const |
| 1771 | { |
| 1772 | fsm.defer_event(evt); |
| 1773 | } |
| 1774 | }; |
| 1775 | struct Defer_Helper : proto::extends< proto::terminal<fsm_artefact_tag>::type, Defer_Helper, boost::msm::sm_domain> |
| 1776 | { |
| 1777 | Defer_Helper(){} |
| 1778 | using proto::extends< proto::terminal<fsm_artefact_tag>::type, Defer_Helper, boost::msm::sm_domain>::operator=; |
| 1779 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 1780 | #ifdef BOOST_MSVC |
| 1781 | ,class Arg6 |
| 1782 | #endif |
| 1783 | > |
| 1784 | struct In |
| 1785 | { |
| 1786 | typedef DeferEvent_ type; |
| 1787 | }; |
| 1788 | }; |
| 1789 | Defer_Helper const defer_ = Defer_Helper(); |
| 1790 | |
| 1791 | struct explicit_tag {}; |
| 1792 | struct Explicit_Helper : proto::extends< proto::terminal<explicit_tag>::type, Explicit_Helper, boost::msm::sm_domain> |
| 1793 | { |
| 1794 | Explicit_Helper(){} |
| 1795 | using proto::extends< proto::terminal<explicit_tag>::type, Explicit_Helper, boost::msm::sm_domain>::operator=; |
| 1796 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 1797 | #ifdef BOOST_MSVC |
| 1798 | ,class Arg6 |
| 1799 | #endif |
| 1800 | > |
| 1801 | struct In |
| 1802 | { |
| 1803 | typedef typename Arg1::template direct<Arg2> type; |
| 1804 | }; |
| 1805 | }; |
| 1806 | Explicit_Helper const explicit_ = Explicit_Helper(); |
| 1807 | |
| 1808 | struct entry_pt_tag {}; |
| 1809 | struct Entry_Pt_Helper : proto::extends< proto::terminal<entry_pt_tag>::type, Entry_Pt_Helper, boost::msm::sm_domain> |
| 1810 | { |
| 1811 | Entry_Pt_Helper(){} |
| 1812 | using proto::extends< proto::terminal<entry_pt_tag>::type, Entry_Pt_Helper, boost::msm::sm_domain>::operator=; |
| 1813 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 1814 | #ifdef BOOST_MSVC |
| 1815 | ,class Arg6 |
| 1816 | #endif |
| 1817 | > |
| 1818 | struct In |
| 1819 | { |
| 1820 | typedef typename Arg1::template entry_pt<Arg2> type; |
| 1821 | }; |
| 1822 | }; |
| 1823 | Entry_Pt_Helper const entry_pt_ = Entry_Pt_Helper(); |
| 1824 | |
| 1825 | struct exit_pt_tag {}; |
| 1826 | struct Exit_Pt_Helper : proto::extends< proto::terminal<exit_pt_tag>::type, Exit_Pt_Helper, boost::msm::sm_domain> |
| 1827 | { |
| 1828 | Exit_Pt_Helper(){} |
| 1829 | using proto::extends< proto::terminal<exit_pt_tag>::type, Exit_Pt_Helper, boost::msm::sm_domain>::operator=; |
| 1830 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5 |
| 1831 | #ifdef BOOST_MSVC |
| 1832 | ,class Arg6 |
| 1833 | #endif |
| 1834 | > |
| 1835 | struct In |
| 1836 | { |
| 1837 | typedef typename Arg1::template exit_pt<Arg2> type; |
| 1838 | }; |
| 1839 | }; |
| 1840 | Exit_Pt_Helper const exit_pt_ = Exit_Pt_Helper(); |
| 1841 | |
| 1842 | #ifdef BOOST_MSVC |
| 1843 | #define BOOST_MSM_EUML_FUNCTION(functor,function,function_name,result_trans,result_state) \ |
| 1844 | template <class Param1=void , class Param2=void , class Param3=void , class Param4=void, \ |
| 1845 | class Param5=void,class Param6=void,class Enable=void > \ |
| 1846 | struct functor : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6,Enable> > {}; \ |
| 1847 | template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6> \ |
| 1848 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 1849 | typename ::boost::enable_if<typename ::boost::is_same<Param1,void>::type>::type> \ |
| 1850 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 1851 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 1852 | typedef result_state type;} ; \ |
| 1853 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1854 | struct transition_action_result { typedef result_trans type;}; \ |
| 1855 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 1856 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1857 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type \ |
| 1858 | operator()(EVT const& , FSM& ,SourceState& ,TargetState& )const { \ |
| 1859 | return function ();} \ |
| 1860 | template <class Event,class FSM,class STATE> \ |
| 1861 | typename state_action_result<Event,FSM,STATE>::type \ |
| 1862 | operator()(Event const& ,FSM& ,STATE& )const { \ |
| 1863 | return function ();} }; \ |
| 1864 | template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \ |
| 1865 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 1866 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 1867 | typename ::boost::is_same<Param1,void>::type,typename ::boost::mpl::not_< \ |
| 1868 | typename ::boost::is_same<Param2,void>::type>::type>::type >::type> \ |
| 1869 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 1870 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 1871 | typedef result_state type;} ; \ |
| 1872 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1873 | struct transition_action_result { typedef result_trans type;}; \ |
| 1874 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 1875 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1876 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 1877 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 1878 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 1879 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 1880 | return function (Param1()(evt,fsm,src,tgt));} \ |
| 1881 | template <class Event,class FSM,class STATE> \ |
| 1882 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 1883 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 1884 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 1885 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 1886 | return function (Param1()(evt,fsm,state));} }; \ |
| 1887 | template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \ |
| 1888 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 1889 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 1890 | typename ::boost::is_same<Param2,void>::type,typename ::boost::mpl::not_< \ |
| 1891 | typename ::boost::is_same<Param3,void>::type>::type>::type >::type> \ |
| 1892 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 1893 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 1894 | typedef result_state type;} ; \ |
| 1895 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1896 | struct transition_action_result { typedef result_trans type;}; \ |
| 1897 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 1898 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1899 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 1900 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 1901 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 1902 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 1903 | return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));} \ |
| 1904 | template <class Event,class FSM,class STATE> \ |
| 1905 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 1906 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 1907 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 1908 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 1909 | return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state));} }; \ |
| 1910 | template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \ |
| 1911 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 1912 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 1913 | typename ::boost::is_same<Param3,void>::type,typename ::boost::mpl::not_< \ |
| 1914 | typename ::boost::is_same<Param4,void>::type>::type>::type >::type> \ |
| 1915 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 1916 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 1917 | typedef result_state type;} ; \ |
| 1918 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1919 | struct transition_action_result { typedef result_trans type;}; \ |
| 1920 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 1921 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1922 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 1923 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 1924 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 1925 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 1926 | return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));} \ |
| 1927 | template <class Event,class FSM,class STATE> \ |
| 1928 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 1929 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 1930 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 1931 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 1932 | return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));} }; \ |
| 1933 | template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \ |
| 1934 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 1935 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 1936 | typename ::boost::is_same<Param4,void>::type,typename ::boost::mpl::not_< \ |
| 1937 | typename ::boost::is_same<Param5,void>::type>::type>::type >::type> \ |
| 1938 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 1939 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 1940 | typedef result_state type;} ; \ |
| 1941 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1942 | struct transition_action_result { typedef result_trans type;}; \ |
| 1943 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 1944 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1945 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 1946 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 1947 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 1948 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 1949 | return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ |
| 1950 | ,Param4()(evt,fsm,src,tgt));} \ |
| 1951 | template <class Event,class FSM,class STATE> \ |
| 1952 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 1953 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 1954 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 1955 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 1956 | return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ |
| 1957 | ,Param4()(evt,fsm,state));} }; \ |
| 1958 | template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \ |
| 1959 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 1960 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 1961 | typename ::boost::is_same<Param5,void>::type,typename ::boost::mpl::not_< \ |
| 1962 | typename ::boost::is_same<Param6,void>::type>::type>::type >::type> \ |
| 1963 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 1964 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 1965 | typedef result_state type;} ; \ |
| 1966 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1967 | struct transition_action_result { typedef result_trans type;}; \ |
| 1968 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 1969 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1970 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 1971 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 1972 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 1973 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 1974 | return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ |
| 1975 | ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));} \ |
| 1976 | template <class Event,class FSM,class STATE> \ |
| 1977 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 1978 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 1979 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 1980 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 1981 | return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ |
| 1982 | ,Param4()(evt,fsm,state),Param5()(evt,fsm,state));} }; \ |
| 1983 | template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \ |
| 1984 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 1985 | typename ::boost::disable_if<typename ::boost::is_same<Param6,void>::type>::type> \ |
| 1986 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 1987 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 1988 | typedef result_state type;} ; \ |
| 1989 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1990 | struct transition_action_result { typedef result_trans type;}; \ |
| 1991 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 1992 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 1993 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 1994 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 1995 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 1996 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 1997 | return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ |
| 1998 | ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt),Param6()(evt,fsm,src,tgt));} \ |
| 1999 | template <class Event,class FSM,class STATE> \ |
| 2000 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2001 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2002 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2003 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2004 | return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ |
| 2005 | ,Param4()(evt,fsm,state),Param5()(evt,fsm,state),Param6()(evt,fsm,state));} }; \ |
| 2006 | struct function_name ## tag{}; \ |
| 2007 | struct functor ## Helper : proto::extends< proto::terminal< function_name ## tag >::type, \ |
| 2008 | functor ## Helper , boost::msm::sm_domain> { functor ## Helper(){} \ |
| 2009 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5,class Arg6> \ |
| 2010 | struct In {typedef functor <Arg1,Arg2,Arg3,Arg4,Arg5,Arg6> type;}; }; \ |
| 2011 | functor ## Helper const function_name = functor ## Helper (); |
| 2012 | |
| 2013 | #define BOOST_MSM_EUML_METHOD(functor,function,function_name,result_trans,result_state) \ |
| 2014 | template <class Param1=void , class Param2=void , class Param3=void , class Param4=void, \ |
| 2015 | class Param5=void,class Param6=void,class Enable=void > \ |
| 2016 | struct functor : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6,Enable> > {}; \ |
| 2017 | template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6> \ |
| 2018 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 2019 | typename ::boost::enable_if<typename ::boost::is_same<Param2,void>::type>::type> \ |
| 2020 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 2021 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2022 | typedef result_state type;} ; \ |
| 2023 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2024 | struct transition_action_result { typedef result_trans type;}; \ |
| 2025 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2026 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2027 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2028 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2029 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2030 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2031 | return (Param1()(evt,fsm,src,tgt)).function();} \ |
| 2032 | template <class Event,class FSM,class STATE> \ |
| 2033 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2034 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2035 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2036 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2037 | return (Param1()(evt,fsm,state)).function();} }; \ |
| 2038 | template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \ |
| 2039 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 2040 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 2041 | typename ::boost::is_same<Param2,void>::type,typename ::boost::mpl::not_< \ |
| 2042 | typename ::boost::is_same<Param3,void>::type>::type>::type >::type> \ |
| 2043 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 2044 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2045 | typedef result_state type;} ; \ |
| 2046 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2047 | struct transition_action_result { typedef result_trans type;}; \ |
| 2048 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2049 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2050 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2051 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2052 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2053 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2054 | return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt));} \ |
| 2055 | template <class Event,class FSM,class STATE> \ |
| 2056 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2057 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2058 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2059 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2060 | return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state));} }; \ |
| 2061 | template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \ |
| 2062 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 2063 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 2064 | typename ::boost::is_same<Param3,void>::type,typename ::boost::mpl::not_< \ |
| 2065 | typename ::boost::is_same<Param4,void>::type>::type>::type >::type> \ |
| 2066 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 2067 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2068 | typedef result_state type;} ; \ |
| 2069 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2070 | struct transition_action_result { typedef result_trans type;}; \ |
| 2071 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2072 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2073 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2074 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2075 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2076 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2077 | return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));} \ |
| 2078 | template <class Event,class FSM,class STATE> \ |
| 2079 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2080 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2081 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2082 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2083 | return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state));} }; \ |
| 2084 | template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \ |
| 2085 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 2086 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 2087 | typename ::boost::is_same<Param4,void>::type,typename ::boost::mpl::not_< \ |
| 2088 | typename ::boost::is_same<Param5,void>::type>::type>::type >::type> \ |
| 2089 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 2090 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2091 | typedef result_state type;} ; \ |
| 2092 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2093 | struct transition_action_result { typedef result_trans type;}; \ |
| 2094 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2095 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2096 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2097 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2098 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2099 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2100 | return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ |
| 2101 | ,Param4()(evt,fsm,src,tgt));} \ |
| 2102 | template <class Event,class FSM,class STATE> \ |
| 2103 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2104 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2105 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2106 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2107 | return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ |
| 2108 | ,Param4()(evt,fsm,state));} }; \ |
| 2109 | template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \ |
| 2110 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 2111 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 2112 | typename ::boost::is_same<Param5,void>::type,typename ::boost::mpl::not_< \ |
| 2113 | typename ::boost::is_same<Param6,void>::type>::type>::type >::type> \ |
| 2114 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 2115 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2116 | typedef result_state type;} ; \ |
| 2117 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2118 | struct transition_action_result { typedef result_trans type;}; \ |
| 2119 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2120 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2121 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2122 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2123 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2124 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2125 | return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ |
| 2126 | ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));} \ |
| 2127 | template <class Event,class FSM,class STATE> \ |
| 2128 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2129 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2130 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2131 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2132 | return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ |
| 2133 | ,Param4()(evt,fsm,state),Param5()(evt,fsm,state));} }; \ |
| 2134 | template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \ |
| 2135 | struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \ |
| 2136 | typename ::boost::disable_if<typename ::boost::is_same<Param6,void>::type>::type> \ |
| 2137 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \ |
| 2138 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2139 | typedef result_state type;} ; \ |
| 2140 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2141 | struct transition_action_result { typedef result_trans type;}; \ |
| 2142 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2143 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2144 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2145 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2146 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2147 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2148 | return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ |
| 2149 | ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt),Param6()(evt,fsm,src,tgt));} \ |
| 2150 | template <class Event,class FSM,class STATE> \ |
| 2151 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2152 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2153 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2154 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2155 | return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ |
| 2156 | ,Param4()(evt,fsm,state),Param5()(evt,fsm,state),Param6()(evt,fsm,state));} }; \ |
| 2157 | struct function_name ## tag{}; \ |
| 2158 | struct functor ## Helper : proto::extends< proto::terminal< function_name ## tag >::type, \ |
| 2159 | functor ## Helper , boost::msm::sm_domain> { functor ## Helper(){} \ |
| 2160 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5,class Arg6> \ |
| 2161 | struct In {typedef functor <Arg1,Arg2,Arg3,Arg4,Arg5,Arg6> type;}; }; \ |
| 2162 | functor ## Helper const function_name = functor ## Helper (); |
| 2163 | |
| 2164 | #else |
| 2165 | |
| 2166 | #define BOOST_MSM_EUML_FUNCTION(functor,function,function_name,result_trans,result_state) \ |
| 2167 | template <class Param1=void , class Param2=void , class Param3=void , class Param4=void, \ |
| 2168 | class Param5=void,class Enable=void > \ |
| 2169 | struct functor : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Enable> > {}; \ |
| 2170 | template <class Param1, class Param2, class Param3, class Param4, class Param5> \ |
| 2171 | struct functor<Param1,Param2,Param3,Param4,Param5, \ |
| 2172 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 2173 | typename ::boost::is_same<Param1,void>::type,typename ::boost::mpl::not_< \ |
| 2174 | typename ::boost::is_same<Param2,void>::type>::type>::type >::type> \ |
| 2175 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \ |
| 2176 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2177 | typedef result_state type;} ; \ |
| 2178 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2179 | struct transition_action_result { typedef result_trans type;}; \ |
| 2180 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2181 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2182 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2183 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2184 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2185 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2186 | return function (Param1()(evt,fsm,src,tgt));} \ |
| 2187 | template <class Event,class FSM,class STATE> \ |
| 2188 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2189 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2190 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2191 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2192 | return function (Param1()(evt,fsm,state));} }; \ |
| 2193 | template <class Param1, class Param2, class Param3, class Param4, class Param5> \ |
| 2194 | struct functor<Param1,Param2,Param3,Param4,Param5, \ |
| 2195 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 2196 | typename ::boost::is_same<Param2,void>::type,typename ::boost::mpl::not_< \ |
| 2197 | typename ::boost::is_same<Param3,void>::type>::type>::type >::type> \ |
| 2198 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \ |
| 2199 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2200 | typedef result_state type;} ; \ |
| 2201 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2202 | struct transition_action_result { typedef result_trans type;}; \ |
| 2203 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2204 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2205 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2206 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2207 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2208 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2209 | return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));} \ |
| 2210 | template <class Event,class FSM,class STATE> \ |
| 2211 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2212 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2213 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2214 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2215 | return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state));} }; \ |
| 2216 | template <class Param1, class Param2, class Param3, class Param4, class Param5> \ |
| 2217 | struct functor<Param1,Param2,Param3,Param4,Param5, \ |
| 2218 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 2219 | typename ::boost::is_same<Param3,void>::type,typename ::boost::mpl::not_< \ |
| 2220 | typename ::boost::is_same<Param4,void>::type>::type>::type >::type> \ |
| 2221 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \ |
| 2222 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2223 | typedef result_state type;} ; \ |
| 2224 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2225 | struct transition_action_result { typedef result_trans type;}; \ |
| 2226 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2227 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2228 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2229 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2230 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2231 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2232 | return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));} \ |
| 2233 | template <class Event,class FSM,class STATE> \ |
| 2234 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2235 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2236 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2237 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2238 | return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));} }; \ |
| 2239 | template <class Param1, class Param2, class Param3, class Param4, class Param5> \ |
| 2240 | struct functor<Param1,Param2,Param3,Param4,Param5, \ |
| 2241 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 2242 | typename ::boost::is_same<Param4,void>::type,typename ::boost::mpl::not_< \ |
| 2243 | typename ::boost::is_same<Param5,void>::type>::type>::type >::type> \ |
| 2244 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \ |
| 2245 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2246 | typedef result_state type;} ; \ |
| 2247 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2248 | struct transition_action_result { typedef result_trans type;}; \ |
| 2249 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2250 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2251 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2252 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2253 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2254 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2255 | return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ |
| 2256 | ,Param4()(evt,fsm,src,tgt));} \ |
| 2257 | template <class Event,class FSM,class STATE> \ |
| 2258 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2259 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2260 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2261 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2262 | return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ |
| 2263 | ,Param4()(evt,fsm,state));} }; \ |
| 2264 | template <class Param1, class Param2, class Param3, class Param4, class Param5> \ |
| 2265 | struct functor<Param1,Param2,Param3,Param4,Param5, \ |
| 2266 | typename ::boost::disable_if<typename ::boost::is_same<Param5,void>::type>::type> \ |
| 2267 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \ |
| 2268 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2269 | typedef result_state type;} ; \ |
| 2270 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2271 | struct transition_action_result { typedef result_trans type;}; \ |
| 2272 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2273 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2274 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2275 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2276 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2277 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2278 | return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ |
| 2279 | ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));} \ |
| 2280 | template <class Event,class FSM,class STATE> \ |
| 2281 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2282 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2283 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2284 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2285 | return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ |
| 2286 | ,Param4()(evt,fsm,state),Param5()(evt,fsm,state));} }; \ |
| 2287 | struct function_name ## tag{}; \ |
| 2288 | struct functor ## Helper : proto::extends< proto::terminal< function_name ## tag >::type, \ |
| 2289 | functor ## Helper , boost::msm::sm_domain> { functor ## Helper(){} \ |
| 2290 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5> \ |
| 2291 | struct In {typedef functor <Arg1,Arg2,Arg3,Arg4,Arg5> type;}; }; \ |
| 2292 | functor ## Helper const function_name = functor ## Helper (); |
| 2293 | |
| 2294 | #define BOOST_MSM_EUML_METHOD(functor,function,function_name,result_trans,result_state) \ |
| 2295 | template <class Param1=void , class Param2=void , class Param3=void , class Param4=void, \ |
| 2296 | class Param5=void,class Enable=void > \ |
| 2297 | struct functor : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Enable> > {}; \ |
| 2298 | template <class Param1, class Param2, class Param3, class Param4, class Param5> \ |
| 2299 | struct functor<Param1,Param2,Param3,Param4,Param5, \ |
| 2300 | typename ::boost::enable_if<typename ::boost::is_same<Param2,void>::type>::type> \ |
| 2301 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \ |
| 2302 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2303 | typedef result_state type;} ; \ |
| 2304 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2305 | struct transition_action_result { typedef result_trans type;}; \ |
| 2306 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2307 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2308 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2309 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2310 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2311 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2312 | return (Param1()(evt,fsm,src,tgt)).function();} \ |
| 2313 | template <class Event,class FSM,class STATE> \ |
| 2314 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2315 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2316 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2317 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2318 | return (Param1()(evt,fsm,state)).function();} }; \ |
| 2319 | template <class Param1, class Param2, class Param3, class Param4, class Param5> \ |
| 2320 | struct functor<Param1,Param2,Param3,Param4,Param5, \ |
| 2321 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 2322 | typename ::boost::is_same<Param2,void>::type,typename ::boost::mpl::not_< \ |
| 2323 | typename ::boost::is_same<Param3,void>::type>::type>::type >::type> \ |
| 2324 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \ |
| 2325 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2326 | typedef result_state type;} ; \ |
| 2327 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2328 | struct transition_action_result { typedef result_trans type;}; \ |
| 2329 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2330 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2331 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2332 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2333 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2334 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2335 | return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt));} \ |
| 2336 | template <class Event,class FSM,class STATE> \ |
| 2337 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2338 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2339 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2340 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2341 | return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state));} }; \ |
| 2342 | template <class Param1, class Param2, class Param3, class Param4, class Param5> \ |
| 2343 | struct functor<Param1,Param2,Param3,Param4,Param5, \ |
| 2344 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 2345 | typename ::boost::is_same<Param3,void>::type,typename ::boost::mpl::not_< \ |
| 2346 | typename ::boost::is_same<Param4,void>::type>::type>::type >::type> \ |
| 2347 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \ |
| 2348 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2349 | typedef result_state type;} ; \ |
| 2350 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2351 | struct transition_action_result { typedef result_trans type;}; \ |
| 2352 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2353 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2354 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2355 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2356 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2357 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2358 | return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));} \ |
| 2359 | template <class Event,class FSM,class STATE> \ |
| 2360 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2361 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2362 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2363 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2364 | return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state));} }; \ |
| 2365 | template <class Param1, class Param2, class Param3, class Param4, class Param5> \ |
| 2366 | struct functor<Param1,Param2,Param3,Param4,Param5, \ |
| 2367 | typename ::boost::disable_if<typename ::boost::mpl::or_< \ |
| 2368 | typename ::boost::is_same<Param4,void>::type,typename ::boost::mpl::not_< \ |
| 2369 | typename ::boost::is_same<Param5,void>::type>::type>::type >::type> \ |
| 2370 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \ |
| 2371 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2372 | typedef result_state type;} ; \ |
| 2373 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2374 | struct transition_action_result { typedef result_trans type;}; \ |
| 2375 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2376 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2377 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2378 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2379 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2380 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2381 | return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ |
| 2382 | ,Param4()(evt,fsm,src,tgt));} \ |
| 2383 | template <class Event,class FSM,class STATE> \ |
| 2384 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2385 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2386 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2387 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2388 | return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ |
| 2389 | ,Param4()(evt,fsm,state));} }; \ |
| 2390 | template <class Param1, class Param2, class Param3, class Param4, class Param5> \ |
| 2391 | struct functor<Param1,Param2,Param3,Param4,Param5, \ |
| 2392 | typename ::boost::disable_if<typename ::boost::is_same<Param5,void>::type>::type> \ |
| 2393 | : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \ |
| 2394 | template <class Event,class FSM,class STATE > struct state_action_result { \ |
| 2395 | typedef result_state type;} ; \ |
| 2396 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2397 | struct transition_action_result { typedef result_trans type;}; \ |
| 2398 | typedef ::boost::fusion::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \ |
| 2399 | template <class EVT,class FSM,class SourceState,class TargetState> \ |
| 2400 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2401 | typename Param1::tag_type,boost::msm::front::action_tag>::type, \ |
| 2402 | typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \ |
| 2403 | operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ |
| 2404 | return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ |
| 2405 | ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));} \ |
| 2406 | template <class Event,class FSM,class STATE> \ |
| 2407 | typename ::boost::enable_if<typename ::boost::mpl::has_key< \ |
| 2408 | typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \ |
| 2409 | typename state_action_result<Event,FSM,STATE>::type >::type \ |
| 2410 | operator()(Event const& evt,FSM& fsm,STATE& state )const { \ |
| 2411 | return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ |
| 2412 | ,Param4()(evt,fsm,state),Param5()(evt,fsm,state));} }; \ |
| 2413 | struct function_name ## tag{}; \ |
| 2414 | struct functor ## Helper : proto::extends< proto::terminal< function_name ## tag >::type, \ |
| 2415 | functor ## Helper , boost::msm::sm_domain> { functor ## Helper(){} \ |
| 2416 | template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5> \ |
| 2417 | struct In {typedef functor <Arg1,Arg2,Arg3,Arg4,Arg5> type;}; }; \ |
| 2418 | functor ## Helper const function_name = functor ## Helper (); |
| 2419 | |
| 2420 | #endif |
| 2421 | |
| 2422 | #define RESULT_TYPE2_PARAM1 typename get_result_type2<Param1,Event,FSM,STATE>::type |
| 2423 | #define RESULT_TYPE_PARAM1 typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type |
| 2424 | #define RESULT_TYPE2_PARAM2 typename get_result_type2<Param2,Event,FSM,STATE>::type |
| 2425 | #define RESULT_TYPE_PARAM2 typename get_result_type<Param2,EVT,FSM,SourceState,TargetState>::type |
| 2426 | #define RESULT_TYPE2_PARAM3 typename get_result_type2<Param3,Event,FSM,STATE>::type |
| 2427 | #define RESULT_TYPE_PARAM3 typename get_result_type<Param3,EVT,FSM,SourceState,TargetState>::type |
| 2428 | #define RESULT_TYPE2_PARAM4 typename get_result_type2<Param4,Event,FSM,STATE>::type |
| 2429 | #define RESULT_TYPE_PARAM4 typename get_result_type<Param4,EVT,FSM,SourceState,TargetState>::type |
| 2430 | #define RESULT_TYPE2_PARAM5 typename get_result_type2<Param5,Event,FSM,STATE>::type |
| 2431 | #define RESULT_TYPE_PARAM5 typename get_result_type<Param5,EVT,FSM,SourceState,TargetState>::type |
| 2432 | #define RESULT_TYPE2_PARAM6 typename get_result_type2<Param6,Event,FSM,STATE>::type |
| 2433 | #define RESULT_TYPE_PARAM6 typename get_result_type<Param6,EVT,FSM,SourceState,TargetState>::type |
| 2434 | |
| 2435 | |
| 2436 | #define RESULT_TYPE2_DIFF_TYPE_ITER_TRAITS_PARAM1 typename std::iterator_traits<typename get_result_type2<Param1,Event,FSM,STATE>::type>::difference_type |
| 2437 | #define RESULT_TYPE_DIFF_TYPE_ITER_TRAITS_PARAM1 typename std::iterator_traits<typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type>::difference_type |
| 2438 | |
| 2439 | #define RESULT_TYPE2_REMOVE_REF_PARAM1 typename ::boost::remove_reference<typename get_result_type2<Param1,Event,FSM,STATE>::type>::type |
| 2440 | #define RESULT_TYPE_REMOVE_REF_PARAM1 typename ::boost::remove_reference<typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type>::type |
| 2441 | |
| 2442 | #define RESULT_TYPE2_PAIR_REMOVE_REF_PARAM1 std::pair<RESULT_TYPE2_REMOVE_REF_PARAM1,RESULT_TYPE2_REMOVE_REF_PARAM1> |
| 2443 | #define RESULT_TYPE_PAIR_REMOVE_REF_PARAM1 std::pair<RESULT_TYPE_REMOVE_REF_PARAM1,RESULT_TYPE_REMOVE_REF_PARAM1> |
| 2444 | |
| 2445 | #define RESULT_TYPE2_GET_REF_REMOVE_REF_PARAM1 typename get_reference<typename ::boost::remove_reference<typename get_result_type2<Param1,Event,FSM,STATE>::type>::type>::type |
| 2446 | #define RESULT_TYPE_GET_REF_REMOVE_REF_PARAM1 typename get_reference<typename ::boost::remove_reference<typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type>::type>::type |
| 2447 | |
| 2448 | #define RESULT_TYPE2_GET_ITERATOR_REMOVE_REF_PARAM1 typename get_iterator<typename ::boost::remove_reference<typename get_result_type2<Param1,Event,FSM,STATE>::type>::type>::type |
| 2449 | #define RESULT_TYPE_GET_ITERATOR_REMOVE_REF_PARAM1 typename get_iterator<typename ::boost::remove_reference<typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type>::type>::type |
| 2450 | |
| 2451 | #define RESULT_TYPE2_GET_REV_ITERATOR_REMOVE_REF_PARAM1 typename get_reverse_iterator<typename ::boost::remove_reference<typename get_result_type2<Param1,Event,FSM,STATE>::type>::type>::type |
| 2452 | #define RESULT_TYPE_GET_REV_ITERATOR_REMOVE_REF_PARAM1 typename get_reverse_iterator<typename ::boost::remove_reference<typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type>::type>::type |
| 2453 | |
| 2454 | #define RESULT_TYPE2_GET_SIZE_TYPE_REMOVE_REF_PARAM1 typename get_size_type<typename ::boost::remove_reference<typename get_result_type2<Param1,Event,FSM,STATE>::type>::type>::type |
| 2455 | #define RESULT_TYPE_GET_SIZE_TYPE_REMOVE_REF_PARAM1 typename get_size_type<typename ::boost::remove_reference<typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type>::type>::type |
| 2456 | |
| 2457 | #define BOOST_MSM_EUML_ACTION(instance_name) \ |
| 2458 | struct instance_name ## _impl; \ |
| 2459 | struct instance_name ## _helper : boost::msm::front::euml::euml_action<instance_name ## _impl> \ |
| 2460 | { \ |
| 2461 | instance_name ## _helper(){} \ |
| 2462 | typedef instance_name ## _impl action_name; \ |
| 2463 | }; \ |
| 2464 | static instance_name ## _helper instance_name; \ |
| 2465 | struct instance_name ## _impl : instance_name ## _helper |
| 2466 | |
| 2467 | #define BOOST_MSM_EUML_DECLARE_ACTION(instance_name) \ |
| 2468 | struct instance_name ; \ |
| 2469 | struct instance_name ## _helper : boost::msm::front::euml::euml_action<instance_name > \ |
| 2470 | { \ |
| 2471 | instance_name ## _helper(){} \ |
| 2472 | typedef instance_name action_name; \ |
| 2473 | }; \ |
| 2474 | struct instance_name : instance_name ## _helper |
| 2475 | |
| 2476 | |
| 2477 | #define BOOST_MSM_EUML_EVENT(instance_name) \ |
| 2478 | struct instance_name ## _helper : boost::msm::front::euml::euml_event<instance_name ## _helper>{ \ |
| 2479 | instance_name ## _helper(){} \ |
| 2480 | instance_name ## _helper const& operator()() const {return *this;} }; \ |
| 2481 | static instance_name ## _helper instance_name; |
| 2482 | |
| 2483 | // an event matching any event |
| 2484 | struct kleene_ : boost::msm::front::euml::euml_event<kleene_>, public boost::any |
| 2485 | { |
| 2486 | kleene_() : boost::any(){} |
| 2487 | template<typename ValueType> |
| 2488 | kleene_(const ValueType & v) : boost::any(v){} |
| 2489 | }; |
| 2490 | static kleene_ kleene; |
| 2491 | |
| 2492 | #define BOOST_MSM_EUML_DECLARE_EVENT(instance_name) \ |
| 2493 | struct instance_name : boost::msm::front::euml::euml_event<instance_name >{ \ |
| 2494 | instance_name(){} \ |
| 2495 | instance_name const& operator()() const {return *this;} }; |
| 2496 | |
| 2497 | #define MSM_EUML_CONCAT(param1,param2) param1 |
| 2498 | #define MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE1(z, n, unused) ARG ## n arg ## n |
| 2499 | #define MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE2(z, n, unused) arg ## n |
| 2500 | #define MSM_EUML_EVENT_INSTANCE_HELPER_ATTRIBUTE_MAP_ENTRY(z, n, unused) \ |
| 2501 | typename boost::fusion::result_of::first< \ |
| 2502 | typename ::boost::remove_reference< \ |
| 2503 | typename boost::fusion::result_of::at_c<T, BOOST_PP_CAT( , n)>::type>::type>::type \ |
| 2504 | |
| 2505 | #define MSM_EUML_EVENT_HELPER_GET_ATTRIBUTE(z, n, unused) \ |
| 2506 | get_attribute( \ |
| 2507 | typename boost::fusion::result_of::first< \ |
| 2508 | typename ::boost::remove_reference< \ |
| 2509 | typename boost::fusion::result_of::at_c<T, n>::type>::type>::type())=arg ## n; |
| 2510 | |
| 2511 | #define MSM_EUML_EVENT_HELPER_CONSTRUCTORS(z, n, mytuple) \ |
| 2512 | template <BOOST_PP_ENUM_PARAMS(n, class ARG)> \ |
| 2513 | BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, mytuple) , _helper)(BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE1, ~ )): \ |
| 2514 | BOOST_PP_TUPLE_ELEM(2, 1, mytuple)(){ \ |
| 2515 | init(BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE2, ~ ),attribute_vec());} |
| 2516 | |
| 2517 | #define MSM_EUML_EVENT_INSTANCE_HELPER_ATTRIBUTE_MAP(z, n, unused) \ |
| 2518 | template <BOOST_PP_ENUM_PARAMS(n, class ARG),class T> \ |
| 2519 | void init(BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE1, ~ ), \ |
| 2520 | T,typename ::boost::enable_if< typename boost::mpl::eval_if< typename ::boost::fusion::traits::is_sequence<T>::type,size_helper<T,n>,::boost::mpl::false_>::type,void >::type* =0) \ |
| 2521 | { \ |
| 2522 | BOOST_PP_REPEAT_FROM_TO(0,n , \ |
| 2523 | MSM_EUML_EVENT_HELPER_GET_ATTRIBUTE, ~) \ |
| 2524 | } |
| 2525 | |
| 2526 | #define MSM_EUML_EVENT_INSTANCE_HELPER_OPERATOR_IMPL(z, n, instance) \ |
| 2527 | template <BOOST_PP_ENUM_PARAMS(n, class ARG)> \ |
| 2528 | BOOST_PP_CAT(instance,_helper) operator() \ |
| 2529 | (BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE1, ~ ))const{ \ |
| 2530 | return BOOST_PP_CAT(instance,_helper) (BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE2, ~ ));} |
| 2531 | |
| 2532 | #if defined(FUSION_MAX_MAP_SIZE) |
| 2533 | |
| 2534 | #define BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(instance_name, attributes_name) \ |
| 2535 | struct instance_name ## _helper : \ |
| 2536 | boost::msm::front::euml::euml_event<instance_name ## _helper> , public attributes_name \ |
| 2537 | { \ |
| 2538 | template <class T,int checked_size> struct size_helper \ |
| 2539 | { \ |
| 2540 | typedef typename ::boost::mpl::less_equal< \ |
| 2541 | typename ::boost::fusion::result_of::size<T>::type, \ |
| 2542 | ::boost::mpl::int_<checked_size> >::type type; \ |
| 2543 | }; \ |
| 2544 | BOOST_PP_CAT(instance_name,_helper()) : attributes_name(){} \ |
| 2545 | typedef attributes_name::attributes_type attribute_map; \ |
| 2546 | typedef ::boost::fusion::result_of::as_vector<attribute_map>::type attribute_vec; \ |
| 2547 | BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(FUSION_MAX_MAP_SIZE ,1), \ |
| 2548 | MSM_EUML_EVENT_HELPER_CONSTRUCTORS, (instance_name,attributes_name)) \ |
| 2549 | BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(FUSION_MAX_MAP_SIZE ,1), \ |
| 2550 | MSM_EUML_EVENT_INSTANCE_HELPER_ATTRIBUTE_MAP, ~) \ |
| 2551 | BOOST_PP_CAT(instance_name,_helper) operator()(){ \ |
| 2552 | return BOOST_PP_CAT(instance_name,_helper)();} \ |
| 2553 | BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(FUSION_MAX_MAP_SIZE ,1), \ |
| 2554 | MSM_EUML_EVENT_INSTANCE_HELPER_OPERATOR_IMPL, instance_name) \ |
| 2555 | }; \ |
| 2556 | static instance_name ## _helper instance_name; |
| 2557 | |
| 2558 | #else |
| 2559 | |
| 2560 | #define BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(instance_name, attributes_name) \ |
| 2561 | struct instance_name ## _helper : \ |
| 2562 | boost::msm::front::euml::euml_event<instance_name ## _helper> , public attributes_name \ |
| 2563 | { \ |
| 2564 | template <class T,int checked_size> struct size_helper \ |
| 2565 | { \ |
| 2566 | typedef typename ::boost::mpl::less_equal< \ |
| 2567 | typename ::boost::fusion::result_of::size<T>::type, \ |
| 2568 | ::boost::mpl::int_<checked_size> >::type type; \ |
| 2569 | }; \ |
| 2570 | BOOST_PP_CAT(instance_name,_helper()) : attributes_name(){} \ |
| 2571 | typedef attributes_name::attributes_type attribute_map; \ |
| 2572 | typedef ::boost::fusion::result_of::as_vector<attribute_map>::type attribute_vec; \ |
| 2573 | BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(10 ,1), \ |
| 2574 | MSM_EUML_EVENT_HELPER_CONSTRUCTORS, (instance_name,attributes_name)) \ |
| 2575 | BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(10 ,1), \ |
| 2576 | MSM_EUML_EVENT_INSTANCE_HELPER_ATTRIBUTE_MAP, ~) \ |
| 2577 | BOOST_PP_CAT(instance_name,_helper) operator()(){ \ |
| 2578 | return BOOST_PP_CAT(instance_name,_helper)();} \ |
| 2579 | BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(10 ,1), \ |
| 2580 | MSM_EUML_EVENT_INSTANCE_HELPER_OPERATOR_IMPL, instance_name) \ |
| 2581 | }; \ |
| 2582 | static instance_name ## _helper instance_name; |
| 2583 | |
| 2584 | #endif |
| 2585 | |
| 2586 | #define BOOST_MSM_EUML_EVENT_NAME(instance_name) instance_name ## _helper |
| 2587 | |
| 2588 | #define BOOST_MSM_EUML_FLAG_NAME(instance_name) instance_name ## _helper |
| 2589 | |
| 2590 | #define BOOST_MSM_EUML_FLAG(instance_name) \ |
| 2591 | struct instance_name ## _helper : boost::msm::front::euml::euml_flag<instance_name ## _helper>{}; \ |
| 2592 | static instance_name ## _helper instance_name; |
| 2593 | |
| 2594 | #define BOOST_MSM_EUML_DECLARE_FLAG(instance_name) \ |
| 2595 | struct instance_name : boost::msm::front::euml::euml_flag<instance_name >{}; |
| 2596 | |
| 2597 | #define BOOST_MSM_EUML_STATE_NAME(instance_name) instance_name ## _helper |
| 2598 | |
| 2599 | #define BOOST_MSM_EUML_BUILD_STT_HELPER build_stt( |
| 2600 | #define BOOST_MSM_EUML_BUILD_INTERNAL_STT_HELPER build_internal_stt( |
| 2601 | #define BOOST_MSM_EUML_BUILD_STT_HELPER2(expr) expr) |
| 2602 | #define BOOST_MSM_EUML_ENTRY_STATE_HELPER(expr) ,expr |
| 2603 | |
| 2604 | |
| 2605 | #define BOOST_MSM_EUML_ATTRIBUTES(expr,instance_name) \ |
| 2606 | typedef BOOST_TYPEOF(build_attributes expr) instance_name; |
| 2607 | |
| 2608 | // following macros declare a state type but do not create an instance |
| 2609 | #define BOOST_MSM_EUML_DECLARE_STATE(expr,instance_name) \ |
| 2610 | struct instance_name ## tag{}; \ |
| 2611 | typedef BOOST_TYPEOF(build_state<instance_name ## tag> expr) instance_name; |
| 2612 | |
| 2613 | #define BOOST_MSM_EUML_DECLARE_INTERRUPT_STATE(expr,instance_name) \ |
| 2614 | struct instance_name ## tag{}; \ |
| 2615 | typedef BOOST_TYPEOF(build_interrupt_state<instance_name ## tag> expr) instance_name; |
| 2616 | |
| 2617 | #define BOOST_MSM_EUML_DECLARE_TERMINATE_STATE(expr,instance_name) \ |
| 2618 | struct instance_name ## tag{}; \ |
| 2619 | typedef BOOST_TYPEOF(build_terminate_state<instance_name ## tag> expr) instance_name; |
| 2620 | |
| 2621 | #define BOOST_MSM_EUML_DECLARE_EXPLICIT_ENTRY_STATE(region,expr,instance_name) \ |
| 2622 | struct instance_name ## tag{}; \ |
| 2623 | typedef BOOST_TYPEOF(build_explicit_entry_state<instance_name ## tag BOOST_MSM_EUML_ENTRY_STATE_HELPER(region) > expr) instance_name; |
| 2624 | |
| 2625 | #define BOOST_MSM_EUML_DECLARE_ENTRY_STATE(region,expr,instance_name) \ |
| 2626 | struct instance_name ## tag{}; \ |
| 2627 | typedef BOOST_TYPEOF(build_entry_state<instance_name ## tag BOOST_MSM_EUML_ENTRY_STATE_HELPER(region) > expr) instance_name; |
| 2628 | |
| 2629 | #define BOOST_MSM_EUML_DECLARE_EXIT_STATE(expr,instance_name) \ |
| 2630 | struct instance_name ## tag{}; \ |
| 2631 | typedef BOOST_TYPEOF(build_exit_state<instance_name ## tag> expr) instance_name; |
| 2632 | |
| 2633 | #define BOOST_MSM_EUML_DECLARE_STATE_MACHINE(expr,instance_name) \ |
| 2634 | struct instance_name ## tag{}; \ |
| 2635 | typedef BOOST_TYPEOF(build_sm<instance_name ## tag> expr) instance_name; |
| 2636 | |
| 2637 | #define BOOST_MSM_EUML_DECLARE_TRANSITION_TABLE(expr,instance_name) \ |
| 2638 | typedef int using_declared_table; \ |
| 2639 | typedef BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) instance_name; |
| 2640 | |
| 2641 | #define BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE(expr) \ |
| 2642 | typedef BOOST_TYPEOF( \ |
| 2643 | BOOST_MSM_EUML_BUILD_INTERNAL_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) internal_transition_table; |
| 2644 | |
| 2645 | // following macros declare a state type and create an instance |
| 2646 | #define BOOST_MSM_EUML_STATE(expr,instance_name) \ |
| 2647 | struct instance_name ## tag{}; \ |
| 2648 | typedef BOOST_TYPEOF(build_state<instance_name ## tag> expr) instance_name ## _helper; \ |
| 2649 | static instance_name ## _helper instance_name; |
| 2650 | |
| 2651 | #define BOOST_MSM_EUML_INTERRUPT_STATE(expr,instance_name) \ |
| 2652 | struct instance_name ## tag{}; \ |
| 2653 | typedef BOOST_TYPEOF(build_interrupt_state<instance_name ## tag> expr) instance_name ## _helper; \ |
| 2654 | static instance_name ## _helper instance_name; |
| 2655 | |
| 2656 | #define BOOST_MSM_EUML_TERMINATE_STATE(expr,instance_name) \ |
| 2657 | struct instance_name ## tag{}; \ |
| 2658 | typedef BOOST_TYPEOF(build_terminate_state<instance_name ## tag> expr) instance_name ## _helper; \ |
| 2659 | static instance_name ## _helper instance_name; |
| 2660 | |
| 2661 | #define BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE(region,expr,instance_name) \ |
| 2662 | struct instance_name ## tag{}; \ |
| 2663 | typedef BOOST_TYPEOF(build_explicit_entry_state<instance_name ## tag BOOST_MSM_EUML_ENTRY_STATE_HELPER(region) > expr) instance_name ## _helper; \ |
| 2664 | static instance_name ## _helper instance_name; |
| 2665 | |
| 2666 | #define BOOST_MSM_EUML_ENTRY_STATE(region,expr,instance_name) \ |
| 2667 | struct instance_name ## tag{}; \ |
| 2668 | typedef BOOST_TYPEOF(build_entry_state<instance_name ## tag BOOST_MSM_EUML_ENTRY_STATE_HELPER(region) > expr) instance_name ## _helper; \ |
| 2669 | static instance_name ## _helper instance_name; |
| 2670 | |
| 2671 | #define BOOST_MSM_EUML_EXIT_STATE(expr,instance_name) \ |
| 2672 | struct instance_name ## tag{}; \ |
| 2673 | typedef BOOST_TYPEOF(build_exit_state<instance_name ## tag> expr) instance_name ## _helper; \ |
| 2674 | static instance_name ## _helper instance_name; |
| 2675 | |
| 2676 | |
| 2677 | #ifndef BOOST_MSVC |
| 2678 | |
| 2679 | #define BOOST_MSM_EUML_TRANSITION_TABLE(expr,instance_name) \ |
| 2680 | typedef BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) instance_name ## _def; \ |
| 2681 | struct instance_name ## _helper : public instance_name ## _def{instance_name ## _helper(){}}; \ |
| 2682 | static instance_name ## _helper instance_name; |
| 2683 | |
| 2684 | #define BOOST_MSM_EUML_INTERNAL_TRANSITION_TABLE(expr,instance_name) \ |
| 2685 | typedef BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_INTERNAL_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) instance_name ## _def; \ |
| 2686 | struct instance_name ## _helper : public instance_name ## _def{instance_name ## _helper(){}}; \ |
| 2687 | static instance_name ## _helper instance_name; |
| 2688 | |
| 2689 | #else |
| 2690 | |
| 2691 | #define BOOST_MSM_EUML_TRANSITION_TABLE(expr,instance_name) \ |
| 2692 | struct instance_name ## _helper : \ |
| 2693 | public BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) \ |
| 2694 | {instance_name ## _helper(){}} ; \ |
| 2695 | static instance_name ## _helper instance_name; |
| 2696 | |
| 2697 | #define BOOST_MSM_EUML_INTERNAL_TRANSITION_TABLE(expr,instance_name) \ |
| 2698 | struct instance_name ## _helper : \ |
| 2699 | public BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_INTERNAL_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) \ |
| 2700 | {instance_name ## _helper(){}} ; \ |
| 2701 | static instance_name ## _helper instance_name; |
| 2702 | |
| 2703 | #endif |
| 2704 | |
| 2705 | }}}} // boost::msm::front::euml |
| 2706 | |
| 2707 | namespace boost { namespace msm{ |
| 2708 | template<> |
| 2709 | struct is_kleene_event< boost::msm::front::euml::kleene_ > |
| 2710 | { |
| 2711 | typedef ::boost::mpl::true_ type; |
| 2712 | }; |
| 2713 | }} |
| 2714 | |
| 2715 | #endif // BOOST_MSM_FRONT_EUML_COMMON_H |
| 2716 | |