SetProcessPosition.hpp
1 #pragma once
2 #include <Scenario/Commands/ScenarioCommandFactory.hpp>
3 
4 #include <score/command/Command.hpp>
5 #include <score/model/path/Path.hpp>
6 
7 struct DataStreamInput;
8 struct DataStreamOutput;
9 
10 namespace Process
11 {
12 class ProcessModel;
13 }
14 namespace Scenario
15 {
16 class IntervalModel;
17 class StateModel;
18 namespace Command
19 {
20 class PutProcessBefore final : public score::Command
21 {
22  SCORE_COMMAND_DECL(CommandFactoryName(), PutProcessBefore, "Set process position")
23 
24 public:
25  // Put proc2 before proc
27  const IntervalModel& cst, std::optional<Id<Process::ProcessModel>> proc,
29 
30  void undo(const score::DocumentContext& ctx) const override;
31  void redo(const score::DocumentContext& ctx) const override;
32 
33 protected:
34  void serializeImpl(DataStreamInput& s) const override;
35  void deserializeImpl(DataStreamOutput& s) override;
36 
37 private:
38  void putBefore(
39  const score::DocumentContext& ctx, std::optional<Id<Process::ProcessModel>> proc,
40  Id<Process::ProcessModel> proc2) const;
41 
43  std::optional<Id<Process::ProcessModel>> m_proc;
45  std::optional<Id<Process::ProcessModel>> m_old_after_proc2;
46 };
47 
49 {
50  SCORE_COMMAND_DECL(CommandFactoryName(), PutStateProcessBefore, "Set process position")
51 
52 public:
53  // Put proc2 before proc
55  const StateModel& cst, std::optional<Id<Process::ProcessModel>> proc,
57 
58  void undo(const score::DocumentContext& ctx) const override;
59  void redo(const score::DocumentContext& ctx) const override;
60 
61 protected:
62  void serializeImpl(DataStreamInput& s) const override;
63  void deserializeImpl(DataStreamOutput& s) override;
64 
65 private:
66  void putBefore(
67  const score::DocumentContext& ctx, std::optional<Id<Process::ProcessModel>> proc,
68  Id<Process::ProcessModel> proc2) const;
69 
71  std::optional<Id<Process::ProcessModel>> m_proc;
73  std::optional<Id<Process::ProcessModel>> m_old_after_proc2;
74 };
75 }
76 }
Definition: SetProcessPosition.hpp:21
Definition: SetProcessPosition.hpp:49
Definition: IntervalModel.hpp:50
Definition: StateModel.hpp:63
The id_base_t class.
Definition: Identifier.hpp:57
The Command class.
Definition: Command.hpp:34
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: DataStreamHelpers.hpp:99
Definition: DataStreamHelpers.hpp:103
Definition: DocumentContext.hpp:18