Loading...
Searching...
No Matches
AutomatableFactory.hpp
1#pragma once
2#include <State/Address.hpp>
3#include <State/Value.hpp>
4
5#include <Process/ProcessFactory.hpp>
6
7#include <score/document/DocumentContext.hpp>
8#include <score/plugins/InterfaceList.hpp>
9
10#include <ossia/network/common/complex_type.hpp>
11#include <ossia/network/common/parameter_properties.hpp>
12
13#include <score_lib_process_export.h>
14
15namespace ossia
16{
17struct unit_t;
18}
19namespace score
20{
21struct ApplicationContext;
22}
23
24namespace Process
25{
32class SCORE_LIB_PROCESS_EXPORT AutomatableFactory : public score::InterfaceBase
33{
34 SCORE_INTERFACE(ProcessModel, "a8d33b1e-3161-4f36-989a-cd9104388d51")
35
36public:
37 ~AutomatableFactory() override;
38
40 virtual bool matches(const ossia::complex_type& t) const noexcept = 0;
41
44 get(const score::ApplicationContext& ctx) const noexcept = 0;
45
47 virtual int count(
48 const State::AddressAccessor& address, const ossia::value& start,
49 const ossia::value& end) const noexcept = 0;
50
52 virtual std::vector<Process::ProcessModel*> make(
54 const State::AddressAccessor& address, const ossia::value& start,
55 const ossia::value& end, const TimeVal& duration,
56 const std::vector<Id<ProcessModel>>& id, QObject* parent) const noexcept = 0;
57
58 // TODO also have an interface that allows recording / piecewise construction
59};
60
61struct SCORE_LIB_PROCESS_EXPORT AutomatableFactoryList
62 : score::InterfaceList<AutomatableFactory>
63{
65 get(const score::ApplicationContext& ctx, const ossia::complex_type& t) const noexcept
66 {
67 for(auto& fact : *this)
68 {
69 if(fact.matches(t))
70 return fact.get(ctx);
71 }
72 return nullptr;
73 }
74};
75
76}
Factory for processes that work like automations.
Definition AutomatableFactory.hpp:33
virtual int count(const State::AddressAccessor &address, const ossia::value &start, const ossia::value &end) const noexcept=0
Number of processes that should be created.
virtual Process::ProcessModelFactory * get(const score::ApplicationContext &ctx) const noexcept=0
Get the factory used.
virtual std::vector< Process::ProcessModel * > make(const Process::ProcessModelFactory &factory, const score::DocumentContext &ctx, const State::AddressAccessor &address, const ossia::value &start, const ossia::value &end, const TimeVal &duration, const std::vector< Id< ProcessModel > > &id, QObject *parent) const noexcept=0
Instantiate the actual processes.
virtual bool matches(const ossia::complex_type &t) const noexcept=0
Is this type able to provide a curve type for the following ossia type.
The ProcessFactory class.
Definition score-lib-process/Process/ProcessFactory.hpp:35
The Process class.
Definition score-lib-process/Process/Process.hpp:61
The id_base_t class.
Definition Identifier.hpp:57
Base class for plug-in interfaces.
Definition Interface.hpp:52
InterfaceList Default implementation of InterfaceListBase.
Definition InterfaceList.hpp:80
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1324
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition AutomatableFactory.hpp:63
Definition Address.hpp:108
Definition TimeValue.hpp:21
Used to access all the application-wide state and structures.
Definition ApplicationContext.hpp:24
Definition DocumentContext.hpp:18