SplitTimeSync.hpp
1 #pragma once
2 
3 #include <Scenario/Commands/ScenarioCommandFactory.hpp>
4 
5 #include <score/command/Command.hpp>
6 #include <score/model/Identifier.hpp>
7 #include <score/model/path/Path.hpp>
8 #include <score/tools/std/Optional.hpp>
9 
10 #include <QVector>
11 
12 struct DataStreamInput;
13 struct DataStreamOutput;
14 
15 namespace Scenario
16 {
17 class EventModel;
18 class TimeSyncModel;
19 namespace Command
20 {
21 class SplitTimeSync final : public score::Command
22 {
23  SCORE_COMMAND_DECL(CommandFactoryName(), SplitTimeSync, "Desynchronize")
24 public:
26  const TimeSyncModel& path, std::vector<Id<EventModel>> eventsInNewTimeSync);
27  void undo(const score::DocumentContext& ctx) const override;
28  void redo(const score::DocumentContext& ctx) const override;
29 
30 protected:
31  void serializeImpl(DataStreamInput&) const override;
32  void deserializeImpl(DataStreamOutput&) override;
33 
34 private:
35  Path<TimeSyncModel> m_path;
36  std::vector<Id<EventModel>> m_eventsInNewTimeSync;
37 
38  Id<TimeSyncModel> m_originalTimeSyncId;
39  Id<TimeSyncModel> m_newTimeSyncId;
40 };
41 
42 class SCORE_PLUGIN_SCENARIO_EXPORT SplitWholeSync final : public score::Command
43 {
44  SCORE_COMMAND_DECL(CommandFactoryName(), SplitWholeSync, "Desynchronize")
45 public:
46  SplitWholeSync(const TimeSyncModel& path);
47  SplitWholeSync(const TimeSyncModel& path, std::vector<Id<TimeSyncModel>> new_ids);
48  void undo(const score::DocumentContext& ctx) const override;
49  void redo(const score::DocumentContext& ctx) const override;
50 
51 protected:
52  void serializeImpl(DataStreamInput&) const override;
53  void deserializeImpl(DataStreamOutput&) override;
54 
55 private:
56  Path<TimeSyncModel> m_path;
57 
58  Id<TimeSyncModel> m_originalTimeSync;
59  std::vector<Id<TimeSyncModel>> m_newTimeSyncs;
60 };
61 }
62 }
The Path class is a typesafe wrapper around ObjectPath.
Definition: Path.hpp:52
Definition: SplitTimeSync.hpp:22
Definition: SplitTimeSync.hpp:43
Definition: TimeSyncModel.hpp:34
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:14
Definition: DataStreamHelpers.hpp:99
Definition: DataStreamHelpers.hpp:103
Definition: DocumentContext.hpp:18