score
Home
Classes
Namespaces
Files
Loading...
Searching...
No Matches
LoadPreset.hpp
1
#pragma once
2
#include <State/Value.hpp>
3
#include <State/ValueSerialization.hpp>
4
5
#include <Process/Commands/ProcessCommandFactory.hpp>
6
#include <Process/Dataflow/Port.hpp>
7
#include <Process/Process.hpp>
8
9
#include <score/model/path/PathSerialization.hpp>
10
namespace
Process
11
{
12
class
ProcessModel;
13
class
SCORE_LIB_PROCESS_EXPORT
LoadPreset
final :
public
score::Command
14
{
15
SCORE_COMMAND_DECL(Process::CommandFactoryName(),
LoadPreset
,
"Set a control"
)
16
17
public
:
18
LoadPreset
(
const
Process::ProcessModel
& obj,
Process::Preset
newval)
19
: m_path{obj}
20
, m_old{obj.savePreset()}
21
, m_new{std::move(newval)}
22
{
23
}
24
25
virtual
~LoadPreset
() { }
26
27
private
:
28
void
undo(
const
score::DocumentContext
& ctx)
const
final
override
29
{
30
m_path.find(ctx).loadPreset(m_old);
31
}
32
33
void
redo(
const
score::DocumentContext
& ctx)
const
final
override
34
{
35
m_path.find(ctx).loadPreset(m_new);
36
}
37
38
void
serializeImpl(
DataStreamInput
& stream)
const
final
override
39
{
40
stream << m_path << m_old << m_new;
41
}
42
void
deserializeImpl(
DataStreamOutput
& stream)
final
override
43
{
44
stream >> m_path >> m_old >> m_new;
45
}
46
47
Path<Process::ProcessModel>
m_path;
48
Process::Preset
m_old;
49
Process::Preset
m_new;
50
};
51
}
Path
The Path class is a typesafe wrapper around ObjectPath.
Definition
Path.hpp:52
Process::LoadPreset
Definition
LoadPreset.hpp:14
Process::ProcessModel
The Process class.
Definition
score-lib-process/Process/Process.hpp:61
score::Command
The Command class.
Definition
Command.hpp:34
Process
Base classes and tools to implement processes and layers.
Definition
JSONVisitor.hpp:1324
DataStreamInput
Definition
DataStreamHelpers.hpp:99
DataStreamOutput
Definition
DataStreamHelpers.hpp:103
Process::Preset
Definition
Preset.hpp:32
score::DocumentContext
Definition
DocumentContext.hpp:18