CreateTimeSync_Event_State.hpp
1 #pragma once
2 #include "CreateEvent_State.hpp"
3 
4 #include <Process/TimeValue.hpp>
5 
6 #include <Scenario/Commands/ScenarioCommandFactory.hpp>
7 
8 #include <score/command/Command.hpp>
9 #include <score/model/Identifier.hpp>
10 #include <score/model/path/Path.hpp>
11 #include <score/tools/std/Optional.hpp>
12 
13 #include <QString>
14 
15 #include <score_plugin_scenario_export.h>
16 struct DataStreamInput;
17 struct DataStreamOutput;
18 namespace Scenario
19 {
20 class ProcessModel;
21 class EventModel;
22 class StateModel;
23 class TimeSyncModel;
24 namespace Command
25 {
26 class SCORE_PLUGIN_SCENARIO_EXPORT CreateTimeSync_Event_State final
27  : public score::Command
28 {
29  SCORE_COMMAND_DECL(
30  CommandFactoryName(), CreateTimeSync_Event_State,
31  "Create a timesync, an event and a state")
32 public:
34  const Scenario::ProcessModel& scenario, TimeVal date, double stateY);
35 
36  const Path<Scenario::ProcessModel>& scenarioPath() const
37  {
38  return m_command.scenarioPath();
39  }
40 
41  const Id<StateModel>& createdState() const { return m_command.createdState(); }
42 
43  const Id<EventModel>& createdEvent() const { return m_command.createdEvent(); }
44 
45  const Id<TimeSyncModel>& createdTimeSync() const { return m_newTimeSync; }
46 
47  void undo(const score::DocumentContext& ctx) const override;
48  void redo(const score::DocumentContext& ctx) const override;
49 
50 protected:
51  void serializeImpl(DataStreamInput&) const override;
52  void deserializeImpl(DataStreamOutput&) override;
53 
54 private:
55  Id<TimeSyncModel> m_newTimeSync;
56  QString m_createdName;
57  TimeVal m_date;
58 
59  CreateEvent_State m_command;
60 };
61 }
62 }
Definition: CreateEvent_State.hpp:25
Definition: CreateTimeSync_Event_State.hpp:28
The core hierarchical and temporal process of score.
Definition: ScenarioModel.hpp:37
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: TimeValue.hpp:21
Definition: DocumentContext.hpp:18