Loading...
Searching...
No Matches
AnythingTransitions.hpp
1#pragma once
2#include <Scenario/Palette/ScenarioPaletteBaseTransitions.hpp>
3namespace Scenario
4{
5template <typename Scenario_T>
7 : public GenericTransition<Scenario_T, QAbstractTransition>
8{
9public:
10 using GenericTransition<Scenario_T, QAbstractTransition>::GenericTransition;
11
12protected:
13 bool eventTest(QEvent* e) override
14 {
15 using namespace std;
16 static const constexpr QEvent::Type types[]
17 = {QEvent::Type(QEvent::User + MoveOnNothing_Event::user_type),
18 QEvent::Type(QEvent::User + MoveOnState_Event::user_type),
19 QEvent::Type(QEvent::User + MoveOnEvent_Event::user_type),
20 QEvent::Type(QEvent::User + MoveOnTimeSync_Event::user_type),
21 QEvent::Type(QEvent::User + MoveOnInterval_Event::user_type),
22 QEvent::Type(QEvent::User + MoveOnLeftBrace_Event::user_type),
23 QEvent::Type(QEvent::User + MoveOnRightBrace_Event::user_type)};
24
25 return find(begin(types), end(types), e->type()) != end(types);
26 }
27
28 void onTransition(QEvent* event) override
29 {
30 auto qev = static_cast<score::PositionedEvent<Scenario::Point>*>(event);
31
32 this->state().currentPoint = qev->point;
33 }
34};
35
36template <typename Scenario_T>
38 : public GenericTransition<Scenario_T, QAbstractTransition>
39{
40public:
41 using GenericTransition<Scenario_T, QAbstractTransition>::GenericTransition;
42
43protected:
44 bool eventTest(QEvent* e) override
45 {
46 using namespace std;
47 static const constexpr QEvent::Type types[]
48 = {QEvent::Type(QEvent::User + MoveOnNothing_Event::user_type),
49 QEvent::Type(QEvent::User + MoveOnState_Event::user_type),
50 QEvent::Type(QEvent::User + MoveOnEvent_Event::user_type),
51 QEvent::Type(QEvent::User + MoveOnInterval_Event::user_type),
52 QEvent::Type(QEvent::User + MoveOnLeftBrace_Event::user_type),
53 QEvent::Type(QEvent::User + MoveOnRightBrace_Event::user_type)};
54
55 return find(begin(types), end(types), e->type()) != end(types);
56 }
57
58 void onTransition(QEvent* event) override
59 {
60 auto qev = static_cast<score::PositionedEvent<Scenario::Point>*>(event);
61
62 this->state().currentPoint = qev->point;
63 }
64};
65
66template <typename Scenario_T>
68 : public GenericTransition<Scenario_T, QAbstractTransition>
69{
70public:
71 using GenericTransition<Scenario_T, QAbstractTransition>::GenericTransition;
72
73protected:
74 bool eventTest(QEvent* e) override
75 {
76 using namespace std;
77 static const constexpr QEvent::Type types[]
78 = {QEvent::Type(QEvent::User + MoveOnNothing_Event::user_type),
79 QEvent::Type(QEvent::User + MoveOnTimeSync_Event::user_type),
80 QEvent::Type(QEvent::User + MoveOnInterval_Event::user_type),
81 QEvent::Type(QEvent::User + MoveOnLeftBrace_Event::user_type),
82 QEvent::Type(QEvent::User + MoveOnRightBrace_Event::user_type)};
83
84 return find(begin(types), end(types), e->type()) != end(types);
85 }
86
87 void onTransition(QEvent* event) override
88 {
89 auto qev = static_cast<score::PositionedEvent<Scenario::Point>*>(event);
90
91 this->state().currentPoint = qev->point;
92 }
93};
94
95template <typename Scenario_T>
97 : public GenericTransition<Scenario_T, QAbstractTransition>
98{
99public:
100 using GenericTransition<Scenario_T, QAbstractTransition>::GenericTransition;
101
102protected:
103 bool eventTest(QEvent* e) override
104 {
105 using namespace std;
106 static const constexpr QEvent::Type types[]
107 = {QEvent::Type(QEvent::User + MoveOnNothing_Event::user_type),
108 QEvent::Type(QEvent::User + MoveOnInterval_Event::user_type),
109 QEvent::Type(QEvent::User + MoveOnLeftBrace_Event::user_type),
110 QEvent::Type(QEvent::User + MoveOnRightBrace_Event::user_type)};
111
112 return find(begin(types), end(types), e->type()) != end(types);
113 }
114
115 void onTransition(QEvent* event) override
116 {
117 auto qev = static_cast<score::PositionedEvent<Scenario::Point>*>(event);
118
119 this->state().currentPoint = qev->point;
120 }
121};
122
123class ReleaseOnAnything_Transition final : public QAbstractTransition
124{
125protected:
126 bool eventTest(QEvent* e) override
127 {
128 using namespace std;
129 static const constexpr QEvent::Type types[]
130 = {QEvent::Type(QEvent::User + ReleaseOnNothing_Event::user_type),
131 QEvent::Type(QEvent::User + ReleaseOnState_Event::user_type),
132 QEvent::Type(QEvent::User + ReleaseOnEvent_Event::user_type),
133 QEvent::Type(QEvent::User + ReleaseOnTimeSync_Event::user_type),
134 QEvent::Type(QEvent::User + ReleaseOnInterval_Event::user_type),
135 QEvent::Type(QEvent::User + ReleaseOnLeftBrace_Event::user_type),
136 QEvent::Type(QEvent::User + ReleaseOnRightBrace_Event::user_type)};
137
138 return find(begin(types), end(types), e->type()) != end(types);
139 }
140 void onTransition(QEvent* event) override { }
141};
142}
Definition AnythingTransitions.hpp:8
Definition AnythingTransitions.hpp:69
Definition AnythingTransitions.hpp:98
Definition AnythingTransitions.hpp:39
Definition AnythingTransitions.hpp:124
Definition StateMachineUtils.hpp:76
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
STL namespace.
Definition StateMachineUtils.hpp:46