operator.hpp 56 KB

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