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