Loading...
Searching...
No Matches
EditConnection.hpp
1#pragma once
2#include <Process/Dataflow/Port.hpp>
3
4#include <Scenario/Commands/ScenarioCommandFactory.hpp>
5#include <Scenario/Document/ScenarioDocument/ScenarioDocumentModel.hpp>
6
7#include <score/model/path/Path.hpp>
8
9namespace Dataflow
10{
11class SCORE_PLUGIN_SCENARIO_EXPORT CreateCable final : public score::Command
12{
13 SCORE_COMMAND_DECL(
14 Scenario::Command::CommandFactoryName(), CreateCable, "Create cable")
15
16public:
19 Process::CableType type, const Process::Port& source, const Process::Port& sink);
20
21 void undo(const score::DocumentContext& ctx) const override;
22 void redo(const score::DocumentContext& ctx) const override;
23
24protected:
25 void serializeImpl(DataStreamInput& s) const override;
26 void deserializeImpl(DataStreamOutput& s) override;
27
28private:
30 Id<Process::Cable> m_cable;
32 std::optional<bool> m_previousPropagate{};
33};
34
35class SCORE_PLUGIN_SCENARIO_EXPORT UpdateCable final : public score::Command
36{
37 SCORE_COMMAND_DECL(
38 Scenario::Command::CommandFactoryName(), UpdateCable, "Update cable")
39
40public:
41 UpdateCable(const Process::Cable& theCable, Process::CableType newDat);
42
43 void undo(const score::DocumentContext& ctx) const override;
44 void redo(const score::DocumentContext& ctx) const override;
45
46protected:
47 void serializeImpl(DataStreamInput& s) const override;
48 void deserializeImpl(DataStreamOutput& s) override;
49
50private:
52 Process::CableType m_old{}, m_new{};
53};
54
55class SCORE_PLUGIN_SCENARIO_EXPORT RemoveCable final : public score::Command
56{
57 SCORE_COMMAND_DECL(
58 Scenario::Command::CommandFactoryName(), RemoveCable, "Remove cable")
59
60public:
62
63 void undo(const score::DocumentContext& ctx) const override;
64 void redo(const score::DocumentContext& ctx) const override;
65
66protected:
67 void serializeImpl(DataStreamInput& s) const override;
68 void deserializeImpl(DataStreamOutput& s) override;
69
70private:
72 Id<Process::Cable> m_cable;
73 Process::CableData m_data;
74 std::optional<bool> m_previousPropagate{};
75};
76}
Definition EditConnection.hpp:12
Definition EditConnection.hpp:56
Definition EditConnection.hpp:36
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
Definition Cable.hpp:38
Definition Port.hpp:102
Definition ScenarioDocumentModel.hpp:29
The id_base_t class.
Definition Identifier.hpp:57
The Command class.
Definition Command.hpp:34
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition CableData.hpp:18
Definition DocumentContext.hpp:18