2#include <Process/ExecutionCommand.hpp>
3#include <Process/TimeValue.hpp>
5#include <ossia/detail/lockfree_queue.hpp>
6#include <ossia/detail/thread.hpp>
7#include <ossia/editor/scenario/time_value.hpp>
9#include <score_lib_process_export.h>
17struct execution_state;
19#if __cplusplus > 201703L
21static const constexpr struct disable_init_key_t
26 disable_init_t(disable_init_key_t) { }
27 disable_init_t() =
delete;
28 disable_init_t(
const disable_init_t&) =
delete;
29 disable_init_t(disable_init_t&&) =
delete;
30 disable_init_t& operator=(
const disable_init_t&) =
delete;
31 disable_init_t& operator=(disable_init_t&&) =
delete;
42struct DocumentContext;
43template <
typename T,
typename U,
typename V>
44class GenericComponentFactoryList;
57class ProcessComponent;
58class ProcessComponentFactory;
59class ProcessComponentFactoryList;
67using reverse_time_function = smallfun::function<
TimeVal(
const ossia::time_value&)>;
72 using ReaderWriterQueue<ExecutionCommand>::ReaderWriterQueue;
73 template <
typename... Args>
74 inline auto enqueue(Args&&... args) ->
decltype(
auto)
76 OSSIA_ENSURE_CURRENT_THREAD(ossia::thread_type::Ui);
77 return ReaderWriterQueue<ExecutionCommand>::enqueue(std::forward<Args>(args)...);
79 template <
typename... Args>
80 inline auto enqueue_bulk(Args&&... args) ->
decltype(
auto)
82 OSSIA_ENSURE_CURRENT_THREAD(ossia::thread_type::Ui);
83 return ReaderWriterQueue<ExecutionCommand>::enqueue(std::forward<Args>(args)...);
85 template <
typename... Args>
86 inline auto try_enqueue(Args&&... args) ->
decltype(
auto)
88 OSSIA_ENSURE_CURRENT_THREAD(ossia::thread_type::Ui);
89 return ReaderWriterQueue<ExecutionCommand>::enqueue(std::forward<Args>(args)...);
91 template <
typename... Args>
92 inline auto try_enqueue_bulk(Args&&... args) ->
decltype(
auto)
94 OSSIA_ENSURE_CURRENT_THREAD(ossia::thread_type::Ui);
95 return ReaderWriterQueue<ExecutionCommand>::enqueue(std::forward<Args>(args)...);
98 template <
typename... Args>
99 inline auto try_dequeue(Args&&... args) ->
decltype(
auto)
101 OSSIA_ENSURE_CURRENT_THREAD(ossia::thread_type::Audio);
102 return ReaderWriterQueue<ExecutionCommand>::try_dequeue(std::forward<Args>(args)...);
109 using ConcurrentQueue<ExecutionCommand>::ConcurrentQueue;
110 template <
typename... Args>
111 inline auto enqueue(Args&&... args) ->
decltype(
auto)
113 OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Audio);
114 return ConcurrentQueue<ExecutionCommand>::enqueue(std::forward<Args>(args)...);
116 template <
typename... Args>
117 inline auto enqueue_bulk(Args&&... args) ->
decltype(
auto)
119 OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Audio);
120 return ConcurrentQueue<ExecutionCommand>::enqueue(std::forward<Args>(args)...);
122 template <
typename... Args>
123 inline auto try_enqueue(Args&&... args) ->
decltype(
auto)
125 OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Audio);
126 return ConcurrentQueue<ExecutionCommand>::enqueue(std::forward<Args>(args)...);
128 template <
typename... Args>
129 inline auto try_enqueue_bulk(Args&&... args) ->
decltype(
auto)
131 OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Audio);
132 return ConcurrentQueue<ExecutionCommand>::enqueue(std::forward<Args>(args)...);
135 template <
typename... Args>
136 inline auto try_dequeue(Args&&... args) ->
decltype(
auto)
138 OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Ui);
139 return ConcurrentQueue<ExecutionCommand>::try_dequeue(std::forward<Args>(args)...);
141 template <
typename... Args>
142 inline auto try_dequeue_bulk(Args&&... args) ->
decltype(
auto)
144 OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Ui);
145 return ConcurrentQueue<ExecutionCommand>::try_dequeue_bulk(
146 std::forward<Args>(args)...);
153 using ConcurrentQueue<GCCommand>::ConcurrentQueue;
154 template <
typename... Args>
155 inline auto enqueue(Args&&... args) ->
decltype(
auto)
157 OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Audio);
158 return ConcurrentQueue<GCCommand>::enqueue(std::forward<Args>(args)...);
160 template <
typename... Args>
161 inline auto enqueue_bulk(Args&&... args) ->
decltype(
auto)
163 OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Audio);
164 return ConcurrentQueue<GCCommand>::enqueue(std::forward<Args>(args)...);
166 template <
typename... Args>
167 inline auto try_enqueue(Args&&... args) ->
decltype(
auto)
169 OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Audio);
170 return ConcurrentQueue<GCCommand>::enqueue(std::forward<Args>(args)...);
172 template <
typename... Args>
173 inline auto try_enqueue_bulk(Args&&... args) ->
decltype(
auto)
175 OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Audio);
176 return ConcurrentQueue<GCCommand>::enqueue(std::forward<Args>(args)...);
179 template <
typename... Args>
180 inline auto try_dequeue(Args&&... args) ->
decltype(
auto)
182 OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Ui);
183 return ConcurrentQueue<GCCommand>::try_dequeue(std::forward<Args>(args)...);
185 template <
typename... Args>
186 inline auto try_dequeue_bulk(Args&&... args) ->
decltype(
auto)
188 OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Ui);
189 return ConcurrentQueue<GCCommand>::try_dequeue_bulk(std::forward<Args>(args)...);
197 std::weak_ptr<void> alias;
199 auto acquireExecutionQueue()
const noexcept
201 return std::shared_ptr<Execution::ExecutionCommandQueue>(
202 alias.lock(), &executionQueue);
204 auto acquireEditionQueue()
const noexcept
206 return std::shared_ptr<Execution::EditionCommandQueue>(alias.lock(), &editionQueue);
208 auto acquireGCQueue()
const noexcept
210 return std::shared_ptr<Execution::GCCommandQueue>(alias.lock(), &gcQueue);
212 std::weak_ptr<const Context> weakSelf()
const noexcept
214 return std::shared_ptr<const Context>(alias.lock(),
this);
216 std::weak_ptr<Execution::ExecutionCommandQueue> weakExecutionQueue()
const noexcept
218 return std::shared_ptr<Execution::ExecutionCommandQueue>(
219 alias.lock(), &executionQueue);
221 std::weak_ptr<Execution::EditionCommandQueue> weakEditionQueue()
const noexcept
223 return std::shared_ptr<Execution::EditionCommandQueue>(alias.lock(), &editionQueue);
225 std::weak_ptr<Execution::GCCommandQueue> weakGCQueue()
const noexcept
227 return std::shared_ptr<Execution::GCCommandQueue>(alias.lock(), &gcQueue);
231 const std::atomic_bool& created;
239 Execution::reverse_time_function reverseTime;
247 const std::shared_ptr<ossia::graph_interface>& execGraph;
248 const std::shared_ptr<ossia::execution_state>& execState;
250 auto& context()
const {
return *
this; }
252#if !defined(_MSC_VER)
253#if __cplusplus > 201703L
254#pragma clang diagnostic push
255#pragma clang diagnostic ignored "-Wunknown-attributes"
256 [[no_unique_address]] ossia::disable_init_t disable_copy;
257#pragma clang diagnostic pop
270#define in_exec this->system().executionQueue.enqueue
271#define in_edit this->system().editionQueue.enqueue
272#define weak_exec this->system().weakExecutionQueue()
273#define weak_edit this->system().weakEditionQueue()
274#define weak_gc this->system().weakGCQueue()
Components used for the execution of a score.
Definition ProcessComponent.cpp:14
smallfun::function< ossia::time_value(const TimeVal &)> time_function
Sets-up and manages the main execution clock.
Definition ExecutionContext.hpp:66
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1115
Utilities for OSSIA data structures.
Definition DeviceInterface.hpp:33
Base toolkit upon which the software is built.
Definition Application.cpp:99
Definition ExecutionContext.hpp:196
ExecutionCommandQueue & executionQueue
Definition ExecutionContext.hpp:242
Execution::time_function time
Definition ExecutionContext.hpp:238
Definition ExecutionContext.hpp:107
Definition ExecutionContext.hpp:70
Definition ExecutionContext.hpp:151
Definition ExecutionSetup.hpp:38
Definition TimeValue.hpp:21
Definition DocumentContext.hpp:18