CreateInterval_State_Event.hpp
1 #pragma once
2 #include "CreateInterval_State.hpp"
3 
4 #include <Scenario/Commands/ScenarioCommandFactory.hpp>
5 
6 #include <score/command/Command.hpp>
7 #include <score/model/Identifier.hpp>
8 #include <score/model/path/Path.hpp>
9 #include <score/tools/std/Optional.hpp>
10 
11 #include <QString>
12 
13 struct DataStreamInput;
14 struct DataStreamOutput;
15 namespace Scenario
16 {
17 class ProcessModel;
18 class EventModel;
19 class StateModel;
20 class TimeSyncModel;
21 class IntervalModel;
22 namespace Command
23 {
24 class SCORE_PLUGIN_SCENARIO_EXPORT CreateInterval_State_Event final
25  : public score::Command
26 {
27  SCORE_COMMAND_DECL(
28  CommandFactoryName(), CreateInterval_State_Event,
29  "Create an interval, a state and an event")
30 public:
32  const Scenario::ProcessModel& scenario, Id<StateModel> startState,
33  Id<TimeSyncModel> endTimeSync, double endStateY, bool graphal);
34 
35  const Path<Scenario::ProcessModel>& scenarioPath() const
36  {
37  return m_command.scenarioPath();
38  }
39 
40  const double& endStateY() const { return m_command.endStateY(); }
41 
42  const Id<IntervalModel>& createdInterval() const
43  {
44  return m_command.createdInterval();
45  }
46 
47  const Id<StateModel>& startState() const { return m_command.startState(); }
48 
49  const Id<StateModel>& createdState() const { return m_command.createdState(); }
50 
51  const Id<EventModel>& createdEvent() const { return m_newEvent; }
52 
53  void undo(const score::DocumentContext& ctx) const override;
54  void redo(const score::DocumentContext& ctx) const override;
55 
56 protected:
57  void serializeImpl(DataStreamInput&) const override;
58  void deserializeImpl(DataStreamOutput&) override;
59 
60 private:
61  Id<EventModel> m_newEvent;
62  QString m_createdName;
63 
64  CreateInterval_State m_command;
65 
66  Id<TimeSyncModel> m_endTimeSync;
67 };
68 }
69 }
Definition: CreateInterval_State_Event.hpp:26
Definition: CreateInterval_State.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: DocumentContext.hpp:18