/Src/Dependencies/Boost/boost/msm/front/euml/container.hpp

http://hadesmem.googlecode.com/ · C++ Header · 4068 lines · 3829 code · 209 blank · 30 comment · 0 complexity · 928ae93525be5a40a884f3c64c405476 MD5 · raw file

Large files are truncated click here to view the full file

  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_CONTAINER_H
  11. #define BOOST_MSM_FRONT_EUML_CONTAINER_H
  12. #include <utility>
  13. #include <boost/msm/front/euml/common.hpp>
  14. #include <boost/utility/enable_if.hpp>
  15. #include <boost/mpl/has_key.hpp>
  16. #include <boost/mpl/set.hpp>
  17. #include <boost/mpl/not.hpp>
  18. #include <boost/msm/front/euml/operator.hpp>
  19. #include <boost/type_traits.hpp>
  20. BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category)
  21. namespace boost { namespace msm { namespace front { namespace euml
  22. {
  23. template <class T>
  24. struct Front_ : euml_action<Front_<T> >
  25. {
  26. template <class Event,class FSM,class STATE >
  27. struct state_action_result
  28. {
  29. typedef typename get_reference<
  30. typename ::boost::remove_reference<
  31. typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
  32. };
  33. template <class EVT,class FSM,class SourceState,class TargetState>
  34. struct transition_action_result
  35. {
  36. typedef typename get_reference<
  37. typename ::boost::remove_reference<
  38. typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
  39. };
  40. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  41. template <class EVT,class FSM,class SourceState,class TargetState>
  42. typename ::boost::enable_if<
  43. typename ::boost::mpl::has_key<
  44. typename T::tag_type,action_tag>::type,
  45. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
  46. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  47. {
  48. return (T()(evt,fsm,src,tgt)).front();
  49. }
  50. template <class Event,class FSM,class STATE>
  51. typename ::boost::enable_if<
  52. typename ::boost::mpl::has_key<
  53. typename T::tag_type,state_action_tag>::type,
  54. typename state_action_result<Event,FSM,STATE>::type >::type
  55. operator()(Event const& evt,FSM& fsm,STATE& state )const
  56. {
  57. return (T()(evt,fsm,state)).front();
  58. }
  59. };
  60. struct front_tag {};
  61. struct Front_Helper: proto::extends< proto::terminal<front_tag>::type, Front_Helper, sm_domain>
  62. {
  63. Front_Helper(){}
  64. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  65. #ifdef BOOST_MSVC
  66. ,class Arg6
  67. #endif
  68. >
  69. struct In
  70. {
  71. typedef Front_<Arg1> type;
  72. };
  73. };
  74. Front_Helper const front_;
  75. template <class T>
  76. struct Back_ : euml_action<Back_<T> >
  77. {
  78. template <class Event,class FSM,class STATE >
  79. struct state_action_result
  80. {
  81. typedef typename get_reference<
  82. typename ::boost::remove_reference<
  83. typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
  84. };
  85. template <class EVT,class FSM,class SourceState,class TargetState>
  86. struct transition_action_result
  87. {
  88. typedef typename get_reference<
  89. typename ::boost::remove_reference<
  90. typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
  91. };
  92. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  93. template <class EVT,class FSM,class SourceState,class TargetState>
  94. typename ::boost::enable_if<
  95. typename ::boost::mpl::has_key<
  96. typename T::tag_type,action_tag>::type,
  97. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
  98. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  99. {
  100. return (T()(evt,fsm,src,tgt)).back();
  101. }
  102. template <class Event,class FSM,class STATE>
  103. typename ::boost::enable_if<
  104. typename ::boost::mpl::has_key<
  105. typename T::tag_type,state_action_tag>::type,
  106. typename state_action_result<Event,FSM,STATE>::type >::type
  107. operator()(Event const& evt,FSM& fsm,STATE& state )const
  108. {
  109. return (T()(evt,fsm,state)).back();
  110. }
  111. };
  112. struct back_tag {};
  113. struct Back_Helper: proto::extends< proto::terminal<back_tag>::type, Back_Helper, sm_domain>
  114. {
  115. Back_Helper(){}
  116. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  117. #ifdef BOOST_MSVC
  118. ,class Arg6
  119. #endif
  120. >
  121. struct In
  122. {
  123. typedef Back_<Arg1> type;
  124. };
  125. };
  126. Back_Helper const back_;
  127. template <class T>
  128. struct Begin_ : euml_action<Begin_<T> >
  129. {
  130. template <class Event,class FSM,class STATE >
  131. struct state_action_result
  132. {
  133. typedef typename get_iterator<
  134. typename ::boost::remove_reference<
  135. typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
  136. };
  137. template <class EVT,class FSM,class SourceState,class TargetState>
  138. struct transition_action_result
  139. {
  140. typedef typename get_iterator<
  141. typename ::boost::remove_reference<
  142. typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
  143. };
  144. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  145. template <class EVT,class FSM,class SourceState,class TargetState>
  146. typename ::boost::enable_if<
  147. typename ::boost::mpl::has_key<
  148. typename T::tag_type,action_tag>::type,
  149. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
  150. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  151. {
  152. return (T()(evt,fsm,src,tgt)).begin();
  153. }
  154. template <class Event,class FSM,class STATE>
  155. typename ::boost::enable_if<
  156. typename ::boost::mpl::has_key<
  157. typename T::tag_type,state_action_tag>::type,
  158. typename state_action_result<Event,FSM,STATE>::type >::type
  159. operator()(Event const& evt,FSM& fsm,STATE& state )const
  160. {
  161. return (T()(evt,fsm,state)).begin();
  162. }
  163. };
  164. struct begin_tag {};
  165. struct Begin_Helper: proto::extends< proto::terminal<begin_tag>::type, Begin_Helper, sm_domain>
  166. {
  167. Begin_Helper(){}
  168. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  169. #ifdef BOOST_MSVC
  170. ,class Arg6
  171. #endif
  172. >
  173. struct In
  174. {
  175. typedef Begin_<Arg1> type;
  176. };
  177. };
  178. Begin_Helper const begin_;
  179. template <class T>
  180. struct End_ : euml_action<End_<T> >
  181. {
  182. template <class Event,class FSM,class STATE >
  183. struct state_action_result
  184. {
  185. typedef typename get_iterator<
  186. typename ::boost::remove_reference<
  187. typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
  188. };
  189. template <class EVT,class FSM,class SourceState,class TargetState>
  190. struct transition_action_result
  191. {
  192. typedef typename get_iterator<
  193. typename ::boost::remove_reference<
  194. typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
  195. };
  196. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  197. template <class EVT,class FSM,class SourceState,class TargetState>
  198. typename ::boost::enable_if<
  199. typename ::boost::mpl::has_key<
  200. typename T::tag_type,action_tag>::type,
  201. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
  202. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  203. {
  204. return (T()(evt,fsm,src,tgt)).end();
  205. }
  206. template <class Event,class FSM,class STATE>
  207. typename ::boost::enable_if<
  208. typename ::boost::mpl::has_key<
  209. typename T::tag_type,state_action_tag>::type,
  210. typename state_action_result<Event,FSM,STATE>::type >::type
  211. operator()(Event const& evt,FSM& fsm,STATE& state )const
  212. {
  213. return (T()(evt,fsm,state)).end();
  214. }
  215. };
  216. struct end_tag {};
  217. struct End_Helper: proto::extends< proto::terminal<end_tag>::type, End_Helper, sm_domain>
  218. {
  219. End_Helper(){}
  220. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  221. #ifdef BOOST_MSVC
  222. ,class Arg6
  223. #endif
  224. >
  225. struct In
  226. {
  227. typedef End_<Arg1> type;
  228. };
  229. };
  230. End_Helper const end_;
  231. template <class T>
  232. struct RBegin_ : euml_action<RBegin_<T> >
  233. {
  234. template <class Event,class FSM,class STATE >
  235. struct state_action_result
  236. {
  237. typedef typename get_reverse_iterator<
  238. typename ::boost::remove_reference<
  239. typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
  240. };
  241. template <class EVT,class FSM,class SourceState,class TargetState>
  242. struct transition_action_result
  243. {
  244. typedef typename get_reverse_iterator<
  245. typename ::boost::remove_reference<
  246. typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
  247. };
  248. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  249. template <class EVT,class FSM,class SourceState,class TargetState>
  250. typename ::boost::enable_if<
  251. typename ::boost::mpl::has_key<
  252. typename T::tag_type,action_tag>::type,
  253. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
  254. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  255. {
  256. return (T()(evt,fsm,src,tgt)).rbegin();
  257. }
  258. template <class Event,class FSM,class STATE>
  259. typename ::boost::enable_if<
  260. typename ::boost::mpl::has_key<
  261. typename T::tag_type,state_action_tag>::type,
  262. typename state_action_result<Event,FSM,STATE>::type >::type
  263. operator()(Event const& evt,FSM& fsm,STATE& state )const
  264. {
  265. return (T()(evt,fsm,state)).rbegin();
  266. }
  267. };
  268. struct rbegin_tag {};
  269. struct RBegin_Helper: proto::extends< proto::terminal<rbegin_tag>::type, RBegin_Helper, sm_domain>
  270. {
  271. RBegin_Helper(){}
  272. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  273. #ifdef BOOST_MSVC
  274. ,class Arg6
  275. #endif
  276. >
  277. struct In
  278. {
  279. typedef RBegin_<Arg1> type;
  280. };
  281. };
  282. RBegin_Helper const rbegin_;
  283. template <class T>
  284. struct REnd_ : euml_action<REnd_<T> >
  285. {
  286. template <class Event,class FSM,class STATE >
  287. struct state_action_result
  288. {
  289. typedef typename get_reverse_iterator<
  290. typename ::boost::remove_reference<
  291. typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
  292. };
  293. template <class EVT,class FSM,class SourceState,class TargetState>
  294. struct transition_action_result
  295. {
  296. typedef typename get_reverse_iterator<
  297. typename ::boost::remove_reference<
  298. typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
  299. };
  300. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  301. template <class EVT,class FSM,class SourceState,class TargetState>
  302. typename ::boost::enable_if<
  303. typename ::boost::mpl::has_key<
  304. typename T::tag_type,action_tag>::type,
  305. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
  306. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  307. {
  308. return (T()(evt,fsm,src,tgt)).rend();
  309. }
  310. template <class Event,class FSM,class STATE>
  311. typename ::boost::enable_if<
  312. typename ::boost::mpl::has_key<
  313. typename T::tag_type,state_action_tag>::type,
  314. typename state_action_result<Event,FSM,STATE>::type >::type
  315. operator()(Event const& evt,FSM& fsm,STATE& state )const
  316. {
  317. return (T()(evt,fsm,state)).rend();
  318. }
  319. };
  320. struct rend_tag {};
  321. struct REnd_Helper: proto::extends< proto::terminal<rend_tag>::type, REnd_Helper, sm_domain>
  322. {
  323. REnd_Helper(){}
  324. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  325. #ifdef BOOST_MSVC
  326. ,class Arg6
  327. #endif
  328. >
  329. struct In
  330. {
  331. typedef REnd_<Arg1> type;
  332. };
  333. };
  334. REnd_Helper const rend_;
  335. template <class Container,class Element>
  336. struct Push_Back_ : euml_action<Push_Back_<Container,Element> >
  337. {
  338. template <class Event,class FSM,class STATE >
  339. struct state_action_result
  340. {
  341. typedef void type;
  342. };
  343. template <class EVT,class FSM,class SourceState,class TargetState>
  344. struct transition_action_result
  345. {
  346. typedef void type;
  347. };
  348. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  349. template <class EVT,class FSM,class SourceState,class TargetState>
  350. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  351. {
  352. (Container()(evt,fsm,src,tgt)).push_back(Element()(evt,fsm,src,tgt));
  353. }
  354. template <class Event,class FSM,class STATE>
  355. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  356. {
  357. (Container()(evt,fsm,state)).push_back(Element()(evt,fsm,state));
  358. }
  359. };
  360. struct push_back_tag {};
  361. struct Push_Back_Helper: proto::extends< proto::terminal<push_back_tag>::type, Push_Back_Helper, sm_domain>
  362. {
  363. Push_Back_Helper(){}
  364. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  365. #ifdef BOOST_MSVC
  366. ,class Arg6
  367. #endif
  368. >
  369. struct In
  370. {
  371. typedef Push_Back_<Arg1,Arg2> type;
  372. };
  373. };
  374. Push_Back_Helper const push_back_;
  375. template <class Container>
  376. struct Pop_Back_ : euml_action<Pop_Back_<Container> >
  377. {
  378. template <class Event,class FSM,class STATE >
  379. struct state_action_result
  380. {
  381. typedef void type;
  382. };
  383. template <class EVT,class FSM,class SourceState,class TargetState>
  384. struct transition_action_result
  385. {
  386. typedef void type;
  387. };
  388. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  389. template <class EVT,class FSM,class SourceState,class TargetState>
  390. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  391. {
  392. (Container()(evt,fsm,src,tgt)).pop_back();
  393. }
  394. template <class Event,class FSM,class STATE>
  395. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  396. {
  397. (Container()(evt,fsm,state)).pop_back();
  398. }
  399. };
  400. struct pop_back_tag {};
  401. struct Pop_Back_Helper: proto::extends< proto::terminal<pop_back_tag>::type, Pop_Back_Helper, sm_domain>
  402. {
  403. Pop_Back_Helper(){}
  404. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  405. #ifdef BOOST_MSVC
  406. ,class Arg6
  407. #endif
  408. >
  409. struct In
  410. {
  411. typedef Pop_Back_<Arg1> type;
  412. };
  413. };
  414. Pop_Back_Helper const pop_back_;
  415. template <class Container,class Element>
  416. struct Push_Front_ : euml_action<Push_Front_<Container,Element> >
  417. {
  418. template <class Event,class FSM,class STATE >
  419. struct state_action_result
  420. {
  421. typedef void type;
  422. };
  423. template <class EVT,class FSM,class SourceState,class TargetState>
  424. struct transition_action_result
  425. {
  426. typedef void type;
  427. };
  428. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  429. template <class EVT,class FSM,class SourceState,class TargetState>
  430. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  431. {
  432. (Container()(evt,fsm,src,tgt)).push_front(Element()(evt,fsm,src,tgt));
  433. }
  434. template <class Event,class FSM,class STATE>
  435. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  436. {
  437. (Container()(evt,fsm,state)).push_front(Element()(evt,fsm,state));
  438. }
  439. };
  440. struct push_front_tag {};
  441. struct Push_Front_Helper: proto::extends< proto::terminal<push_front_tag>::type, Push_Front_Helper, sm_domain>
  442. {
  443. Push_Front_Helper(){}
  444. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  445. #ifdef BOOST_MSVC
  446. ,class Arg6
  447. #endif
  448. >
  449. struct In
  450. {
  451. typedef Push_Front_<Arg1,Arg2> type;
  452. };
  453. };
  454. Push_Front_Helper const push_front_;
  455. template <class Container>
  456. struct Pop_Front_ : euml_action<Pop_Front_<Container> >
  457. {
  458. template <class Event,class FSM,class STATE >
  459. struct state_action_result
  460. {
  461. typedef void type;
  462. };
  463. template <class EVT,class FSM,class SourceState,class TargetState>
  464. struct transition_action_result
  465. {
  466. typedef void type;
  467. };
  468. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  469. template <class EVT,class FSM,class SourceState,class TargetState>
  470. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  471. {
  472. (Container()(evt,fsm,src,tgt)).pop_front();
  473. }
  474. template <class Event,class FSM,class STATE>
  475. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  476. {
  477. (Container()(evt,fsm,state)).pop_front();
  478. }
  479. };
  480. struct pop_front_tag {};
  481. struct Pop_Front_Helper: proto::extends< proto::terminal<pop_front_tag>::type, Pop_Front_Helper, sm_domain>
  482. {
  483. Pop_Front_Helper(){}
  484. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  485. #ifdef BOOST_MSVC
  486. ,class Arg6
  487. #endif
  488. >
  489. struct In
  490. {
  491. typedef Pop_Front_<Arg1> type;
  492. };
  493. };
  494. Pop_Front_Helper const pop_front_;
  495. template <class Container>
  496. struct Clear_ : euml_action<Clear_<Container> >
  497. {
  498. template <class Event,class FSM,class STATE >
  499. struct state_action_result
  500. {
  501. typedef void type;
  502. };
  503. template <class EVT,class FSM,class SourceState,class TargetState>
  504. struct transition_action_result
  505. {
  506. typedef void type;
  507. };
  508. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  509. template <class EVT,class FSM,class SourceState,class TargetState>
  510. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  511. {
  512. (Container()(evt,fsm,src,tgt)).clear();
  513. }
  514. template <class Event,class FSM,class STATE>
  515. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  516. {
  517. (Container()(evt,fsm,state)).clear();
  518. }
  519. };
  520. struct clear_tag {};
  521. struct Clear_Helper: proto::extends< proto::terminal<clear_tag>::type, Clear_Helper, sm_domain>
  522. {
  523. Clear_Helper(){}
  524. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  525. #ifdef BOOST_MSVC
  526. ,class Arg6
  527. #endif
  528. >
  529. struct In
  530. {
  531. typedef Clear_<Arg1> type;
  532. };
  533. };
  534. Clear_Helper const clear_;
  535. template <class Container>
  536. struct ListReverse_ : euml_action<ListReverse_<Container> >
  537. {
  538. template <class Event,class FSM,class STATE >
  539. struct state_action_result
  540. {
  541. typedef void type;
  542. };
  543. template <class EVT,class FSM,class SourceState,class TargetState>
  544. struct transition_action_result
  545. {
  546. typedef void type;
  547. };
  548. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  549. template <class EVT,class FSM,class SourceState,class TargetState>
  550. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  551. {
  552. (Container()(evt,fsm,src,tgt)).reverse();
  553. }
  554. template <class Event,class FSM,class STATE>
  555. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  556. {
  557. (Container()(evt,fsm,state)).reverse();
  558. }
  559. };
  560. struct list_reverse_tag {};
  561. struct ListReverse_Helper: proto::extends< proto::terminal<list_reverse_tag>::type, ListReverse_Helper, sm_domain>
  562. {
  563. ListReverse_Helper(){}
  564. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  565. #ifdef BOOST_MSVC
  566. ,class Arg6
  567. #endif
  568. >
  569. struct In
  570. {
  571. typedef ListReverse_<Arg1> type;
  572. };
  573. };
  574. ListReverse_Helper const list_reverse_;
  575. template <class Container, class Predicate, class Enable=void>
  576. struct ListUnique_ : euml_action<ListUnique_<Container,Predicate,Enable> >
  577. {
  578. template <class Event,class FSM,class STATE >
  579. struct state_action_result
  580. {
  581. typedef void type;
  582. };
  583. template <class EVT,class FSM,class SourceState,class TargetState>
  584. struct transition_action_result
  585. {
  586. typedef void type;
  587. };
  588. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  589. template <class EVT,class FSM,class SourceState,class TargetState>
  590. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  591. {
  592. (Container()(evt,fsm,src,tgt)).unique();
  593. }
  594. template <class Event,class FSM,class STATE>
  595. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  596. {
  597. (Container()(evt,fsm,state)).unique();
  598. }
  599. };
  600. template <class Container, class Predicate >
  601. struct ListUnique_<Container,Predicate,
  602. typename ::boost::disable_if<typename ::boost::is_same<Predicate,void>::type >::type>
  603. : euml_action<ListUnique_<Container,Predicate> >
  604. {
  605. template <class Event,class FSM,class STATE >
  606. struct state_action_result
  607. {
  608. typedef void type;
  609. };
  610. template <class EVT,class FSM,class SourceState,class TargetState>
  611. struct transition_action_result
  612. {
  613. typedef void type;
  614. };
  615. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  616. template <class EVT,class FSM,class SourceState,class TargetState>
  617. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  618. {
  619. (Container()(evt,fsm,src,tgt)).unique(Predicate()(evt,fsm,src,tgt));
  620. }
  621. template <class Event,class FSM,class STATE>
  622. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  623. {
  624. (Container()(evt,fsm,state)).unique(Predicate()(evt,fsm,state));
  625. }
  626. };
  627. struct list_unique_tag {};
  628. struct ListUnique_Helper: proto::extends< proto::terminal<list_unique_tag>::type, ListUnique_Helper, sm_domain>
  629. {
  630. ListUnique_Helper(){}
  631. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  632. #ifdef BOOST_MSVC
  633. ,class Arg6
  634. #endif
  635. >
  636. struct In
  637. {
  638. typedef ListUnique_<Arg1,Arg2> type;
  639. };
  640. };
  641. ListUnique_Helper const list_unique_;
  642. template <class Container, class Predicate, class Enable=void>
  643. struct ListSort_ : euml_action<ListSort_<Container,Predicate,Enable> >
  644. {
  645. template <class Event,class FSM,class STATE >
  646. struct state_action_result
  647. {
  648. typedef void type;
  649. };
  650. template <class EVT,class FSM,class SourceState,class TargetState>
  651. struct transition_action_result
  652. {
  653. typedef void type;
  654. };
  655. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  656. template <class EVT,class FSM,class SourceState,class TargetState>
  657. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  658. {
  659. (Container()(evt,fsm,src,tgt)).sort();
  660. }
  661. template <class Event,class FSM,class STATE>
  662. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  663. {
  664. (Container()(evt,fsm,state)).sort();
  665. }
  666. };
  667. template <class Container, class Predicate >
  668. struct ListSort_<Container,Predicate,
  669. typename ::boost::disable_if<typename ::boost::is_same<Predicate,void>::type >::type>
  670. : euml_action<ListSort_<Container,Predicate> >
  671. {
  672. template <class Event,class FSM,class STATE >
  673. struct state_action_result
  674. {
  675. typedef void type;
  676. };
  677. template <class EVT,class FSM,class SourceState,class TargetState>
  678. struct transition_action_result
  679. {
  680. typedef void type;
  681. };
  682. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  683. template <class EVT,class FSM,class SourceState,class TargetState>
  684. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  685. {
  686. (Container()(evt,fsm,src,tgt)).sort(Predicate()(evt,fsm,src,tgt));
  687. }
  688. template <class Event,class FSM,class STATE>
  689. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  690. {
  691. (Container()(evt,fsm,state)).sort(Predicate()(evt,fsm,state));
  692. }
  693. };
  694. struct list_sort_tag {};
  695. struct ListSort_Helper: proto::extends< proto::terminal<list_sort_tag>::type, ListSort_Helper, sm_domain>
  696. {
  697. ListSort_Helper(){}
  698. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  699. #ifdef BOOST_MSVC
  700. ,class Arg6
  701. #endif
  702. >
  703. struct In
  704. {
  705. typedef ListSort_<Arg1,Arg2> type;
  706. };
  707. };
  708. ListSort_Helper const list_sort_;
  709. template <class Container>
  710. struct Capacity_ : euml_action<Capacity_<Container> >
  711. {
  712. template <class Event,class FSM,class STATE >
  713. struct state_action_result
  714. {
  715. typedef typename get_size_type<
  716. typename ::boost::remove_reference<
  717. typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type type;
  718. };
  719. template <class EVT,class FSM,class SourceState,class TargetState>
  720. struct transition_action_result
  721. {
  722. typedef typename get_size_type<
  723. typename ::boost::remove_reference<
  724. typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
  725. };
  726. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  727. template <class EVT,class FSM,class SourceState,class TargetState>
  728. typename ::boost::enable_if<
  729. typename ::boost::mpl::has_key<
  730. typename Container::tag_type,action_tag>::type,
  731. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
  732. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  733. {
  734. return (Container()(evt,fsm,src,tgt)).capacity();
  735. }
  736. template <class Event,class FSM,class STATE>
  737. typename ::boost::enable_if<
  738. typename ::boost::mpl::has_key<
  739. typename Container::tag_type,state_action_tag>::type,
  740. typename state_action_result<Event,FSM,STATE>::type >::type
  741. operator()(Event const& evt,FSM& fsm,STATE& state )const
  742. {
  743. return (Container()(evt,fsm,state)).capacity();
  744. }
  745. };
  746. struct capacity_tag {};
  747. struct Capacity_Helper: proto::extends< proto::terminal<capacity_tag>::type, Capacity_Helper, sm_domain>
  748. {
  749. Capacity_Helper(){}
  750. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  751. #ifdef BOOST_MSVC
  752. ,class Arg6
  753. #endif
  754. >
  755. struct In
  756. {
  757. typedef Capacity_<Arg1> type;
  758. };
  759. };
  760. Capacity_Helper const capacity_;
  761. template <class Container>
  762. struct Size_ : euml_action<Size_<Container> >
  763. {
  764. template <class Event,class FSM,class STATE >
  765. struct state_action_result
  766. {
  767. typedef typename get_size_type<
  768. typename ::boost::remove_reference<
  769. typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type type;
  770. };
  771. template <class EVT,class FSM,class SourceState,class TargetState>
  772. struct transition_action_result
  773. {
  774. typedef typename get_size_type<
  775. typename ::boost::remove_reference<
  776. typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
  777. };
  778. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  779. template <class EVT,class FSM,class SourceState,class TargetState>
  780. typename ::boost::enable_if<
  781. typename ::boost::mpl::has_key<
  782. typename Container::tag_type,action_tag>::type,
  783. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
  784. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  785. {
  786. return (Container()(evt,fsm,src,tgt)).size();
  787. }
  788. template <class Event,class FSM,class STATE>
  789. typename ::boost::enable_if<
  790. typename ::boost::mpl::has_key<
  791. typename Container::tag_type,state_action_tag>::type,
  792. typename state_action_result<Event,FSM,STATE>::type >::type
  793. operator()(Event const& evt,FSM& fsm,STATE& state )const
  794. {
  795. return (Container()(evt,fsm,state)).size();
  796. }
  797. };
  798. struct size_tag {};
  799. struct Size_Helper: proto::extends< proto::terminal<size_tag>::type, Size_Helper, sm_domain>
  800. {
  801. Size_Helper(){}
  802. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  803. #ifdef BOOST_MSVC
  804. ,class Arg6
  805. #endif
  806. >
  807. struct In
  808. {
  809. typedef Size_<Arg1> type;
  810. };
  811. };
  812. Size_Helper const size_;
  813. template <class Container>
  814. struct Max_Size_ : euml_action<Max_Size_<Container> >
  815. {
  816. template <class Event,class FSM,class STATE >
  817. struct state_action_result
  818. {
  819. typedef typename get_size_type<
  820. typename ::boost::remove_reference<
  821. typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type type;
  822. };
  823. template <class EVT,class FSM,class SourceState,class TargetState>
  824. struct transition_action_result
  825. {
  826. typedef typename get_size_type<
  827. typename ::boost::remove_reference<
  828. typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
  829. };
  830. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  831. template <class EVT,class FSM,class SourceState,class TargetState>
  832. typename ::boost::enable_if<
  833. typename ::boost::mpl::has_key<
  834. typename Container::tag_type,action_tag>::type,
  835. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
  836. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  837. {
  838. return (Container()(evt,fsm,src,tgt)).max_size();
  839. }
  840. template <class Event,class FSM,class STATE>
  841. typename ::boost::enable_if<
  842. typename ::boost::mpl::has_key<
  843. typename Container::tag_type,state_action_tag>::type,
  844. typename state_action_result<Event,FSM,STATE>::type >::type
  845. operator()(Event const& evt,FSM& fsm,STATE& state )const
  846. {
  847. return (Container()(evt,fsm,state)).max_size();
  848. }
  849. };
  850. struct max_size_tag {};
  851. struct Max_Size_Helper: proto::extends< proto::terminal<max_size_tag>::type, Max_Size_Helper, sm_domain>
  852. {
  853. Max_Size_Helper(){}
  854. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  855. #ifdef BOOST_MSVC
  856. ,class Arg6
  857. #endif
  858. >
  859. struct In
  860. {
  861. typedef Max_Size_<Arg1> type;
  862. };
  863. };
  864. Max_Size_Helper const max_size_;
  865. template <class Container, class Value>
  866. struct Reserve_ : euml_action<Reserve_<Container,Value> >
  867. {
  868. template <class Event,class FSM,class STATE >
  869. struct state_action_result
  870. {
  871. typedef void type;
  872. };
  873. template <class EVT,class FSM,class SourceState,class TargetState>
  874. struct transition_action_result
  875. {
  876. typedef void type;
  877. };
  878. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  879. template <class EVT,class FSM,class SourceState,class TargetState>
  880. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  881. {
  882. (Container()(evt,fsm,src,tgt)).reserve(Value()(evt,fsm,src,tgt));
  883. }
  884. template <class Event,class FSM,class STATE>
  885. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  886. {
  887. (Container()(evt,fsm,state)).reserve(Value()(evt,fsm,state));
  888. }
  889. };
  890. struct reserve_tag {};
  891. struct Reserve_Helper: proto::extends< proto::terminal<reserve_tag>::type, Reserve_Helper, sm_domain>
  892. {
  893. Reserve_Helper(){}
  894. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  895. #ifdef BOOST_MSVC
  896. ,class Arg6
  897. #endif
  898. >
  899. struct In
  900. {
  901. typedef Reserve_<Arg1,Arg2> type;
  902. };
  903. };
  904. Reserve_Helper const reserve_;
  905. template <class Container, class Num, class Value ,class Enable=void >
  906. struct Resize_ : euml_action<Resize_<Container,Num,Value> >
  907. {
  908. template <class Event,class FSM,class STATE >
  909. struct state_action_result
  910. {
  911. typedef void type;
  912. };
  913. template <class EVT,class FSM,class SourceState,class TargetState>
  914. struct transition_action_result
  915. {
  916. typedef void type;
  917. };
  918. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  919. template <class EVT,class FSM,class SourceState,class TargetState>
  920. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  921. {
  922. (Container()(evt,fsm,src,tgt)).resize(Num()(evt,fsm,src,tgt));
  923. }
  924. template <class Event,class FSM,class STATE>
  925. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  926. {
  927. (Container()(evt,fsm,state)).resize(Num()(evt,fsm,state));
  928. }
  929. };
  930. template <class Container, class Num , class Value >
  931. struct Resize_<Container,Num,Value,typename ::boost::disable_if<typename ::boost::is_same<Value,void>::type >::type>
  932. : euml_action<Resize_<Container,Num,Value> >
  933. {
  934. template <class Event,class FSM,class STATE >
  935. struct state_action_result
  936. {
  937. typedef void type;
  938. };
  939. template <class EVT,class FSM,class SourceState,class TargetState>
  940. struct transition_action_result
  941. {
  942. typedef void type;
  943. };
  944. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  945. template <class EVT,class FSM,class SourceState,class TargetState>
  946. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  947. {
  948. (Container()(evt,fsm,src,tgt)).resize(Num()(evt,fsm,src,tgt),Value()(evt,fsm,src,tgt));
  949. }
  950. template <class Event,class FSM,class STATE>
  951. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  952. {
  953. (Container()(evt,fsm,state)).resize(Num()(evt,fsm,state),Value()(evt,fsm,state));
  954. }
  955. };
  956. struct resize_tag {};
  957. struct Resize_Helper: proto::extends< proto::terminal<resize_tag>::type, Resize_Helper, sm_domain>
  958. {
  959. Resize_Helper(){}
  960. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  961. #ifdef BOOST_MSVC
  962. ,class Arg6
  963. #endif
  964. >
  965. struct In
  966. {
  967. typedef Resize_<Arg1,Arg2,Arg3> type;
  968. };
  969. };
  970. Resize_Helper const resize_;
  971. // version for 3 parameters (sequence containers)
  972. template <class Container, class Param1, class Param2, class Param3 >
  973. struct Insert_ : euml_action<Insert_<Container,Param1,Param2,Param3> >
  974. {
  975. template <class Event,class FSM,class STATE >
  976. struct state_action_result
  977. {
  978. typedef void type;
  979. };
  980. template <class EVT,class FSM,class SourceState,class TargetState>
  981. struct transition_action_result
  982. {
  983. typedef void type;
  984. };
  985. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  986. template <class EVT,class FSM,class SourceState,class TargetState>
  987. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  988. {
  989. (Container()(evt,fsm,src,tgt)).insert(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),
  990. Param3()(evt,fsm,src,tgt));
  991. }
  992. template <class Event,class FSM,class STATE>
  993. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  994. {
  995. (Container()(evt,fsm,state)).insert(Param1()(evt,fsm,state),Param2()(evt,fsm,state),
  996. Param3()(evt,fsm,state));
  997. }
  998. };
  999. // version for 2 parameters
  1000. template <class Container, class Param1, class Param2>
  1001. struct Insert_ < Container,Param1,Param2,void>
  1002. : euml_action<Insert_<Container,Param1,Param2,void> >
  1003. {
  1004. // return value will actually not be correct for set::insert(it1,it2), should be void
  1005. // but it's ok as nobody should call an inexistent return type
  1006. template <class Event,class FSM,class STATE >
  1007. struct state_action_result
  1008. {
  1009. typedef typename get_iterator<
  1010. typename ::boost::remove_reference<
  1011. typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type type;
  1012. };
  1013. template <class EVT,class FSM,class SourceState,class TargetState>
  1014. struct transition_action_result
  1015. {
  1016. typedef typename get_iterator<
  1017. typename ::boost::remove_reference<
  1018. typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
  1019. };
  1020. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  1021. // version for transition + second param not an iterator (meaning that, Container is not an associative container)
  1022. template <class EVT,class FSM,class SourceState,class TargetState>
  1023. typename ::boost::enable_if<
  1024. typename ::boost::mpl::and_<
  1025. typename ::boost::mpl::has_key<
  1026. typename Container::tag_type,action_tag>::type,
  1027. typename ::boost::mpl::not_<
  1028. typename has_iterator_category<
  1029. typename Param2::template transition_action_result<EVT,FSM,SourceState,TargetState>::type
  1030. >::type
  1031. >::type
  1032. >::type,
  1033. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
  1034. >::type
  1035. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  1036. {
  1037. return (Container()(evt,fsm,src,tgt)).insert(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
  1038. }
  1039. // version for transition + second param is an iterator (meaning that, Container is an associative container)
  1040. template <class EVT,class FSM,class SourceState,class TargetState>
  1041. typename ::boost::enable_if<
  1042. typename ::boost::mpl::and_<
  1043. typename ::boost::mpl::has_key<
  1044. typename Container::tag_type,action_tag>::type,
  1045. typename has_iterator_category<
  1046. typename Param2::template transition_action_result<EVT,FSM,SourceState,TargetState>::type
  1047. >::type
  1048. >::type,
  1049. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
  1050. >::type
  1051. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  1052. {
  1053. (Container()(evt,fsm,src,tgt)).insert(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
  1054. }
  1055. // version for state action + second param not an iterator (meaning that, Container is not an associative container)
  1056. template <class Event,class FSM,class STATE>
  1057. typename ::boost::enable_if<
  1058. typename ::boost::mpl::and_<
  1059. typename ::boost::mpl::has_key<
  1060. typename Container::tag_type,state_action_tag>::type,
  1061. typename ::boost::mpl::not_<
  1062. typename has_iterator_category<
  1063. typename Param2::template state_action_result<Event,FSM,STATE>::type
  1064. >::type
  1065. >::type
  1066. >::type,
  1067. typename state_action_result<Event,FSM,STATE>::type
  1068. >::type
  1069. operator()(Event const& evt,FSM& fsm,STATE& state )const
  1070. {
  1071. return (Container()(evt,fsm,state)).insert(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
  1072. }
  1073. // version for state action + second param is an iterator (meaning that, Container is an associative container)
  1074. template <class Event,class FSM,class STATE>
  1075. typename ::boost::enable_if<
  1076. typename ::boost::mpl::and_<
  1077. typename ::boost::mpl::has_key<
  1078. typename Container::tag_type,state_action_tag>::type,
  1079. typename has_iterator_category<
  1080. typename Param2::template state_action_result<Event,FSM,STATE>::type
  1081. >::type
  1082. >::type,
  1083. typename state_action_result<Event,FSM,STATE>::type
  1084. >::type
  1085. operator()(Event const& evt,FSM& fsm,STATE& state )const
  1086. {
  1087. (Container()(evt,fsm,state)).insert(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
  1088. }
  1089. };
  1090. // version for 1 parameter (associative containers)
  1091. template <class Container, class Param1>
  1092. struct Insert_ < Container,Param1,void,void>
  1093. : euml_action<Insert_<Container,Param1,void,void> >
  1094. {
  1095. template <class Event,class FSM,class STATE >
  1096. struct state_action_result
  1097. {
  1098. typedef typename std::pair<
  1099. typename get_iterator<
  1100. typename ::boost::remove_reference<
  1101. typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type,bool> type;
  1102. };
  1103. template <class EVT,class FSM,class SourceState,class TargetState>
  1104. struct transition_action_result
  1105. {
  1106. typedef typename std::pair<
  1107. typename get_iterator<
  1108. typename ::boost::remove_reference<
  1109. typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type,bool> type;
  1110. };
  1111. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  1112. template <class EVT,class FSM,class SourceState,class TargetState>
  1113. typename ::boost::enable_if<
  1114. typename ::boost::mpl::has_key<
  1115. typename Container::tag_type,action_tag>::type,
  1116. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
  1117. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  1118. {
  1119. return (Container()(evt,fsm,src,tgt)).insert(Param1()(evt,fsm,src,tgt));
  1120. }
  1121. template <class Event,class FSM,class STATE>
  1122. typename ::boost::enable_if<
  1123. typename ::boost::mpl::has_key<
  1124. typename Container::tag_type,state_action_tag>::type,
  1125. typename state_action_result<Event,FSM,STATE>::type >::type
  1126. operator()(Event const& evt,FSM& fsm,STATE& state )const
  1127. {
  1128. return (Container()(evt,fsm,state)).insert(Param1()(evt,fsm,state));
  1129. }
  1130. };
  1131. struct insert_tag {};
  1132. struct Insert_Helper: proto::extends< proto::terminal<insert_tag>::type, Insert_Helper, sm_domain>
  1133. {
  1134. Insert_Helper(){}
  1135. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  1136. #ifdef BOOST_MSVC
  1137. ,class Arg6
  1138. #endif
  1139. >
  1140. struct In
  1141. {
  1142. typedef Insert_<Arg1,Arg2,Arg3,Arg4> type;
  1143. };
  1144. };
  1145. Insert_Helper const insert_;
  1146. template <class Container1,class Container2>
  1147. struct Swap_ : euml_action<Swap_<Container1,Container2> >
  1148. {
  1149. template <class Event,class FSM,class STATE >
  1150. struct state_action_result
  1151. {
  1152. typedef void type;
  1153. };
  1154. template <class EVT,class FSM,class SourceState,class TargetState>
  1155. struct transition_action_result
  1156. {
  1157. typedef void type;
  1158. };
  1159. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  1160. template <class EVT,class FSM,class SourceState,class TargetState>
  1161. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  1162. {
  1163. (Container1()(evt,fsm,src,tgt)).swap(Container2()(evt,fsm,src,tgt));
  1164. }
  1165. template <class Event,class FSM,class STATE>
  1166. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  1167. {
  1168. (Container1()(evt,fsm,state)).swap(Container2()(evt,fsm,state));
  1169. }
  1170. };
  1171. struct swap_tag {};
  1172. struct Swap_Helper: proto::extends< proto::terminal<swap_tag>::type, Swap_Helper, sm_domain>
  1173. {
  1174. Swap_Helper(){}
  1175. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  1176. #ifdef BOOST_MSVC
  1177. ,class Arg6
  1178. #endif
  1179. >
  1180. struct In
  1181. {
  1182. typedef Swap_<Arg1,Arg2> type;
  1183. };
  1184. };
  1185. Swap_Helper const swap_;
  1186. template <class Container, class Iterator1, class Iterator2 ,class Enable=void >
  1187. struct Erase_ : euml_action<Erase_<Container,Iterator1,Iterator2> >
  1188. {
  1189. template <class Event,class FSM,class STATE >
  1190. struct state_action_result
  1191. {
  1192. typedef typename get_result_type2<Iterator1,Event,FSM,STATE>::type type;
  1193. };
  1194. template <class EVT,class FSM,class SourceState,class TargetState>
  1195. struct transition_action_result
  1196. {
  1197. typedef typename get_result_type<Iterator1,EVT,FSM,SourceState,TargetState>::type type;
  1198. };
  1199. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  1200. template <class EVT,class FSM,class SourceState,class TargetState>
  1201. typename ::boost::enable_if<
  1202. typename ::boost::mpl::has_key<
  1203. typename Iterator1::tag_type,action_tag>::type,
  1204. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
  1205. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  1206. {
  1207. return (Container()(evt,fsm,src,tgt)).erase(Iterator1()(evt,fsm,src,tgt));
  1208. }
  1209. template <class Event,class FSM,class STATE>
  1210. typename ::boost::enable_if<
  1211. typename ::boost::mpl::has_key<
  1212. typename Iterator1::tag_type,state_action_tag>::type,
  1213. typename state_action_result<Event,FSM,STATE>::type >::type
  1214. operator()(Event const& evt,FSM& fsm,STATE& state )const
  1215. {
  1216. return (Container()(evt,fsm,state)).erase(Iterator1()(evt,fsm,state));
  1217. }
  1218. };
  1219. template <class Container, class Iterator1 , class Iterator2 >
  1220. struct Erase_<Container,Iterator1,Iterator2,
  1221. typename ::boost::disable_if<typename ::boost::is_same<Iterator2,void>::type >::type>
  1222. : euml_action<Erase_<Container,Iterator1,Iterator2> >
  1223. {
  1224. template <class Event,class FSM,class STATE >
  1225. struct state_action_result
  1226. {
  1227. typedef typename get_result_type2<Iterator1,Event,FSM,STATE>::type type;
  1228. };
  1229. template <class EVT,class FSM,class SourceState,class TargetState>
  1230. struct transition_action_result
  1231. {
  1232. typedef typename get_result_type<Iterator1,EVT,FSM,SourceState,TargetState>::type type;
  1233. };
  1234. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  1235. template <class EVT,class FSM,class SourceState,class TargetState>
  1236. typename ::boost::enable_if<
  1237. typename ::boost::mpl::has_key<
  1238. typename Iterator1::tag_type,action_tag>::type,
  1239. typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
  1240. operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  1241. {
  1242. return (Container()(evt,fsm,src,tgt)).erase(Iterator1()(evt,fsm,src,tgt),Iterator2()(evt,fsm,src,tgt));
  1243. }
  1244. template <class Event,class FSM,class STATE>
  1245. typename ::boost::enable_if<
  1246. typename ::boost::mpl::has_key<
  1247. typename Iterator1::tag_type,state_action_tag>::type,
  1248. typename state_action_result<Event,FSM,STATE>::type >::type
  1249. operator()(Event const& evt,FSM& fsm,STATE& state )const
  1250. {
  1251. return (Container()(evt,fsm,state)).erase(Iterator1()(evt,fsm,state),Iterator2()(evt,fsm,state));
  1252. }
  1253. };
  1254. struct erase_tag {};
  1255. struct Erase_Helper: proto::extends< proto::terminal<erase_tag>::type, Erase_Helper, sm_domain>
  1256. {
  1257. Erase_Helper(){}
  1258. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  1259. #ifdef BOOST_MSVC
  1260. ,class Arg6
  1261. #endif
  1262. >
  1263. struct In
  1264. {
  1265. typedef Erase_<Arg1,Arg2,Arg3> type;
  1266. };
  1267. };
  1268. Erase_Helper const erase_;
  1269. template <class Container>
  1270. struct Empty_ : euml_action<Empty_<Container> >
  1271. {
  1272. template <class Event,class FSM,class STATE >
  1273. struct state_action_result
  1274. {
  1275. typedef bool type;
  1276. };
  1277. template <class EVT,class FSM,class SourceState,class TargetState>
  1278. struct transition_action_result
  1279. {
  1280. typedef bool type;
  1281. };
  1282. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  1283. template <class EVT,class FSM,class SourceState,class TargetState>
  1284. bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  1285. {
  1286. return (Container()(evt,fsm,src,tgt)).empty();
  1287. }
  1288. template <class Event,class FSM,class STATE>
  1289. bool operator()(Event const& evt,FSM& fsm,STATE& state )const
  1290. {
  1291. return (Container()(evt,fsm,state)).empty();
  1292. }
  1293. };
  1294. struct empty_tag {};
  1295. struct Empty_Helper: proto::extends< proto::terminal<empty_tag>::type, Empty_Helper, sm_domain>
  1296. {
  1297. Empty_Helper(){}
  1298. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  1299. #ifdef BOOST_MSVC
  1300. ,class Arg6
  1301. #endif
  1302. >
  1303. struct In
  1304. {
  1305. typedef Empty_<Arg1> type;
  1306. };
  1307. };
  1308. Empty_Helper const empty_;
  1309. template <class Container,class Element>
  1310. struct ListRemove_ : euml_action<ListRemove_<Container,Element> >
  1311. {
  1312. template <class Event,class FSM,class STATE >
  1313. struct state_action_result
  1314. {
  1315. typedef void type;
  1316. };
  1317. template <class EVT,class FSM,class SourceState,class TargetState>
  1318. struct transition_action_result
  1319. {
  1320. typedef void type;
  1321. };
  1322. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  1323. template <class EVT,class FSM,class SourceState,class TargetState>
  1324. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  1325. {
  1326. (Container()(evt,fsm,src,tgt)).remove(Element()(evt,fsm,src,tgt));
  1327. }
  1328. template <class Event,class FSM,class STATE>
  1329. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  1330. {
  1331. (Container()(evt,fsm,state)).remove(Element()(evt,fsm,state));
  1332. }
  1333. };
  1334. struct list_remove_tag {};
  1335. struct ListRemove_Helper: proto::extends< proto::terminal<list_remove_tag>::type, ListRemove_Helper, sm_domain>
  1336. {
  1337. ListRemove_Helper(){}
  1338. template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
  1339. #ifdef BOOST_MSVC
  1340. ,class Arg6
  1341. #endif
  1342. >
  1343. struct In
  1344. {
  1345. typedef ListRemove_<Arg1,Arg2> type;
  1346. };
  1347. };
  1348. ListRemove_Helper const list_remove_;
  1349. template <class Container,class Element>
  1350. struct ListRemove_If_ : euml_action<ListRemove_If_<Container,Element> >
  1351. {
  1352. template <class Event,class FSM,class STATE >
  1353. struct state_action_result
  1354. {
  1355. typedef void type;
  1356. };
  1357. template <class EVT,class FSM,class SourceState,class TargetState>
  1358. struct transition_action_result
  1359. {
  1360. typedef void type;
  1361. };
  1362. typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
  1363. template <class EVT,class FSM,class SourceState,class TargetState>
  1364. void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
  1365. {
  1366. (Container()(evt,fsm,src,tgt)).remove_if(Element()(evt,fsm,src,tgt));
  1367. }
  1368. template <class Event,class FSM,class STATE>
  1369. void operator()(Event const& evt,FSM& fsm,STATE& state )const
  1370. {
  1371. (Container()(evt,fsm,state)).remove_if(Element()(evt,fsm,state));
  1372. }
  1373. };
  1374. struct list_remove_if_tag {};
  1375. struct ListRemove_If_Helper: proto::extends< proto::terminal<list_remove_if_tag>::type, ListRemove_If_Helper, sm_domain>
  1376. {
  1377. ListRemove_If_Helper(){}
  1378. template <class Arg1