ExecutorModel.hpp
1 #pragma once
2 #include <Process/TimeValue.hpp>
3 
4 #include <Execution/Clock/ClockFactory.hpp>
5 
6 #include <score/plugins/settingsdelegate/SettingsDelegateModel.hpp>
7 
8 #include <ossia/editor/scenario/time_value.hpp>
9 
10 #include <Transport/TransportInterface.hpp>
11 
12 #include <score_plugin_engine_export.h>
13 
14 #include <verdigris>
15 
16 namespace Execution
17 {
18 namespace Settings
19 {
21 {
22  const QString StaticFixed{"Static (Plain)"};
23  const QString StaticBFS{"Static (BFS)"};
24  const QString StaticTC{"Static (TC)"};
25  const QString Dynamic{"Dynamic"};
26  operator QStringList() const { return {StaticFixed, StaticBFS, StaticTC, Dynamic}; }
27 };
29 {
30  const QString CreationOrder{"Creation order"};
31  const QString XY{"XY"};
32  const QString YX{"YX"};
33  const QString Temporal{"Temporal"};
34  operator QStringList() const { return {CreationOrder, XY, YX, Temporal}; }
35 };
37 {
38  const QString Merge{"Merge"};
39  const QString Append{"Append"};
40  const QString Replace{"Replace"};
41  operator QStringList() const { return {Merge, Append, Replace}; }
42 };
44 {
45  const QString Default{"Default"};
46  const QString Ordered{"Ordered"};
47  const QString Priorized{"Priorized"};
48  const QString Merged{"Merged"};
49  const QString MergedThreaded{"MergedThreaded"};
50  const QString DirectThreaded{"DirectThreaded"};
51  operator QStringList() const
52  {
53  return {Default, Ordered, Priorized, Merged, MergedThreaded, DirectThreaded};
54  }
55 };
57 {
58  const QString Buffer{"Buffer-accurate"};
59  const QString ScoreAccurate{"Score-accurate"};
60  const QString Precise{"Precise"};
61  operator QStringList() const { return {Buffer, ScoreAccurate, Precise}; }
62 };
63 class SCORE_PLUGIN_ENGINE_EXPORT Model : public score::SettingsDelegateModel
64 {
65  W_OBJECT(Model)
66 
67  ClockFactory::ConcreteKey m_Clock;
68  QString m_Scheduling;
69  QString m_Ordering;
70  QString m_Merging;
71  QString m_Commit;
72  QString m_Tick;
73  int m_Rate{};
74  int m_Threads{};
75  bool m_Parallel{};
76  bool m_ExecutionListening{};
77  bool m_Logging{};
78  bool m_Bench{};
79  bool m_ScoreOrder{};
80  bool m_ValueCompilation{};
81  bool m_TransportValueCompilation{};
82 
83  const ClockFactoryList& m_clockFactories;
84  const Transport::TransportInterfaceList& m_transportInterfaces;
85 
86 public:
87  Model(QSettings& set, const score::ApplicationContext& ctx);
88 
89  const ClockFactoryList& clockFactories() const { return m_clockFactories; }
90 
91  std::unique_ptr<Clock> makeClock(const Execution::Context& ctx) const;
92  time_function makeTimeFunction(const score::DocumentContext&) const;
93  reverse_time_function makeReverseTimeFunction(const score::DocumentContext&) const;
94 
95  Transport::TransportInterface* getTransport() const;
96 
97  SCORE_SETTINGS_PARAMETER_HPP(
98  SCORE_PLUGIN_ENGINE_EXPORT, ClockFactory::ConcreteKey, Clock)
99  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, QString, Scheduling)
100  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, QString, Ordering)
101  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, QString, Merging)
102  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, QString, Commit)
103  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, QString, Tick)
104  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, int, Rate)
105  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, int, Threads)
106  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, bool, Parallel)
107  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, bool, ExecutionListening)
108  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, bool, Logging)
109  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, bool, Bench)
110  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, bool, ScoreOrder)
111  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_ENGINE_EXPORT, bool, ValueCompilation)
112  SCORE_SETTINGS_PARAMETER_HPP(
113  SCORE_PLUGIN_ENGINE_EXPORT, bool, TransportValueCompilation)
114 };
115 
116 SCORE_SETTINGS_PARAMETER(Model, Clock)
117 SCORE_SETTINGS_PARAMETER(Model, Scheduling)
118 SCORE_SETTINGS_PARAMETER(Model, Ordering)
119 SCORE_SETTINGS_PARAMETER(Model, Merging)
120 SCORE_SETTINGS_PARAMETER(Model, Commit)
121 SCORE_SETTINGS_PARAMETER(Model, Tick)
122 SCORE_SETTINGS_PARAMETER(Model, Rate)
123 SCORE_SETTINGS_PARAMETER(Model, Threads)
124 SCORE_SETTINGS_PARAMETER(Model, Parallel)
125 SCORE_SETTINGS_PARAMETER(Model, ExecutionListening)
126 SCORE_SETTINGS_PARAMETER(Model, Logging)
127 SCORE_SETTINGS_PARAMETER(Model, Bench)
128 SCORE_SETTINGS_PARAMETER(Model, ScoreOrder)
129 SCORE_SETTINGS_PARAMETER(Model, ValueCompilation)
130 SCORE_SETTINGS_PARAMETER(Model, TransportValueCompilation)
131 }
132 }
Definition: ClockFactory.hpp:78
Definition: ClockFactory.hpp:41
Definition: ExecutorModel.hpp:64
Definition: TransportInterface.hpp:20
Definition: TransportInterface.hpp:47
Definition: SettingsDelegateModel.hpp:16
Components used for the execution of a score.
Definition: ProcessComponent.cpp:12
smallfun::function< ossia::time_value(const TimeVal &)> time_function
Sets-up and manages the main execution clock.
Definition: ExecutionContext.hpp:66
Definition: ExecutionContext.hpp:76
Definition: ExecutorModel.hpp:44
Definition: ExecutorModel.hpp:37
Definition: ExecutorModel.hpp:29
Definition: ExecutorModel.hpp:21
Definition: ExecutorModel.hpp:57
Used to access all the application-wide state and structures.
Definition: ApplicationContext.hpp:24
Definition: DocumentContext.hpp:18