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