BaseScenarioComponent.hpp
1 #pragma once
2 #include <ossia/editor/scenario/clock.hpp>
3 
4 #include <QObject>
5 
6 #include <score_plugin_engine_export.h>
7 
8 #include <memory>
9 #include <verdigris>
10 namespace ossia
11 {
12 struct time_value;
13 class scenario;
14 }
15 
16 namespace Scenario
17 {
18 class IntervalModel;
19 class EventModel;
20 class StateModel;
21 class TimeSyncModel;
22 class BaseScenario;
23 class ScenarioInterface;
24 }
25 class DeviceList;
26 namespace Execution
27 {
28 class IntervalComponent;
29 class EventComponent;
30 class StateComponent;
31 class TimeSyncComponent;
32 }
33 
34 // MOVEME
35 // Like BaseScenarioContainer but with references
36 // to existing elements instead.
38 {
39 public:
42 
44  Scenario::IntervalModel& interval, Scenario::StateModel& startState,
45  Scenario::StateModel& endState, Scenario::EventModel& startEvent,
46  Scenario::EventModel& endEvent, Scenario::TimeSyncModel& startNode,
47  Scenario::TimeSyncModel& endNode)
48  : m_interval{interval}
49  , m_startState{startState}
50  , m_endState{endState}
51  , m_startEvent{startEvent}
52  , m_endEvent{endEvent}
53  , m_startNode{startNode}
54  , m_endNode{endNode}
55  {
56  }
57 
58  Scenario::IntervalModel& interval() const { return m_interval; }
59 
60  Scenario::TimeSyncModel& startTimeSync() const { return m_startNode; }
61  Scenario::TimeSyncModel& endTimeSync() const { return m_endNode; }
62 
63  Scenario::EventModel& startEvent() const { return m_startEvent; }
64  Scenario::EventModel& endEvent() const { return m_endEvent; }
65 
66  Scenario::StateModel& startState() const { return m_startState; }
67  Scenario::StateModel& endState() const { return m_endState; }
68 
69 private:
70  Scenario::IntervalModel& m_interval;
71  Scenario::StateModel& m_startState;
72  Scenario::StateModel& m_endState;
73  Scenario::EventModel& m_startEvent;
74  Scenario::EventModel& m_endEvent;
75  Scenario::TimeSyncModel& m_startNode;
76  Scenario::TimeSyncModel& m_endNode;
77 };
78 
79 namespace Execution
80 {
81 struct Context;
82 class SCORE_PLUGIN_ENGINE_EXPORT BaseScenarioElement final : public QObject
83 {
84  W_OBJECT(BaseScenarioElement)
85 public:
86  BaseScenarioElement(const Context&, QObject* parent);
88 
89  void init(bool forcePlay, BaseScenarioRefContainer);
90  void cleanup();
91  bool active() const { return bool(m_ossia_interval); }
92 
93  IntervalComponent& baseInterval() const;
94 
95  TimeSyncComponent& startTimeSync() const;
96  TimeSyncComponent& endTimeSync() const;
97 
98  EventComponent& startEvent() const;
99  EventComponent& endEvent() const;
100 
101  StateComponent& startState() const;
102  StateComponent& endState() const;
103 
104  ossia::scenario& baseScenario() const;
105 
106 public:
107  void finished() E_SIGNAL(SCORE_PLUGIN_ENGINE_EXPORT, finished)
108 
109 private:
110  const Context& m_ctx;
111  std::shared_ptr<ossia::scenario> m_ossia_scenario;
112  std::shared_ptr<IntervalComponent> m_ossia_interval;
113 
114  std::shared_ptr<TimeSyncComponent> m_ossia_startTimeSync;
115  std::shared_ptr<TimeSyncComponent> m_ossia_endTimeSync;
116 
117  std::shared_ptr<EventComponent> m_ossia_startEvent;
118  std::shared_ptr<EventComponent> m_ossia_endEvent;
119 
120  std::shared_ptr<StateComponent> m_ossia_startState;
121  std::shared_ptr<StateComponent> m_ossia_endState;
122 };
123 }
Definition: BaseScenarioComponent.hpp:38
Definition: BaseScenarioComponent.hpp:83
Definition: EventExecution.hpp:18
Definition: IntervalExecution.hpp:135
Definition: StateExecution.hpp:86
Definition: TimeSyncExecution.hpp:20
Definition: EventModel.hpp:36
Definition: IntervalModel.hpp:50
Definition: ScenarioInterface.hpp:20
Definition: StateModel.hpp:63
Definition: TimeSyncModel.hpp:34
Components used for the execution of a score.
Definition: ProcessComponent.cpp:12
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: ExecutionContext.hpp:76