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_OPERATOR_H
12#define BOOST_MSM_FRONT_OPERATOR_H
13
14
15
16namespace boost { namespace msm { namespace front
17{
18
19template <class T1,class T2>
20struct Or_
21{
22 template <class EVT,class FSM,class SourceState,class TargetState>
23 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)
24 {
25 return (T1()(evt,fsm,src,tgt) || T2()(evt,fsm,src,tgt));
26 }
27 template <class Event,class FSM,class STATE>
28 bool operator()(Event const& evt,FSM& fsm,STATE& state)
29 {
30 return (T1()(evt,fsm,state) || T2()(evt,fsm,state));
31 }
32};
33template <class T1,class T2>
34struct And_
35{
36 template <class EVT,class FSM,class SourceState,class TargetState>
37 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)
38 {
39 return (T1()(evt,fsm,src,tgt) && T2()(evt,fsm,src,tgt));
40 }
41 template <class Event,class FSM,class STATE>
42 bool operator()(Event const& evt,FSM& fsm,STATE& state)
43 {
44 return (T1()(evt,fsm,state) && T2()(evt,fsm,state));
45 }
46};
47template <class T1>
48struct Not_
49{
50 template <class EVT,class FSM,class SourceState,class TargetState>
51 bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)
52 {
53 return !(T1()(evt,fsm,src,tgt));
54 }
55 template <class Event,class FSM,class STATE>
56 bool operator()(Event const& evt,FSM& fsm,STATE& state)
57 {
58 return !(T1()(evt,fsm,state));
59 }
60};
61
62
63}}}
64
65#endif // BOOST_MSM_FRONT_OPERATOR_H
66

source code of boost/libs/msm/include/boost/msm/front/operator.hpp