LoadCables.hpp
1 #pragma once
2 #include <Scenario/Commands/ScenarioCommandFactory.hpp>
3 
4 #include <Dataflow/Commands/CableHelpers.hpp>
5 
6 #include <score/command/Command.hpp>
7 #include <score/model/path/Path.hpp>
8 
9 namespace Dataflow
10 {
11 class LoadCables final : public score::Command
12 {
13  SCORE_COMMAND_DECL(Scenario::Command::CommandFactoryName(), LoadCables, "Remove cable")
14 
15 public:
16  LoadCables(const ObjectPath& p, const SerializedCables& c)
17  : m_cables{c}
18  {
19  Dataflow::unstripCables(p, m_cables);
20  }
21 
22  void undo(const score::DocumentContext& ctx) const override
23  {
24  Dataflow::removeCables(m_cables, ctx);
25  }
26 
27  void redo(const score::DocumentContext& ctx) const override
28  {
29  Dataflow::restoreCables(m_cables, ctx);
30  }
31 
32 protected:
33  void serializeImpl(DataStreamInput& s) const override { s << m_cables; }
34  void deserializeImpl(DataStreamOutput& s) override { s >> m_cables; }
35 
36 private:
37  SerializedCables m_cables;
38 };
39 }
Definition: LoadCables.hpp:12
The ObjectPath class.
Definition: ObjectPath.hpp:37
The Command class.
Definition: Command.hpp:34
Definition: DataStreamHelpers.hpp:99
Definition: DataStreamHelpers.hpp:103
Definition: DocumentContext.hpp:18