state_grammar.hpp 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837
  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_STATE_GRAMMAR_H
  11. #define BOOST_MSM_FRONT_EUML_STATE_GRAMMAR_H
  12. #ifdef BOOST_MSM_EUML_PHOENIX_SUPPORT
  13. #include <boost/phoenix/core/meta_grammar.hpp>
  14. #endif
  15. #include <boost/msm/front/euml/common.hpp>
  16. #include <boost/fusion/container/vector.hpp>
  17. #include <boost/fusion/include/pair.hpp>
  18. #include <boost/fusion/include/as_map.hpp>
  19. #include <boost/mpl/remove_if.hpp>
  20. #include <boost/mpl/eval_if.hpp>
  21. #include <boost/mpl/assert.hpp>
  22. #include <boost/msm/row_tags.hpp>
  23. #include <boost/msm/front/common_states.hpp>
  24. #include <boost/msm/front/state_machine_def.hpp>
  25. #include <boost/msm/front/euml/operator.hpp>
  26. #include <boost/msm/front/euml/guard_grammar.hpp>
  27. BOOST_MPL_HAS_XXX_TRAIT_DEF(attribute_tag)
  28. BOOST_MPL_HAS_XXX_TRAIT_DEF(flag_create_tag)
  29. BOOST_MPL_HAS_XXX_TRAIT_DEF(defer_create_tag)
  30. BOOST_MPL_HAS_XXX_TRAIT_DEF(control_configure_tag)
  31. namespace proto = boost::proto;
  32. namespace boost { namespace msm { namespace front { namespace euml
  33. {
  34. // provides the typedefs and interface. Concrete states derive from it.
  35. template<class StateNameTag,
  36. class EntryFunctor=NoAction,
  37. class ExitFunctor=NoAction,
  38. class Attributes= ::boost::fusion::vector<>,
  39. class Flags = ::boost::mpl::vector0<>,
  40. class Defer = ::boost::mpl::vector0<>,
  41. class BASE = ::boost::msm::front::default_base_state>
  42. struct func_state : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
  43. euml_state_intern<func_state<StateNameTag,EntryFunctor,ExitFunctor,Attributes,Flags,Defer,BASE> >
  44. {
  45. func_state(){}
  46. // grammar testing
  47. BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
  48. BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
  49. typedef StateNameTag state_name_tag;
  50. // flags
  51. typedef Flags flag_list;
  52. typedef ::boost::mpl::vector0<> internal_flag_list;
  53. // deferred events
  54. typedef Defer deferred_events;
  55. template <class Event,class FSM>
  56. void on_entry(Event const& evt,FSM& fsm)
  57. {
  58. EntryFunctor()(evt,fsm,*this);
  59. }
  60. template <class Event,class FSM>
  61. void on_exit(Event const& evt,FSM& fsm)
  62. {
  63. ExitFunctor()(evt,fsm,*this);
  64. }
  65. };
  66. // provides the typedefs and interface. Concrete states derive from it.
  67. template<class StateNameTag,
  68. int ZoneIndex=-1,
  69. class EntryFunctor=NoAction,
  70. class ExitFunctor=NoAction,
  71. class Attributes= ::boost::fusion::vector<>,
  72. class Flags = ::boost::mpl::vector0<>,
  73. class Defer = ::boost::mpl::vector0<>,
  74. class BASE = default_base_state>
  75. struct entry_func_state : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
  76. euml_state_intern<entry_func_state<StateNameTag,ZoneIndex,EntryFunctor,ExitFunctor,Attributes,Flags,Defer,BASE> >
  77. {
  78. entry_func_state(){}
  79. // grammar testing
  80. BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
  81. BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
  82. typedef StateNameTag state_name_tag;
  83. // tags
  84. typedef int pseudo_entry;
  85. enum {zone_index=ZoneIndex};
  86. typedef int explicit_entry_state;
  87. // flags
  88. typedef Flags flag_list;
  89. typedef ::boost::mpl::vector0<> internal_flag_list;
  90. // deferred events
  91. typedef Defer deferred_events;
  92. template <class Event,class FSM>
  93. void on_entry(Event const& evt,FSM& fsm)
  94. {
  95. EntryFunctor()(evt,fsm,*this);
  96. }
  97. template <class Event,class FSM>
  98. void on_exit(Event const& evt,FSM& fsm)
  99. {
  100. ExitFunctor()(evt,fsm,*this);
  101. }
  102. };
  103. // provides the typedefs and interface. Concrete states derive from it.
  104. template<class StateNameTag,
  105. int ZoneIndex=-1,
  106. class EntryFunctor=NoAction,
  107. class ExitFunctor=NoAction,
  108. class Attributes= ::boost::fusion::vector<>,
  109. class Flags = ::boost::mpl::vector0<>,
  110. class Defer = ::boost::mpl::vector0<>,
  111. class BASE = default_base_state>
  112. struct explicit_entry_func_state : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
  113. public ::boost::msm::front::explicit_entry<ZoneIndex>,
  114. euml_state_intern<explicit_entry_func_state<StateNameTag,
  115. ZoneIndex,EntryFunctor,ExitFunctor,Attributes,Flags,Defer,BASE> >
  116. {
  117. explicit_entry_func_state(){}
  118. // grammar testing
  119. BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
  120. BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
  121. typedef StateNameTag state_name_tag;
  122. // flags
  123. typedef Flags flag_list;
  124. typedef ::boost::mpl::vector0<> internal_flag_list;
  125. // deferred events
  126. typedef Defer deferred_events;
  127. template <class Event,class FSM>
  128. void on_entry(Event const& evt,FSM& fsm)
  129. {
  130. EntryFunctor()(evt,fsm,*this);
  131. }
  132. template <class Event,class FSM>
  133. void on_exit(Event const& evt,FSM& fsm)
  134. {
  135. ExitFunctor()(evt,fsm,*this);
  136. }
  137. };
  138. // provides the typedefs and interface. Concrete states derive from it.
  139. template<class StateNameTag,
  140. class Event,
  141. class EntryFunctor=NoAction,
  142. class ExitFunctor=NoAction,
  143. class Attributes= ::boost::fusion::vector<>,
  144. class Flags = ::boost::mpl::vector0<>,
  145. class Defer = ::boost::mpl::vector0<>,
  146. class BASE = default_base_state>
  147. struct exit_func_state : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
  148. euml_state_intern<exit_func_state<StateNameTag,Event,EntryFunctor,ExitFunctor,Attributes,Flags,Defer,BASE> >
  149. {
  150. exit_func_state(){}
  151. // grammar testing
  152. BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
  153. BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
  154. typedef StateNameTag state_name_tag;
  155. // tags
  156. typedef Event event;
  157. typedef BASE Base;
  158. typedef int pseudo_exit;
  159. // flags
  160. typedef Flags flag_list;
  161. typedef ::boost::mpl::vector0<> internal_flag_list;
  162. // deferred events
  163. typedef Defer deferred_events;
  164. template <class Evt,class FSM>
  165. void on_entry(Evt const& evt,FSM& fsm)
  166. {
  167. EntryFunctor()(evt,fsm,*this);
  168. }
  169. template <class Evt,class FSM>
  170. void on_exit(Evt const& evt,FSM& fsm)
  171. {
  172. ExitFunctor()(evt,fsm,*this);
  173. }
  174. };
  175. struct BuildActions;
  176. struct BuildGuards;
  177. struct BuildActionSequence
  178. : proto::or_<
  179. proto::when <
  180. BuildActions,
  181. ActionSequence_<make_vector_one_row<BuildActions(proto::_)>()>()
  182. >,
  183. proto::when <
  184. proto::comma<BuildActions,BuildActions >,
  185. ActionSequence_<boost::mpl::push_back<
  186. make_vector_one_row<BuildActions(proto::_left)>(),
  187. BuildActions(proto::_right)>()>()
  188. >,
  189. proto::when <
  190. proto::comma<BuildActionSequence,BuildActions >,
  191. ActionSequence_<boost::mpl::push_back<
  192. get_sequence<BuildActionSequence(proto::_left) >(),
  193. BuildActions(proto::_right) >() >()
  194. >
  195. >
  196. {};
  197. #ifdef BOOST_MSM_EUML_PHOENIX_SUPPORT
  198. struct CustomPhoenixGrammar
  199. : proto::switch_<CustomPhoenixGrammar>
  200. {
  201. template <typename Tag, typename Dummy = void>
  202. struct case_
  203. : proto::and_<
  204. proto::not_<BuildGuards> ,
  205. proto::not_<BuildActionSequence>,
  206. boost::phoenix::meta_grammar::case_<Tag>
  207. >
  208. {};
  209. };
  210. #endif
  211. struct GuardGrammar
  212. : proto::or_<
  213. #ifdef BOOST_MSM_EUML_PHOENIX_SUPPORT
  214. proto::when<
  215. CustomPhoenixGrammar ,
  216. proto::_
  217. >,
  218. #endif
  219. proto::when<
  220. BuildGuards ,
  221. BuildGuards
  222. >
  223. >
  224. {};
  225. struct ActionGrammar
  226. : proto::or_<
  227. #ifdef BOOST_MSM_EUML_PHOENIX_SUPPORT
  228. proto::when<
  229. CustomPhoenixGrammar ,
  230. proto::_
  231. >,
  232. #endif
  233. proto::when<
  234. BuildActionSequence ,
  235. BuildActionSequence
  236. >
  237. >
  238. {};
  239. struct BuildActionsCases
  240. {
  241. // The primary template matches nothing:
  242. template<typename Tag>
  243. struct case_
  244. : proto::not_<proto::_>
  245. {};
  246. };
  247. template<>
  248. struct BuildActionsCases::case_<proto::tag::pre_inc>
  249. : proto::when<
  250. proto::pre_inc<BuildActions >,
  251. Pre_inc_< BuildActions(proto::_child)>()
  252. >
  253. {};
  254. template<>
  255. struct BuildActionsCases::case_<proto::tag::pre_dec>
  256. : proto::when<
  257. proto::pre_dec<BuildActions >,
  258. Pre_dec_< BuildActions(proto::_child)>()
  259. >
  260. {};
  261. template<>
  262. struct BuildActionsCases::case_<proto::tag::post_inc>
  263. : proto::when<
  264. proto::post_inc<BuildActions >,
  265. Post_inc_< BuildActions(proto::_child)>()
  266. >
  267. {};
  268. template<>
  269. struct BuildActionsCases::case_<proto::tag::post_dec>
  270. : proto::when<
  271. proto::post_dec<BuildActions >,
  272. Post_dec_< BuildActions(proto::_child)>()
  273. >
  274. {};
  275. template<>
  276. struct BuildActionsCases::case_<proto::tag::dereference>
  277. : proto::when<
  278. proto::dereference<BuildActions >,
  279. Deref_< BuildActions(proto::_child)>()
  280. >
  281. {};
  282. template<>
  283. struct BuildActionsCases::case_<proto::tag::plus>
  284. : proto::when<
  285. proto::plus<BuildActions,BuildActions >,
  286. Plus_<BuildActions(proto::_left),BuildActions(proto::_right)>()
  287. >
  288. {};
  289. template<>
  290. struct BuildActionsCases::case_<proto::tag::minus>
  291. : proto::when<
  292. proto::minus<BuildActions,BuildActions >,
  293. Minus_<BuildActions(proto::_left),BuildActions(proto::_right)>()
  294. >
  295. {};
  296. template<>
  297. struct BuildActionsCases::case_<proto::tag::multiplies>
  298. : proto::when<
  299. proto::multiplies<BuildActions,BuildActions >,
  300. Multiplies_<BuildActions(proto::_left),BuildActions(proto::_right)>()
  301. >
  302. {};
  303. template<>
  304. struct BuildActionsCases::case_<proto::tag::divides>
  305. : proto::when<
  306. proto::divides<BuildActions,BuildActions >,
  307. Divides_<BuildActions(proto::_left),BuildActions(proto::_right)>()
  308. >
  309. {};
  310. template<>
  311. struct BuildActionsCases::case_<proto::tag::modulus>
  312. : proto::when<
  313. proto::modulus<BuildActions,BuildActions >,
  314. Modulus_<BuildActions(proto::_left),BuildActions(proto::_right)>()
  315. >
  316. {};
  317. template<>
  318. struct BuildActionsCases::case_<proto::tag::bitwise_and>
  319. : proto::when<
  320. proto::bitwise_and<BuildActions,BuildActions >,
  321. Bitwise_And_<BuildActions(proto::_left),BuildActions(proto::_right)>()
  322. >
  323. {};
  324. template<>
  325. struct BuildActionsCases::case_<proto::tag::bitwise_or>
  326. : proto::when<
  327. proto::bitwise_or<BuildActions,BuildActions >,
  328. Bitwise_Or_<BuildActions(proto::_left),BuildActions(proto::_right)>()
  329. >
  330. {};
  331. template<>
  332. struct BuildActionsCases::case_<proto::tag::bitwise_xor>
  333. : proto::when<
  334. proto::bitwise_xor<BuildActions,BuildActions >,
  335. Bitwise_Xor_<BuildActions(proto::_left),BuildActions(proto::_right)>()
  336. >
  337. {};
  338. template<>
  339. struct BuildActionsCases::case_<proto::tag::plus_assign>
  340. : proto::when<
  341. proto::plus_assign<BuildActions,BuildActions >,
  342. Plus_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
  343. >
  344. {};
  345. template<>
  346. struct BuildActionsCases::case_<proto::tag::minus_assign>
  347. : proto::when<
  348. proto::minus_assign<BuildActions,BuildActions >,
  349. Minus_Assign_<BuildActions(proto::_left),BuildActions(proto::_right)>()
  350. >
  351. {};
  352. template<>
  353. struct BuildActionsCases::case_<proto::tag::multiplies_assign>
  354. : proto::when<
  355. proto::multiplies_assign<BuildActions,BuildActions >,
  356. Multiplies_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
  357. >
  358. {};
  359. template<>
  360. struct BuildActionsCases::case_<proto::tag::divides_assign>
  361. : proto::when<
  362. proto::divides_assign<BuildActions,BuildActions >,
  363. Divides_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
  364. >
  365. {};
  366. template<>
  367. struct BuildActionsCases::case_<proto::tag::modulus_assign>
  368. : proto::when<
  369. proto::modulus_assign<BuildActions,BuildActions >,
  370. Modulus_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
  371. >
  372. {};
  373. template<>
  374. struct BuildActionsCases::case_<proto::tag::shift_left_assign>
  375. : proto::when<
  376. proto::shift_left_assign<BuildActions,BuildActions >,
  377. ShiftLeft_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
  378. >
  379. {};
  380. template<>
  381. struct BuildActionsCases::case_<proto::tag::shift_right_assign>
  382. : proto::when<
  383. proto::shift_right_assign<BuildActions,BuildActions >,
  384. ShiftRight_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
  385. >
  386. {};
  387. template<>
  388. struct BuildActionsCases::case_<proto::tag::shift_left>
  389. : proto::when<
  390. proto::shift_left<BuildActions,BuildActions >,
  391. ShiftLeft_< BuildActions(proto::_left),BuildActions(proto::_right)>()
  392. >
  393. {};
  394. template<>
  395. struct BuildActionsCases::case_<proto::tag::shift_right>
  396. : proto::when<
  397. proto::shift_right<BuildActions,BuildActions >,
  398. ShiftRight_< BuildActions(proto::_left),BuildActions(proto::_right)>()
  399. >
  400. {};
  401. template<>
  402. struct BuildActionsCases::case_<proto::tag::assign>
  403. : proto::when<
  404. proto::assign<BuildActions,BuildActions >,
  405. Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
  406. >
  407. {};
  408. template<>
  409. struct BuildActionsCases::case_<proto::tag::subscript>
  410. : proto::when<
  411. proto::subscript<BuildActions,BuildActions >,
  412. Subscript_< BuildActions(proto::_left),BuildActions(proto::_right)>()
  413. >
  414. {};
  415. template<>
  416. struct BuildActionsCases::case_<proto::tag::unary_plus>
  417. : proto::when<
  418. proto::unary_plus<BuildActions >,
  419. Unary_Plus_< BuildActions(proto::_child)>()
  420. >
  421. {};
  422. template<>
  423. struct BuildActionsCases::case_<proto::tag::negate>
  424. : proto::when<
  425. proto::negate<BuildActions >,
  426. Unary_Minus_< BuildActions(proto::_child)>()
  427. >
  428. {};
  429. template<>
  430. struct BuildActionsCases::case_<proto::tag::function>
  431. : proto::or_<
  432. proto::when<
  433. proto::function<proto::terminal<if_tag>,BuildGuards,BuildActionSequence,BuildActionSequence >,
  434. If_Else_<BuildGuards(proto::_child_c<1>),
  435. BuildActionSequence(proto::_child_c<2>),
  436. BuildActionSequence(proto::_child_c<3>) >()
  437. >,
  438. proto::when<
  439. proto::function<proto::terminal<if_then_tag>,BuildGuards,BuildActionSequence >,
  440. If_Then_<BuildGuards(proto::_child_c<1>),
  441. BuildActionSequence(proto::_child_c<2>)>()
  442. >,
  443. proto::when<
  444. proto::function<proto::terminal<while_do_tag>,BuildGuards,BuildActionSequence >,
  445. While_Do_<BuildGuards(proto::_child_c<1>),
  446. BuildActionSequence(proto::_child_c<2>) >()
  447. >,
  448. proto::when<
  449. proto::function<proto::terminal<do_while_tag>,BuildGuards,BuildActionSequence >,
  450. Do_While_<BuildGuards(proto::_child_c<1>),
  451. BuildActionSequence(proto::_child_c<2>) >()
  452. >,
  453. proto::when<
  454. proto::function<proto::terminal<for_loop_tag>,
  455. BuildActionSequence,BuildGuards,BuildActionSequence,BuildActionSequence>,
  456. For_Loop_<BuildActionSequence(proto::_child_c<1>),
  457. BuildGuards(proto::_child_c<2>),
  458. BuildActionSequence(proto::_child_c<3>),
  459. BuildActionSequence(proto::_child_c<4>) >()
  460. >,
  461. proto::or_<
  462. proto::when<
  463. proto::function<proto::terminal<proto::_>,BuildActions >,
  464. get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>) >()
  465. >,
  466. proto::when<
  467. proto::function<proto::terminal<proto::_> >,
  468. get_fct<proto::_child_c<0> >()
  469. >,
  470. proto::when<
  471. proto::function<proto::terminal<proto::_>,BuildActions,BuildActions >,
  472. get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>) >()
  473. >,
  474. proto::when<
  475. proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions >,
  476. get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>)
  477. ,BuildActions(proto::_child_c<2>),BuildActions(proto::_child_c<3>) >()
  478. >,
  479. proto::when<
  480. proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions >,
  481. get_fct<proto::_child_c<0>
  482. ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
  483. ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>) >()
  484. >,
  485. proto::when<
  486. proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions >,
  487. get_fct<proto::_child_c<0>
  488. ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
  489. ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>)
  490. ,BuildActions(proto::_child_c<5>) >()
  491. >
  492. #ifdef BOOST_MSVC
  493. ,proto::when<
  494. proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions >,
  495. get_fct<proto::_child_c<0>
  496. ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
  497. ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>)
  498. ,BuildActions(proto::_child_c<5>),BuildActions(proto::_child_c<6>) >()
  499. >
  500. #endif
  501. >
  502. >
  503. {};
  504. template<>
  505. struct BuildActionsCases::case_<proto::tag::terminal>
  506. : proto::or_<
  507. proto::when<
  508. proto::terminal<action_tag>,
  509. get_action_name<proto::_ >()
  510. >,
  511. proto::when<
  512. proto::terminal<state_tag>,
  513. get_state_name<proto::_>()
  514. >,
  515. proto::when<
  516. proto::terminal<flag_tag>,
  517. proto::_
  518. >,
  519. proto::when<
  520. proto::terminal<event_tag>,
  521. proto::_
  522. >,
  523. proto::when<
  524. proto::terminal<fsm_artefact_tag>,
  525. get_fct<proto::_ >()
  526. >,
  527. proto::when<
  528. proto::terminal<proto::_>,
  529. proto::_value
  530. >
  531. >
  532. {};
  533. struct BuildActions
  534. : proto::switch_<BuildActionsCases>
  535. {};
  536. // attributes building
  537. #define BOOST_MSM_EUML_DECLARE_ATTRIBUTE(attr_type,attr_name) \
  538. struct attr_name ## _ \
  539. : proto::extends< proto::terminal< ::boost::msm::front::action_tag>::type, attr_name ## _, boost::msm::sm_domain> \
  540. {typedef attr_name ## _ action_name; \
  541. typedef ::boost::fusion::pair<attr_name ## _,attr_type> attribute_type; \
  542. attr_name ## _ (){} \
  543. }; \
  544. attr_name ## _ const attr_name = attr_name ## _();
  545. struct make_attributes_tag
  546. {
  547. typedef int attribute_tag;
  548. };
  549. template <class T>
  550. struct get_attribute_type
  551. {
  552. typedef typename T::attribute_type type;
  553. };
  554. template <class Seq>
  555. struct transform_to_fusion_pair
  556. {
  557. typedef typename ::boost::mpl::fold<
  558. Seq,::boost::mpl::vector<>,
  559. ::boost::mpl::push_back< ::boost::mpl::placeholders::_1,
  560. get_attribute_type< ::boost::mpl::placeholders::_2> >
  561. >::type type;
  562. };
  563. template<class X = proto::is_proto_expr>
  564. struct attribute
  565. {
  566. BOOST_PROTO_BASIC_EXTENDS(
  567. proto::terminal<make_attributes_tag>::type
  568. , attribute
  569. , boost::msm::sm_domain
  570. )
  571. typedef ::boost::fusion::pair<int,int> attribute_type;
  572. };
  573. attribute<> const attributes_ = {{{}}};
  574. attribute<> const no_attributes_ = {{{}}};
  575. struct BuildAttributesHelper
  576. : proto::make<
  577. ::boost::mpl::pop_front<
  578. proto::fold_tree<
  579. proto::_
  580. , ::boost::fusion::vector<>()
  581. , ::boost::mpl::push_back<proto::_state,
  582. ::boost::mpl::if_< has_attribute_tag< proto::_value>,
  583. proto::_value,
  584. get_attribute_type<proto::_> >
  585. >()
  586. >
  587. >
  588. >
  589. {};
  590. struct BuildAttributes
  591. : proto::make<
  592. ::boost::mpl::if_<
  593. has_attribute_tag< ::boost::mpl::deref< ::boost::mpl::prior< ::boost::mpl::end< BuildAttributesHelper > > > >,
  594. ::boost::fusion::result_of::as_map< ::boost::mpl::pop_back< BuildAttributesHelper > >,
  595. ::boost::fusion::result_of::as_map< BuildAttributesHelper > >
  596. >
  597. {};
  598. // helper to build a mpl::vector from a << list
  599. struct BuildMplVectorHelper
  600. : proto::make<
  601. ::boost::mpl::pop_front<
  602. proto::fold_tree<
  603. proto::_
  604. , ::boost::mpl::vector0<>()
  605. , ::boost::mpl::push_back<proto::_state, proto::_>()
  606. >
  607. >
  608. >
  609. {};
  610. // flags building
  611. struct BuildFlags
  612. : proto::make<
  613. ::boost::mpl::remove_if<
  614. BuildMplVectorHelper,
  615. ::boost::mpl::not_< ::boost::is_same<get_euml_tag_type< ::boost::mpl::placeholders::_ >, flag_tag > >
  616. >
  617. >
  618. {};
  619. struct control_configure_tag {};
  620. // configuration building
  621. struct make_configure_tag
  622. {
  623. typedef int control_configure_tag;
  624. };
  625. template<class X = proto::is_proto_expr>
  626. struct configure
  627. {
  628. typedef not_euml_tag euml_tag_type;
  629. BOOST_PROTO_BASIC_EXTENDS(
  630. proto::terminal<make_configure_tag>::type
  631. , configure
  632. , boost::msm::sm_domain
  633. )
  634. };
  635. configure<> const configure_ = {{{}}};
  636. configure<> const no_configure_ = {{{}}};
  637. struct BuildConfigure
  638. : proto::make<
  639. ::boost::mpl::remove_if<
  640. BuildMplVectorHelper,
  641. ::boost::mpl::not_< ::boost::is_same<get_euml_tag_type< ::boost::mpl::placeholders::_ >, config_tag > >
  642. >
  643. >
  644. {};
  645. struct BuildDeferred
  646. : proto::make<
  647. ::boost::mpl::remove_if<
  648. BuildMplVectorHelper,
  649. ::boost::mpl::not_< ::boost::is_same<get_euml_tag_type< ::boost::mpl::placeholders::_ >, event_tag > >
  650. >
  651. >
  652. {};
  653. template<class X = proto::is_proto_expr>
  654. struct define_init
  655. {
  656. typedef int defer_create_tag;
  657. BOOST_PROTO_BASIC_EXTENDS(
  658. proto::terminal<state_tag>::type
  659. , define_init
  660. , boost::msm::sm_domain
  661. )
  662. };
  663. define_init<> const init_ = {{{}}};
  664. struct BuildInit
  665. : proto::make<
  666. ::boost::mpl::pop_front<
  667. proto::fold_tree<
  668. proto::_
  669. , ::boost::mpl::vector0<>()
  670. , ::boost::mpl::push_back<proto::_state, proto::_>()
  671. >
  672. >
  673. >
  674. {};
  675. template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure,class BASE>
  676. inline
  677. func_state<
  678. StateNameTag,
  679. typename ::boost::mpl::eval_if<
  680. typename proto::matches<Expr1,ActionGrammar>::type,
  681. boost::result_of<ActionGrammar(Expr1)>,
  682. make_invalid_type>::type,
  683. typename ::boost::mpl::eval_if<
  684. typename proto::matches<Expr2,ActionGrammar>::type,
  685. boost::result_of<ActionGrammar(Expr2)>,
  686. make_invalid_type>::type,
  687. typename boost::result_of<BuildAttributes(Attr)>::type,
  688. typename boost::result_of<BuildFlags(Configure)>::type,
  689. typename boost::result_of<BuildDeferred(Configure)>::type,
  690. BASE
  691. >
  692. build_state(Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
  693. {
  694. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  695. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  696. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  697. typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
  698. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  699. return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
  700. }
  701. template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure>
  702. inline
  703. func_state<
  704. StateNameTag,
  705. typename ::boost::mpl::eval_if<
  706. typename proto::matches<Expr1,ActionGrammar>::type,
  707. boost::result_of<ActionGrammar(Expr1)>,
  708. make_invalid_type>::type,
  709. typename ::boost::mpl::eval_if<
  710. typename proto::matches<Expr2,ActionGrammar>::type,
  711. boost::result_of<ActionGrammar(Expr2)>,
  712. make_invalid_type>::type,
  713. typename boost::result_of<BuildAttributes(Attr)>::type,
  714. typename boost::result_of<BuildFlags(Configure)>::type,
  715. typename boost::result_of<BuildDeferred(Configure)>::type
  716. >
  717. build_state(Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
  718. {
  719. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  720. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  721. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  722. typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
  723. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  724. return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
  725. }
  726. template <class StateNameTag,class Expr1,class Expr2,class Attr>
  727. inline
  728. func_state<
  729. StateNameTag,
  730. typename ::boost::mpl::eval_if<
  731. typename proto::matches<Expr1,ActionGrammar>::type,
  732. boost::result_of<ActionGrammar(Expr1)>,
  733. make_invalid_type>::type,
  734. typename ::boost::mpl::eval_if<
  735. typename proto::matches<Expr2,ActionGrammar>::type,
  736. boost::result_of<ActionGrammar(Expr2)>,
  737. make_invalid_type>::type,
  738. typename boost::result_of<BuildAttributes(Attr)>::type
  739. >
  740. build_state(Expr1 const& ,Expr2 const& ,Attr const&)
  741. {
  742. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  743. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  744. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  745. return func_state<StateNameTag,entry_action,exit_action,attributes_type>();
  746. }
  747. template <class StateNameTag,class Expr1,class Expr2>
  748. inline
  749. func_state<
  750. StateNameTag,
  751. typename ::boost::mpl::eval_if<
  752. typename proto::matches<Expr1,ActionGrammar>::type,
  753. boost::result_of<ActionGrammar(Expr1)>,
  754. make_invalid_type>::type,
  755. typename ::boost::mpl::eval_if<
  756. typename proto::matches<Expr2,ActionGrammar>::type,
  757. boost::result_of<ActionGrammar(Expr2)>,
  758. make_invalid_type>::type
  759. >
  760. build_state(Expr1 const& ,Expr2 const& )
  761. {
  762. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  763. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  764. return func_state<StateNameTag,entry_action,exit_action>();
  765. }
  766. template <class StateNameTag,class Expr1>
  767. inline
  768. func_state<
  769. StateNameTag,
  770. typename ::boost::mpl::eval_if<
  771. typename proto::matches<Expr1,ActionGrammar>::type,
  772. boost::result_of<ActionGrammar(Expr1)>,
  773. make_invalid_type>::type,
  774. NoAction
  775. >
  776. build_state(Expr1 const& )
  777. {
  778. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  779. return func_state<StateNameTag,entry_action,NoAction>();
  780. }
  781. template<class StateNameTag>
  782. inline
  783. func_state<
  784. StateNameTag,
  785. NoAction,
  786. NoAction
  787. >
  788. build_state()
  789. {
  790. return func_state<StateNameTag,NoAction,NoAction>();
  791. }
  792. // provides the typedefs and interface. Concrete states derive from it.
  793. template<class StateNameTag,
  794. class STT,
  795. class Init,
  796. class EntryFunctor=NoAction,
  797. class ExitFunctor=NoAction,
  798. class Attributes= ::boost::fusion::vector<>,
  799. class Flags = ::boost::mpl::vector0<>,
  800. class Defer = ::boost::mpl::vector0<>,
  801. class Configuration = ::boost::mpl::vector0<>,
  802. class NoTransitionFunctor = NoAction,
  803. class OnExceptionFunctor = NoAction,
  804. class BASE = ::boost::msm::front::default_base_state>
  805. struct func_state_machine : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
  806. euml_state_intern<func_state_machine<StateNameTag,STT,Init,EntryFunctor,ExitFunctor,Attributes,Flags,
  807. Defer,NoTransitionFunctor,OnExceptionFunctor,BASE> >
  808. {
  809. func_state_machine(){}
  810. // grammar testing
  811. BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
  812. BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
  813. BOOST_MPL_ASSERT_NOT(( boost::is_same<NoTransitionFunctor,invalid_type> ));
  814. BOOST_MPL_ASSERT_NOT(( boost::is_same<OnExceptionFunctor,invalid_type> ));
  815. BOOST_MPL_ASSERT_NOT(( boost::is_same<STT,invalid_type> ));
  816. // flags
  817. typedef StateNameTag state_name_tag;
  818. typedef Flags flag_list;
  819. typedef ::boost::mpl::vector0<> internal_flag_list;
  820. // deferred events
  821. typedef Defer deferred_events;
  822. // customization (message queue, exceptions)
  823. typedef Configuration configuration;
  824. typedef BASE BaseAllStates;
  825. typedef STT transition_table;
  826. // the initial state of the player SM. Must be defined
  827. typedef Init initial_state;
  828. template <class Event,class FSM>
  829. void on_entry(Event const& evt,FSM& fsm)
  830. {
  831. EntryFunctor()(evt,fsm,*this);
  832. }
  833. template <class Event,class FSM>
  834. void on_exit(Event const& evt,FSM& fsm)
  835. {
  836. ExitFunctor()(evt,fsm,*this);
  837. }
  838. protected:
  839. // Default no-transition handler. Can be replaced in the Derived SM class.
  840. template <class FSM,class Event>
  841. void no_transition(Event const& evt,FSM& fsm,int state)
  842. {
  843. NoTransitionFunctor()(evt,fsm,state);
  844. }
  845. // default exception handler. Can be replaced in the Derived SM class.
  846. template <class FSM,class Event>
  847. void exception_caught (Event const& evt,FSM& fsm,std::exception& e)
  848. {
  849. OnExceptionFunctor()(evt,fsm,e);
  850. }
  851. };
  852. template <class StateNameTag,class STT,class Init>
  853. inline
  854. func_state_machine<
  855. StateNameTag,
  856. STT,
  857. typename boost::result_of<BuildInit(Init)>::type
  858. >
  859. build_sm(STT ,Init)
  860. {
  861. typedef typename boost::result_of<BuildInit(Init)>::type init_type;
  862. return func_state_machine<StateNameTag,STT,init_type>();
  863. }
  864. template <class StateNameTag,class STT,class Init,class Expr1>
  865. inline
  866. func_state_machine<
  867. StateNameTag,
  868. STT,
  869. typename boost::result_of<BuildInit(Init)>::type,
  870. typename ::boost::mpl::eval_if<
  871. typename proto::matches<Expr1,ActionGrammar>::type,
  872. boost::result_of<ActionGrammar(Expr1)>,
  873. make_invalid_type>::type
  874. >
  875. build_sm(STT ,Init , Expr1 const&)
  876. {
  877. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  878. typedef typename boost::result_of<BuildInit(Init)>::type init_type;
  879. return func_state_machine<StateNameTag,STT,init_type,entry_action>();
  880. }
  881. template <class StateNameTag,class STT,class Init,class Expr1,class Expr2>
  882. inline
  883. func_state_machine<
  884. StateNameTag,
  885. STT,
  886. typename boost::result_of<BuildInit(Init)>::type,
  887. typename ::boost::mpl::eval_if<
  888. typename proto::matches<Expr1,ActionGrammar>::type,
  889. boost::result_of<ActionGrammar(Expr1)>,
  890. make_invalid_type>::type,
  891. typename ::boost::mpl::eval_if<
  892. typename proto::matches<Expr2,ActionGrammar>::type,
  893. boost::result_of<ActionGrammar(Expr2)>,
  894. make_invalid_type>::type
  895. >
  896. build_sm(STT ,Init , Expr1 const& ,Expr2 const& )
  897. {
  898. typedef typename boost::result_of<BuildInit(Init)>::type init_type;
  899. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  900. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  901. return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action>();
  902. }
  903. template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr>
  904. inline
  905. func_state_machine<
  906. StateNameTag,
  907. STT,
  908. typename boost::result_of<BuildInit(Init)>::type,
  909. typename ::boost::mpl::eval_if<
  910. typename proto::matches<Expr1,ActionGrammar>::type,
  911. boost::result_of<ActionGrammar(Expr1)>,
  912. make_invalid_type>::type,
  913. typename ::boost::mpl::eval_if<
  914. typename proto::matches<Expr2,ActionGrammar>::type,
  915. boost::result_of<ActionGrammar(Expr2)>,
  916. make_invalid_type>::type,
  917. typename boost::result_of<BuildAttributes(Attr)>::type
  918. >
  919. build_sm(STT ,Init , Expr1 const& ,Expr2 const& ,Attr const&)
  920. {
  921. typedef typename boost::result_of<BuildInit(Init)>::type init_type;
  922. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  923. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  924. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  925. return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type>();
  926. }
  927. template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr,class Configure>
  928. inline
  929. func_state_machine<
  930. StateNameTag,
  931. STT,
  932. typename boost::result_of<BuildInit(Init)>::type,
  933. typename ::boost::mpl::eval_if<
  934. typename proto::matches<Expr1,ActionGrammar>::type,
  935. boost::result_of<ActionGrammar(Expr1)>,
  936. make_invalid_type>::type,
  937. typename ::boost::mpl::eval_if<
  938. typename proto::matches<Expr2,ActionGrammar>::type,
  939. boost::result_of<ActionGrammar(Expr2)>,
  940. make_invalid_type>::type,
  941. typename boost::result_of<BuildAttributes(Attr)>::type,
  942. typename boost::result_of<BuildFlags(Configure)>::type,
  943. typename boost::result_of<BuildDeferred(Configure)>::type,
  944. typename boost::result_of<BuildConfigure(Configure)>::type
  945. >
  946. build_sm(STT ,Init , Expr1 const& ,Expr2 const& , Attr const&, Configure const& )
  947. {
  948. typedef typename boost::result_of<BuildInit(Init)>::type init_type;
  949. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  950. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  951. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  952. typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
  953. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  954. typedef typename boost::result_of<BuildConfigure(Configure)>::type config_type;
  955. return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type,flags_type,
  956. deferred_type,config_type>();
  957. }
  958. template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr,class Configure,class Expr3>
  959. inline
  960. func_state_machine<
  961. StateNameTag,
  962. STT,
  963. typename boost::result_of<BuildInit(Init)>::type,
  964. typename ::boost::mpl::eval_if<
  965. typename proto::matches<Expr1,ActionGrammar>::type,
  966. boost::result_of<ActionGrammar(Expr1)>,
  967. make_invalid_type>::type,
  968. typename ::boost::mpl::eval_if<
  969. typename proto::matches<Expr2,ActionGrammar>::type,
  970. boost::result_of<ActionGrammar(Expr2)>,
  971. make_invalid_type>::type,
  972. typename boost::result_of<BuildAttributes(Attr)>::type,
  973. typename boost::result_of<BuildFlags(Configure)>::type,
  974. typename boost::result_of<BuildDeferred(Configure)>::type,
  975. typename boost::result_of<BuildConfigure(Configure)>::type,
  976. typename ::boost::mpl::eval_if<
  977. typename proto::matches<Expr3,ActionGrammar>::type,
  978. boost::result_of<ActionGrammar(Expr3)>,
  979. make_invalid_type>::type
  980. >
  981. build_sm(STT ,Init , Expr1 const& ,Expr2 const& ,Attr const&, Configure const&, Expr3 const& )
  982. {
  983. typedef typename boost::result_of<BuildInit(Init)>::type init_type;
  984. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  985. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  986. typedef typename boost::result_of<ActionGrammar(Expr3)>::type no_transition_action;
  987. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  988. typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
  989. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  990. typedef typename boost::result_of<BuildConfigure(Configure)>::type config_type;
  991. return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type,flags_type,deferred_type,
  992. config_type,no_transition_action>();
  993. }
  994. template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr,class Configure,class Expr3,class Expr4>
  995. inline
  996. func_state_machine<
  997. StateNameTag,
  998. STT,
  999. typename boost::result_of<BuildInit(Init)>::type,
  1000. typename ::boost::mpl::eval_if<
  1001. typename proto::matches<Expr1,ActionGrammar>::type,
  1002. boost::result_of<ActionGrammar(Expr1)>,
  1003. make_invalid_type>::type,
  1004. typename ::boost::mpl::eval_if<
  1005. typename proto::matches<Expr2,ActionGrammar>::type,
  1006. boost::result_of<ActionGrammar(Expr2)>,
  1007. make_invalid_type>::type,
  1008. typename boost::result_of<BuildAttributes(Attr)>::type,
  1009. typename boost::result_of<BuildFlags(Configure)>::type,
  1010. typename boost::result_of<BuildDeferred(Configure)>::type,
  1011. typename boost::result_of<BuildConfigure(Configure)>::type,
  1012. typename ::boost::mpl::eval_if<
  1013. typename proto::matches<Expr3,ActionGrammar>::type,
  1014. boost::result_of<ActionGrammar(Expr3)>,
  1015. make_invalid_type>::type,
  1016. typename ::boost::mpl::eval_if<
  1017. typename proto::matches<Expr4,ActionGrammar>::type,
  1018. boost::result_of<ActionGrammar(Expr4)>,
  1019. make_invalid_type>::type
  1020. >
  1021. build_sm(STT ,Init , Expr1 const& ,Expr2 const& , Attr const&, Configure const&, Expr3 const&, Expr4 const& )
  1022. {
  1023. typedef typename boost::result_of<BuildInit(Init)>::type init_type;
  1024. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1025. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1026. typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
  1027. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  1028. typedef typename boost::result_of<BuildConfigure(Configure)>::type config_type;
  1029. typedef typename boost::result_of<ActionGrammar(Expr3)>::type no_transition_action;
  1030. typedef typename boost::result_of<ActionGrammar(Expr4)>::type on_exception_action;
  1031. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1032. return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type,flags_type,deferred_type,
  1033. config_type,no_transition_action,on_exception_action>();
  1034. }
  1035. template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr,class Configure,class Expr3,class Expr4,class BASE>
  1036. inline
  1037. func_state_machine<
  1038. StateNameTag,
  1039. STT,
  1040. typename boost::result_of<BuildInit(Init)>::type,
  1041. typename ::boost::mpl::eval_if<
  1042. typename proto::matches<Expr1,ActionGrammar>::type,
  1043. boost::result_of<ActionGrammar(Expr1)>,
  1044. make_invalid_type>::type,
  1045. typename ::boost::mpl::eval_if<
  1046. typename proto::matches<Expr2,ActionGrammar>::type,
  1047. boost::result_of<ActionGrammar(Expr2)>,
  1048. make_invalid_type>::type,
  1049. typename boost::result_of<BuildAttributes(Attr)>::type,
  1050. typename boost::result_of<BuildFlags(Configure)>::type,
  1051. typename boost::result_of<BuildDeferred(Configure)>::type,
  1052. typename boost::result_of<BuildConfigure(Configure)>::type,
  1053. typename ::boost::mpl::eval_if<
  1054. typename proto::matches<Expr3,ActionGrammar>::type,
  1055. boost::result_of<ActionGrammar(Expr3)>,
  1056. make_invalid_type>::type,
  1057. typename ::boost::mpl::eval_if<
  1058. typename proto::matches<Expr4,ActionGrammar>::type,
  1059. boost::result_of<ActionGrammar(Expr4)>,
  1060. make_invalid_type>::type,
  1061. BASE
  1062. >
  1063. build_sm(STT ,Init , Expr1 const& ,Expr2 const& ,Attr const& , Configure const&, Expr3 const&, Expr4 const& , BASE )
  1064. {
  1065. typedef typename boost::result_of<BuildInit(Init)>::type init_type;
  1066. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1067. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1068. typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
  1069. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  1070. typedef typename boost::result_of<BuildConfigure(Configure)>::type config_type;
  1071. typedef typename boost::result_of<ActionGrammar(Expr3)>::type no_transition_action;
  1072. typedef typename boost::result_of<ActionGrammar(Expr4)>::type on_exception_action;
  1073. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1074. return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type,flags_type,deferred_type,
  1075. config_type,no_transition_action,on_exception_action,BASE>();
  1076. }
  1077. template <class Expr>
  1078. inline
  1079. ::boost::msm::front::detail::inherit_attributes<typename boost::result_of<BuildAttributes(Expr)>::type>
  1080. build_attributes (Expr const&)
  1081. {
  1082. return ::boost::msm::front::detail::inherit_attributes<typename boost::result_of<BuildAttributes(Expr)>::type> ();
  1083. }
  1084. template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure,class BASE>
  1085. inline
  1086. func_state<
  1087. StateNameTag,
  1088. typename ::boost::mpl::eval_if<
  1089. typename proto::matches<Expr1,ActionGrammar>::type,
  1090. boost::result_of<ActionGrammar(Expr1)>,
  1091. make_invalid_type>::type,
  1092. typename ::boost::mpl::eval_if<
  1093. typename proto::matches<Expr2,ActionGrammar>::type,
  1094. boost::result_of<ActionGrammar(Expr2)>,
  1095. make_invalid_type>::type,
  1096. typename boost::result_of<BuildAttributes(Attr)>::type,
  1097. typename ::boost::mpl::push_back< typename boost::result_of<BuildFlags(Configure)>::type,
  1098. ::boost::msm::TerminateFlag>::type,
  1099. typename boost::result_of<BuildDeferred(Configure)>::type,
  1100. BASE
  1101. >
  1102. build_terminate_state(Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
  1103. {
  1104. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1105. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1106. typedef typename ::boost::mpl::push_back<
  1107. typename boost::result_of<BuildFlags(Configure)>::type,
  1108. ::boost::msm::TerminateFlag >::type flags_type;
  1109. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  1110. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1111. return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
  1112. }
  1113. template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure>
  1114. inline
  1115. func_state<
  1116. StateNameTag,
  1117. typename ::boost::mpl::eval_if<
  1118. typename proto::matches<Expr1,ActionGrammar>::type,
  1119. boost::result_of<ActionGrammar(Expr1)>,
  1120. make_invalid_type>::type,
  1121. typename ::boost::mpl::eval_if<
  1122. typename proto::matches<Expr2,ActionGrammar>::type,
  1123. boost::result_of<ActionGrammar(Expr2)>,
  1124. make_invalid_type>::type,
  1125. typename boost::result_of<BuildAttributes(Attr)>::type,
  1126. typename ::boost::mpl::push_back< typename boost::result_of<BuildFlags(Configure)>::type,
  1127. ::boost::msm::TerminateFlag>::type,
  1128. typename boost::result_of<BuildDeferred(Configure)>::type
  1129. >
  1130. build_terminate_state(Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
  1131. {
  1132. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1133. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1134. typedef typename ::boost::mpl::push_back<
  1135. typename boost::result_of<BuildFlags(Configure)>::type,
  1136. ::boost::msm::TerminateFlag >::type flags_type;
  1137. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  1138. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1139. return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
  1140. }
  1141. template <class StateNameTag,class Expr1,class Expr2,class Attr>
  1142. inline
  1143. func_state<
  1144. StateNameTag,
  1145. typename ::boost::mpl::eval_if<
  1146. typename proto::matches<Expr1,ActionGrammar>::type,
  1147. boost::result_of<ActionGrammar(Expr1)>,
  1148. make_invalid_type>::type,
  1149. typename ::boost::mpl::eval_if<
  1150. typename proto::matches<Expr2,ActionGrammar>::type,
  1151. boost::result_of<ActionGrammar(Expr2)>,
  1152. make_invalid_type>::type,
  1153. typename boost::result_of<BuildAttributes(Attr)>::type,
  1154. ::boost::mpl::vector<boost::msm::TerminateFlag>
  1155. >
  1156. build_terminate_state(Expr1 const& ,Expr2 const& ,Attr const&)
  1157. {
  1158. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1159. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1160. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1161. return func_state<StateNameTag,entry_action,exit_action,attributes_type, ::boost::mpl::vector< ::boost::msm::TerminateFlag> >();
  1162. }
  1163. template <class StateNameTag,class Expr1,class Expr2>
  1164. inline
  1165. func_state<
  1166. StateNameTag,
  1167. typename ::boost::mpl::eval_if<
  1168. typename proto::matches<Expr1,ActionGrammar>::type,
  1169. boost::result_of<ActionGrammar(Expr1)>,
  1170. make_invalid_type>::type,
  1171. typename ::boost::mpl::eval_if<
  1172. typename proto::matches<Expr2,ActionGrammar>::type,
  1173. boost::result_of<ActionGrammar(Expr2)>,
  1174. make_invalid_type>::type,
  1175. ::boost::fusion::vector<>,
  1176. ::boost::mpl::vector<boost::msm::TerminateFlag>
  1177. >
  1178. build_terminate_state(Expr1 const& ,Expr2 const& )
  1179. {
  1180. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1181. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1182. return func_state<StateNameTag,entry_action,exit_action,
  1183. ::boost::fusion::vector<>, ::boost::mpl::vector< ::boost::msm::TerminateFlag> >();
  1184. }
  1185. template <class StateNameTag,class Expr1>
  1186. inline
  1187. func_state<
  1188. StateNameTag,
  1189. typename ::boost::mpl::eval_if<
  1190. typename proto::matches<Expr1,ActionGrammar>::type,
  1191. boost::result_of<ActionGrammar(Expr1)>,
  1192. make_invalid_type>::type,
  1193. NoAction,
  1194. ::boost::fusion::vector<>,
  1195. ::boost::mpl::vector<boost::msm::TerminateFlag>
  1196. >
  1197. build_terminate_state(Expr1 const& )
  1198. {
  1199. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1200. return func_state<StateNameTag,entry_action,NoAction,::boost::fusion::vector<>,::boost::mpl::vector<boost::msm::TerminateFlag> >();
  1201. }
  1202. template<class StateNameTag>
  1203. inline
  1204. func_state<
  1205. StateNameTag,
  1206. NoAction,
  1207. NoAction,
  1208. ::boost::fusion::vector<>,
  1209. ::boost::mpl::vector<boost::msm::TerminateFlag>
  1210. >
  1211. build_terminate_state()
  1212. {
  1213. return func_state<StateNameTag,NoAction,NoAction,::boost::fusion::vector<>,::boost::mpl::vector<boost::msm::TerminateFlag> >();
  1214. }
  1215. template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure,class BASE,class EndInterruptEvent>
  1216. inline
  1217. func_state<
  1218. StateNameTag,
  1219. typename ::boost::mpl::eval_if<
  1220. typename proto::matches<Expr1,ActionGrammar>::type,
  1221. boost::result_of<ActionGrammar(Expr1)>,
  1222. make_invalid_type>::type,
  1223. typename ::boost::mpl::eval_if<
  1224. typename proto::matches<Expr2,ActionGrammar>::type,
  1225. boost::result_of<ActionGrammar(Expr2)>,
  1226. make_invalid_type>::type,
  1227. typename boost::result_of<BuildAttributes(Attr)>::type,
  1228. typename ::boost::mpl::push_back<
  1229. typename ::boost::mpl::push_back< typename boost::result_of<BuildFlags(Configure)>::type,
  1230. ::boost::msm::InterruptedFlag>::type,
  1231. boost::msm::EndInterruptFlag<EndInterruptEvent>
  1232. >::type,
  1233. typename boost::result_of<BuildDeferred(Configure)>::type,
  1234. BASE
  1235. >
  1236. build_interrupt_state(EndInterruptEvent const&,Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
  1237. {
  1238. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1239. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1240. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1241. typedef typename ::boost::mpl::push_back<
  1242. typename ::boost::mpl::push_back<
  1243. typename boost::result_of<BuildFlags(Configure)>::type,
  1244. ::boost::msm::InterruptedFlag>::type,
  1245. boost::msm::EndInterruptFlag<EndInterruptEvent>
  1246. >::type flags_type;
  1247. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  1248. return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
  1249. }
  1250. template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure,class EndInterruptEvent>
  1251. inline
  1252. func_state<
  1253. StateNameTag,
  1254. typename ::boost::mpl::eval_if<
  1255. typename proto::matches<Expr1,ActionGrammar>::type,
  1256. boost::result_of<ActionGrammar(Expr1)>,
  1257. make_invalid_type>::type,
  1258. typename ::boost::mpl::eval_if<
  1259. typename proto::matches<Expr2,ActionGrammar>::type,
  1260. boost::result_of<ActionGrammar(Expr2)>,
  1261. make_invalid_type>::type,
  1262. typename boost::result_of<BuildAttributes(Attr)>::type,
  1263. typename ::boost::mpl::push_back<
  1264. typename ::boost::mpl::push_back< typename boost::result_of<BuildFlags(Configure)>::type,
  1265. ::boost::msm::InterruptedFlag>::type,
  1266. boost::msm::EndInterruptFlag<EndInterruptEvent>
  1267. >::type,
  1268. typename boost::result_of<BuildDeferred(Configure)>::type
  1269. >
  1270. build_interrupt_state(EndInterruptEvent const&,Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
  1271. {
  1272. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1273. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1274. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1275. typedef typename ::boost::mpl::push_back<
  1276. typename ::boost::mpl::push_back<
  1277. typename boost::result_of<BuildFlags(Configure)>::type,
  1278. ::boost::msm::InterruptedFlag>::type,
  1279. boost::msm::EndInterruptFlag<EndInterruptEvent>
  1280. >::type flags_type;
  1281. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  1282. return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
  1283. }
  1284. template <class StateNameTag,class Expr1,class Expr2,class Attr,class EndInterruptEvent>
  1285. inline
  1286. func_state<
  1287. StateNameTag,
  1288. typename ::boost::mpl::eval_if<
  1289. typename proto::matches<Expr1,ActionGrammar>::type,
  1290. boost::result_of<ActionGrammar(Expr1)>,
  1291. make_invalid_type>::type,
  1292. typename ::boost::mpl::eval_if<
  1293. typename proto::matches<Expr2,ActionGrammar>::type,
  1294. boost::result_of<ActionGrammar(Expr2)>,
  1295. make_invalid_type>::type,
  1296. typename boost::result_of<BuildAttributes(Attr)>::type,
  1297. ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> >
  1298. >
  1299. build_interrupt_state(EndInterruptEvent const&,Expr1 const& ,Expr2 const& ,Attr const&)
  1300. {
  1301. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1302. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1303. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1304. return func_state<StateNameTag,entry_action,exit_action,attributes_type,
  1305. ::boost::mpl::vector< boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> > >();
  1306. }
  1307. template <class StateNameTag,class Expr1,class Expr2,class EndInterruptEvent>
  1308. inline
  1309. func_state<
  1310. StateNameTag,
  1311. typename ::boost::mpl::eval_if<
  1312. typename proto::matches<Expr1,ActionGrammar>::type,
  1313. boost::result_of<ActionGrammar(Expr1)>,
  1314. make_invalid_type>::type,
  1315. typename ::boost::mpl::eval_if<
  1316. typename proto::matches<Expr2,ActionGrammar>::type,
  1317. boost::result_of<ActionGrammar(Expr2)>,
  1318. make_invalid_type>::type,
  1319. ::boost::fusion::vector<>,
  1320. ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> >
  1321. >
  1322. build_interrupt_state(EndInterruptEvent const&,Expr1 const& ,Expr2 const& )
  1323. {
  1324. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1325. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1326. return func_state<StateNameTag,entry_action,exit_action,
  1327. ::boost::fusion::vector<>,
  1328. ::boost::mpl::vector< boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> > >();
  1329. }
  1330. template <class StateNameTag,class Expr1,class EndInterruptEvent>
  1331. inline
  1332. func_state<
  1333. StateNameTag,
  1334. typename ::boost::mpl::eval_if<
  1335. typename proto::matches<Expr1,ActionGrammar>::type,
  1336. boost::result_of<ActionGrammar(Expr1)>,
  1337. make_invalid_type>::type,
  1338. NoAction,
  1339. ::boost::fusion::vector<>,
  1340. ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> >
  1341. >
  1342. build_interrupt_state(EndInterruptEvent const&, Expr1 const&)
  1343. {
  1344. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1345. return func_state<StateNameTag,entry_action,NoAction, ::boost::fusion::vector<>,
  1346. ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> > >();
  1347. }
  1348. template <class StateNameTag,class EndInterruptEvent>
  1349. inline
  1350. func_state<
  1351. StateNameTag,
  1352. NoAction,
  1353. NoAction,
  1354. ::boost::fusion::vector<>,
  1355. ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> >
  1356. >
  1357. build_interrupt_state(EndInterruptEvent const&)
  1358. {
  1359. return func_state<StateNameTag,NoAction,NoAction, ::boost::fusion::vector<>,
  1360. ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> > >();
  1361. }
  1362. template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure,class BASE>
  1363. inline
  1364. entry_func_state<
  1365. StateNameTag,
  1366. ZoneIndex,
  1367. typename ::boost::mpl::eval_if<
  1368. typename proto::matches<Expr1,ActionGrammar>::type,
  1369. boost::result_of<ActionGrammar(Expr1)>,
  1370. make_invalid_type>::type,
  1371. typename ::boost::mpl::eval_if<
  1372. typename proto::matches<Expr2,ActionGrammar>::type,
  1373. boost::result_of<ActionGrammar(Expr2)>,
  1374. make_invalid_type>::type,
  1375. typename boost::result_of<BuildAttributes(Attr)>::type,
  1376. typename boost::result_of<BuildFlags(Configure)>::type,
  1377. typename boost::result_of<BuildDeferred(Configure)>::type,
  1378. BASE
  1379. >
  1380. build_entry_state(Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
  1381. {
  1382. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1383. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1384. typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
  1385. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  1386. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1387. return entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
  1388. }
  1389. template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure>
  1390. inline
  1391. entry_func_state<
  1392. StateNameTag,
  1393. ZoneIndex,
  1394. typename ::boost::mpl::eval_if<
  1395. typename proto::matches<Expr1,ActionGrammar>::type,
  1396. boost::result_of<ActionGrammar(Expr1)>,
  1397. make_invalid_type>::type,
  1398. typename ::boost::mpl::eval_if<
  1399. typename proto::matches<Expr2,ActionGrammar>::type,
  1400. boost::result_of<ActionGrammar(Expr2)>,
  1401. make_invalid_type>::type,
  1402. typename boost::result_of<BuildAttributes(Attr)>::type,
  1403. typename boost::result_of<BuildFlags(Configure)>::type,
  1404. typename boost::result_of<BuildDeferred(Configure)>::type
  1405. >
  1406. build_entry_state(Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
  1407. {
  1408. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1409. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1410. typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
  1411. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  1412. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1413. return entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
  1414. }
  1415. template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr>
  1416. inline
  1417. entry_func_state<
  1418. StateNameTag,
  1419. ZoneIndex,
  1420. typename ::boost::mpl::eval_if<
  1421. typename proto::matches<Expr1,ActionGrammar>::type,
  1422. boost::result_of<ActionGrammar(Expr1)>,
  1423. make_invalid_type>::type,
  1424. typename ::boost::mpl::eval_if<
  1425. typename proto::matches<Expr2,ActionGrammar>::type,
  1426. boost::result_of<ActionGrammar(Expr2)>,
  1427. make_invalid_type>::type,
  1428. typename boost::result_of<BuildAttributes(Attr)>::type
  1429. >
  1430. build_entry_state(Expr1 const& ,Expr2 const& ,Attr const&)
  1431. {
  1432. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1433. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1434. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1435. return entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type>();
  1436. }
  1437. template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2>
  1438. inline
  1439. entry_func_state<
  1440. StateNameTag,
  1441. ZoneIndex,
  1442. typename ::boost::mpl::eval_if<
  1443. typename proto::matches<Expr1,ActionGrammar>::type,
  1444. boost::result_of<ActionGrammar(Expr1)>,
  1445. make_invalid_type>::type,
  1446. typename ::boost::mpl::eval_if<
  1447. typename proto::matches<Expr2,ActionGrammar>::type,
  1448. boost::result_of<ActionGrammar(Expr2)>,
  1449. make_invalid_type>::type
  1450. >
  1451. build_entry_state(Expr1 const& ,Expr2 const& )
  1452. {
  1453. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1454. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1455. return entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action>();
  1456. }
  1457. template <class StateNameTag,int ZoneIndex,class Expr1>
  1458. inline
  1459. entry_func_state<
  1460. StateNameTag,
  1461. ZoneIndex,
  1462. typename ::boost::mpl::eval_if<
  1463. typename proto::matches<Expr1,ActionGrammar>::type,
  1464. boost::result_of<ActionGrammar(Expr1)>,
  1465. make_invalid_type>::type,
  1466. NoAction
  1467. >
  1468. build_entry_state(Expr1 const& )
  1469. {
  1470. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1471. return entry_func_state<StateNameTag,ZoneIndex,entry_action,NoAction>();
  1472. }
  1473. template <class StateNameTag,int ZoneIndex>
  1474. inline
  1475. entry_func_state<
  1476. StateNameTag,
  1477. ZoneIndex,
  1478. NoAction,
  1479. NoAction
  1480. >
  1481. build_entry_state()
  1482. {
  1483. return entry_func_state<StateNameTag,ZoneIndex,NoAction,NoAction>();
  1484. }
  1485. template <class StateNameTag,class Event,class Expr1,class Expr2,class Attr,class Configure,class BASE>
  1486. inline
  1487. exit_func_state<
  1488. StateNameTag,
  1489. Event,
  1490. typename ::boost::mpl::eval_if<
  1491. typename proto::matches<Expr1,ActionGrammar>::type,
  1492. boost::result_of<ActionGrammar(Expr1)>,
  1493. make_invalid_type>::type,
  1494. typename ::boost::mpl::eval_if<
  1495. typename proto::matches<Expr2,ActionGrammar>::type,
  1496. boost::result_of<ActionGrammar(Expr2)>,
  1497. make_invalid_type>::type,
  1498. typename boost::result_of<BuildAttributes(Attr)>::type,
  1499. typename boost::result_of<BuildFlags(Configure)>::type,
  1500. typename boost::result_of<BuildDeferred(Configure)>::type,
  1501. BASE
  1502. >
  1503. build_exit_state(Event const&,Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
  1504. {
  1505. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1506. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1507. typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
  1508. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  1509. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1510. return exit_func_state<StateNameTag,Event,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
  1511. }
  1512. template <class StateNameTag,class Event,class Expr1,class Expr2,class Attr,class Configure>
  1513. inline
  1514. exit_func_state<
  1515. StateNameTag,
  1516. Event,
  1517. typename ::boost::mpl::eval_if<
  1518. typename proto::matches<Expr1,ActionGrammar>::type,
  1519. boost::result_of<ActionGrammar(Expr1)>,
  1520. make_invalid_type>::type,
  1521. typename ::boost::mpl::eval_if<
  1522. typename proto::matches<Expr2,ActionGrammar>::type,
  1523. boost::result_of<ActionGrammar(Expr2)>,
  1524. make_invalid_type>::type,
  1525. typename boost::result_of<BuildAttributes(Attr)>::type,
  1526. typename boost::result_of<BuildFlags(Configure)>::type,
  1527. typename boost::result_of<BuildDeferred(Configure)>::type
  1528. >
  1529. build_exit_state(Event const&,Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
  1530. {
  1531. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1532. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1533. typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
  1534. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  1535. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1536. return exit_func_state<StateNameTag,Event,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
  1537. }
  1538. template <class StateNameTag,class Event,class Expr1,class Expr2,class Attr>
  1539. inline
  1540. exit_func_state<
  1541. StateNameTag,
  1542. Event,
  1543. typename ::boost::mpl::eval_if<
  1544. typename proto::matches<Expr1,ActionGrammar>::type,
  1545. boost::result_of<ActionGrammar(Expr1)>,
  1546. make_invalid_type>::type,
  1547. typename ::boost::mpl::eval_if<
  1548. typename proto::matches<Expr2,ActionGrammar>::type,
  1549. boost::result_of<ActionGrammar(Expr2)>,
  1550. make_invalid_type>::type,
  1551. typename boost::result_of<BuildAttributes(Attr)>::type
  1552. >
  1553. build_exit_state(Event const&,Expr1 const& ,Expr2 const& ,Attr const&)
  1554. {
  1555. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1556. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1557. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1558. return exit_func_state<StateNameTag,Event,entry_action,exit_action,attributes_type>();
  1559. }
  1560. template <class StateNameTag,class Event,class Expr1,class Expr2>
  1561. inline
  1562. exit_func_state<
  1563. StateNameTag,
  1564. Event,
  1565. typename ::boost::mpl::eval_if<
  1566. typename proto::matches<Expr1,ActionGrammar>::type,
  1567. boost::result_of<ActionGrammar(Expr1)>,
  1568. make_invalid_type>::type,
  1569. typename ::boost::mpl::eval_if<
  1570. typename proto::matches<Expr2,ActionGrammar>::type,
  1571. boost::result_of<ActionGrammar(Expr2)>,
  1572. make_invalid_type>::type
  1573. >
  1574. build_exit_state(Event const&,Expr1 const& ,Expr2 const& )
  1575. {
  1576. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1577. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1578. return exit_func_state<StateNameTag,Event,entry_action,exit_action>();
  1579. }
  1580. template <class StateNameTag,class Event,class Expr1>
  1581. inline
  1582. exit_func_state<
  1583. StateNameTag,
  1584. Event,
  1585. typename ::boost::mpl::eval_if<
  1586. typename proto::matches<Expr1,ActionGrammar>::type,
  1587. boost::result_of<ActionGrammar(Expr1)>,
  1588. make_invalid_type>::type,
  1589. NoAction
  1590. >
  1591. build_exit_state(Event const&, Expr1 const& )
  1592. {
  1593. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1594. return exit_func_state<StateNameTag,Event,entry_action,NoAction>();
  1595. }
  1596. template <class StateNameTag,class Event>
  1597. inline
  1598. exit_func_state<
  1599. StateNameTag,
  1600. Event,
  1601. NoAction,
  1602. NoAction
  1603. >
  1604. build_exit_state(Event const&)
  1605. {
  1606. return exit_func_state<StateNameTag,Event,NoAction,NoAction>();
  1607. }
  1608. template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure,class BASE>
  1609. inline
  1610. explicit_entry_func_state<
  1611. StateNameTag,
  1612. ZoneIndex,
  1613. typename ::boost::mpl::eval_if<
  1614. typename proto::matches<Expr1,ActionGrammar>::type,
  1615. boost::result_of<ActionGrammar(Expr1)>,
  1616. make_invalid_type>::type,
  1617. typename ::boost::mpl::eval_if<
  1618. typename proto::matches<Expr2,ActionGrammar>::type,
  1619. boost::result_of<ActionGrammar(Expr2)>,
  1620. make_invalid_type>::type,
  1621. typename boost::result_of<BuildAttributes(Attr)>::type,
  1622. typename boost::result_of<BuildFlags(Configure)>::type,
  1623. typename boost::result_of<BuildDeferred(Configure)>::type,
  1624. BASE
  1625. >
  1626. build_explicit_entry_state(Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
  1627. {
  1628. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1629. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1630. typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
  1631. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  1632. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1633. return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
  1634. }
  1635. template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure>
  1636. inline
  1637. explicit_entry_func_state<
  1638. StateNameTag,
  1639. ZoneIndex,
  1640. typename ::boost::mpl::eval_if<
  1641. typename proto::matches<Expr1,ActionGrammar>::type,
  1642. boost::result_of<ActionGrammar(Expr1)>,
  1643. make_invalid_type>::type,
  1644. typename ::boost::mpl::eval_if<
  1645. typename proto::matches<Expr2,ActionGrammar>::type,
  1646. boost::result_of<ActionGrammar(Expr2)>,
  1647. make_invalid_type>::type,
  1648. typename boost::result_of<BuildAttributes(Attr)>::type,
  1649. typename boost::result_of<BuildFlags(Configure)>::type,
  1650. typename boost::result_of<BuildDeferred(Configure)>::type
  1651. >
  1652. build_explicit_entry_state(Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
  1653. {
  1654. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1655. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1656. typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
  1657. typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
  1658. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1659. return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
  1660. }
  1661. template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr>
  1662. inline
  1663. explicit_entry_func_state<
  1664. StateNameTag,
  1665. ZoneIndex,
  1666. typename ::boost::mpl::eval_if<
  1667. typename proto::matches<Expr1,ActionGrammar>::type,
  1668. boost::result_of<ActionGrammar(Expr1)>,
  1669. make_invalid_type>::type,
  1670. typename ::boost::mpl::eval_if<
  1671. typename proto::matches<Expr2,ActionGrammar>::type,
  1672. boost::result_of<ActionGrammar(Expr2)>,
  1673. make_invalid_type>::type,
  1674. typename boost::result_of<BuildAttributes(Attr)>::type
  1675. >
  1676. build_explicit_entry_state(Expr1 const& ,Expr2 const& ,Attr const&)
  1677. {
  1678. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1679. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1680. typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
  1681. return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type>();
  1682. }
  1683. template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2>
  1684. inline
  1685. explicit_entry_func_state<
  1686. StateNameTag,
  1687. ZoneIndex,
  1688. typename ::boost::mpl::eval_if<
  1689. typename proto::matches<Expr1,ActionGrammar>::type,
  1690. boost::result_of<ActionGrammar(Expr1)>,
  1691. make_invalid_type>::type,
  1692. typename ::boost::mpl::eval_if<
  1693. typename proto::matches<Expr2,ActionGrammar>::type,
  1694. boost::result_of<ActionGrammar(Expr2)>,
  1695. make_invalid_type>::type
  1696. >
  1697. build_explicit_entry_state(Expr1 const& ,Expr2 const& )
  1698. {
  1699. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1700. typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
  1701. return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action>();
  1702. }
  1703. template <class StateNameTag,int ZoneIndex,class Expr1>
  1704. inline
  1705. explicit_entry_func_state<
  1706. StateNameTag,
  1707. ZoneIndex,
  1708. typename ::boost::mpl::eval_if<
  1709. typename proto::matches<Expr1,ActionGrammar>::type,
  1710. boost::result_of<ActionGrammar(Expr1)>,
  1711. make_invalid_type>::type,
  1712. NoAction
  1713. >
  1714. build_explicit_entry_state(Expr1 const& )
  1715. {
  1716. typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
  1717. return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,NoAction>();
  1718. }
  1719. template <class StateNameTag,int ZoneIndex>
  1720. inline
  1721. explicit_entry_func_state<
  1722. StateNameTag,
  1723. ZoneIndex,
  1724. NoAction,
  1725. NoAction
  1726. >
  1727. build_explicit_entry_state()
  1728. {
  1729. return explicit_entry_func_state<StateNameTag,ZoneIndex,NoAction,NoAction>();
  1730. }
  1731. }}}}
  1732. #endif //BOOST_MSM_FRONT_EUML_STATE_GRAMMAR_H