Loading...
Searching...
No Matches
MappingModel.hpp
1#pragma once
2#include <State/Address.hpp>
3
4#include <Process/TimeValue.hpp>
5
6#include <Curve/Process/CurveProcessModel.hpp>
7
8#include <Mapping/MappingProcessMetadata.hpp>
9
10#include <score/model/Identifier.hpp>
12#include <score/serialization/VisitorInterface.hpp>
13
14#include <QString>
15
16#include <score_plugin_mapping_export.h>
17
18#include <verdigris>
19namespace Process
20{
21class Inlet;
22class Outlet;
23}
24namespace Mapping
25{
26class SCORE_PLUGIN_MAPPING_EXPORT ProcessModel final : public Curve::CurveProcessModel
27{
28 SCORE_SERIALIZE_FRIENDS
29 PROCESS_METADATA_IMPL(Mapping::ProcessModel)
30
31 W_OBJECT(ProcessModel)
32
33public:
35 const TimeVal& duration, const Id<Process::ProcessModel>& id, QObject* parent);
36
37 ProcessModel(DataStream::Deserializer& vis, QObject* parent);
38 ProcessModel(JSONObject::Deserializer& vis, QObject* parent);
39
41 State::AddressAccessor sourceAddress() const noexcept;
42 double sourceMin() const noexcept;
43 double sourceMax() const noexcept;
44
45 void setSourceAddress(const State::AddressAccessor& arg);
46 void setSourceMin(double arg);
47 void setSourceMax(double arg);
48
49 State::AddressAccessor targetAddress() const noexcept;
50 double targetMin() const noexcept;
51 double targetMax() const noexcept;
52
53 void setTargetAddress(const State::AddressAccessor& arg);
54 void setTargetMin(double arg);
55 void setTargetMax(double arg);
56
57 QString prettyName() const noexcept override;
58 QString prettyValue(double x, double y) const noexcept override;
59
60 TimeVal contentDuration() const noexcept override;
61 ~ProcessModel() override;
62
63 std::unique_ptr<Process::Inlet> inlet;
64 std::unique_ptr<Process::Outlet> outlet;
65
66public:
67 void sourceAddressChanged(const State::AddressAccessor& arg)
68 E_SIGNAL(SCORE_PLUGIN_MAPPING_EXPORT, sourceAddressChanged, arg)
69 void sourceMinChanged(double arg)
70 E_SIGNAL(SCORE_PLUGIN_MAPPING_EXPORT, sourceMinChanged, arg)
71 void sourceMaxChanged(double arg)
72 E_SIGNAL(SCORE_PLUGIN_MAPPING_EXPORT, sourceMaxChanged, arg)
73
74 void targetAddressChanged(const State::AddressAccessor& arg)
75 E_SIGNAL(SCORE_PLUGIN_MAPPING_EXPORT, targetAddressChanged, arg)
76 void targetMinChanged(double arg)
77 E_SIGNAL(SCORE_PLUGIN_MAPPING_EXPORT, targetMinChanged, arg)
78 void targetMaxChanged(double arg)
79 E_SIGNAL(SCORE_PLUGIN_MAPPING_EXPORT, targetMaxChanged, arg)
80
81 PROPERTY(double, targetMax READ targetMax WRITE setTargetMax NOTIFY targetMaxChanged)
82 PROPERTY(double, targetMin READ targetMin WRITE setTargetMin NOTIFY targetMinChanged)
83 PROPERTY(
84 State::AddressAccessor, targetAddress READ targetAddress WRITE setTargetAddress
85 NOTIFY targetAddressChanged)
86 PROPERTY(double, sourceMax READ sourceMax WRITE setSourceMax NOTIFY sourceMaxChanged)
87 PROPERTY(double, sourceMin READ sourceMin WRITE setSourceMin NOTIFY sourceMinChanged)
88 PROPERTY(
89 State::AddressAccessor, sourceAddress READ sourceAddress WRITE setSourceAddress
90 NOTIFY sourceAddressChanged)
91
92private:
93 void init();
95 void setDurationAndScale(const TimeVal& newDuration) noexcept override;
96 void setDurationAndGrow(const TimeVal& newDuration) noexcept override;
97 void setDurationAndShrink(const TimeVal& newDuration) noexcept override;
98
99 double m_sourceMin{};
100 double m_sourceMax{};
101
102 double m_targetMin{};
103 double m_targetMax{};
104};
105}
Definition CurveProcessModel.hpp:11
Definition DataStreamVisitor.hpp:202
Definition JSONVisitor.hpp:423
Definition MappingModel.hpp:27
The id_base_t class.
Definition Identifier.hpp:57
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1324
Definition Address.hpp:108
Definition TimeValue.hpp:21