CreateInterval_State_Event_TimeSync.hpp
1 #pragma once
2 #include "CreateInterval_State_Event.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 
19 namespace Scenario
20 {
21 class ProcessModel;
22 class IntervalModel;
23 class EventModel;
24 class StateModel;
25 class TimeSyncModel;
26 namespace Command
27 {
28 class SCORE_PLUGIN_SCENARIO_EXPORT CreateInterval_State_Event_TimeSync final
29  : public score::Command
30 {
31  SCORE_COMMAND_DECL(
32  CommandFactoryName(), CreateInterval_State_Event_TimeSync,
33  "Create an interval, a state, an event and a sync")
34 public:
36  const Scenario::ProcessModel& scenario, Id<StateModel> startState, TimeVal date,
37  double endStateY, bool graphal);
38 
39  const Path<Scenario::ProcessModel>& scenarioPath() const
40  {
41  return m_command.scenarioPath();
42  }
43 
44  const Id<IntervalModel>& createdInterval() const
45  {
46  return m_command.createdInterval();
47  }
48 
49  const Id<StateModel>& startState() const { return m_command.startState(); }
50 
51  const Id<StateModel>& createdState() const { return m_command.createdState(); }
52 
53  const Id<EventModel>& createdEvent() const { return m_command.createdEvent(); }
54 
55  const Id<TimeSyncModel>& createdTimeSync() const { return m_newTimeSync; }
56 
57  void undo(const score::DocumentContext& ctx) const override;
58  void redo(const score::DocumentContext& ctx) const override;
59 
60 protected:
61  void serializeImpl(DataStreamInput&) const override;
62  void deserializeImpl(DataStreamOutput&) override;
63 
64 private:
65  Id<TimeSyncModel> m_newTimeSync;
66  QString m_createdName;
67 
69 
70  TimeVal m_date;
71 };
72 }
73 }
Definition: CreateInterval_State_Event_TimeSync.hpp:30
Definition: CreateInterval_State_Event.hpp:26
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