Loading...
Searching...
No Matches
DuplicateInterval.hpp
1#pragma once
2#include <Scenario/Commands/Scenario/Creations/CreateState.hpp>
3#include <Scenario/Commands/ScenarioCommandFactory.hpp>
4#include <Scenario/Process/ScenarioModel.hpp>
5
6#include <score/command/Command.hpp>
7#include <score/model/Identifier.hpp>
8#include <score/model/path/Path.hpp>
9#include <score/tools/std/Optional.hpp>
10
11#include <score_plugin_scenario_export.h>
12namespace Scenario
13{
14class IntervalModel;
15}
16namespace Scenario::Command
17{
18
19class SCORE_PLUGIN_SCENARIO_EXPORT DuplicateInterval final : public score::Command
20{
21 SCORE_COMMAND_DECL(CommandFactoryName(), DuplicateInterval, "Duplicate an interval")
22public:
25 void undo(const score::DocumentContext& ctx) const override;
26 void redo(const score::DocumentContext& ctx) const override;
27
28 const Path<IntervalModel>& intervalPath() const;
29 const Id<Scenario::IntervalModel>& createdId() const { return m_createdId; }
30
31protected:
32 void serializeImpl(DataStreamInput& s) const override;
33
34 void deserializeImpl(DataStreamOutput& s) override;
35
36private:
37 CreateState m_cmdStart;
38 CreateState m_cmdEnd;
40 Id<Scenario::IntervalModel> m_createdId{};
41};
42
43class SCORE_PLUGIN_SCENARIO_EXPORT ChangeStartState final : public score::Command
44{
45 SCORE_COMMAND_DECL(
46 CommandFactoryName(), ChangeStartState, "Change start of an interval")
47public:
48 ChangeStartState(const IntervalModel& cst, const StateModel& newStart);
50
51private:
52 void undo(const score::DocumentContext& ctx) const override;
53 void redo(const score::DocumentContext& ctx) const override;
54
55 void serializeImpl(DataStreamInput& s) const override;
56 void deserializeImpl(DataStreamOutput& s) override;
57
59 Id<StateModel> m_old, m_new;
60};
61}
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
Definition DuplicateInterval.hpp:44
Definition CreateState.hpp:22
Definition DuplicateInterval.hpp:20
Definition IntervalModel.hpp:50
The core hierarchical and temporal process of score.
Definition ScenarioModel.hpp:37
Definition StateModel.hpp:63
The id_base_t class.
Definition Identifier.hpp:57
The Command class.
Definition Command.hpp:34
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition DocumentContext.hpp:18