MoveProcess.hpp
1 #pragma once
2 #include <Scenario/Commands/ScenarioCommandFactory.hpp>
3 #include <Scenario/Document/Interval/Slot.hpp>
4 
5 #include <score/command/Command.hpp>
6 
7 namespace Process
8 {
9 class ProcessModel;
10 }
11 namespace Scenario
12 {
13 class IntervalModel;
14 }
15 namespace Scenario::Command
16 {
17 class MoveProcess final : public score::Command
18 {
19  SCORE_COMMAND_DECL(CommandFactoryName(), MoveProcess, "Move a process")
20 public:
22  const IntervalModel& src, const IntervalModel& tgt,
23  Id<Process::ProcessModel> processId, bool addSlot = true);
24 
25  void undo(const score::DocumentContext& ctx) const override;
26  void redo(const score::DocumentContext& ctx) const override;
27 
28  const Path<IntervalModel>& source() const { return m_src; }
29  const Path<IntervalModel>& target() const { return m_tgt; }
30  const Id<Process::ProcessModel>& oldProcessId() const { return m_oldId; }
31  const Id<Process::ProcessModel>& newProcessId() const { return m_newId; }
32 
33 protected:
34  void serializeImpl(DataStreamInput&) const override;
35  void deserializeImpl(DataStreamOutput&) override;
36 
37 private:
38  Path<IntervalModel> m_src, m_tgt;
39  Id<Process::ProcessModel> m_oldId, m_newId;
40  Scenario::Rack m_oldSmall;
41  Scenario::FullRack m_oldFull;
42  int m_oldPos{};
43  bool m_addedSlot{};
44 };
45 }
The Path class is a typesafe wrapper around ObjectPath.
Definition: Path.hpp:52
Definition: MoveProcess.hpp:18
Definition: IntervalModel.hpp:50
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