CreateInterval_State.hpp
1 #pragma once
2 #include "CreateInterval.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 
16 namespace Scenario
17 {
18 class ProcessModel;
19 class EventModel;
20 class StateModel;
21 class IntervalModel;
22 
23 namespace Command
24 {
25 class SCORE_PLUGIN_SCENARIO_EXPORT CreateInterval_State final : public score::Command
26 {
27  SCORE_COMMAND_DECL(
28  CommandFactoryName(), CreateInterval_State, "Create an interval and a state")
29 public:
31  const Scenario::ProcessModel& scenario, Id<StateModel> startState,
32  Id<EventModel> endEvent, double endStateY, bool graphal);
33 
34  const Path<Scenario::ProcessModel>& scenarioPath() const
35  {
36  return m_command.scenarioPath();
37  }
38 
39  const double& endStateY() const { return m_stateY; }
40 
41  const Id<StateModel>& startState() const { return m_command.startState(); }
42 
43  const Id<IntervalModel>& createdInterval() const
44  {
45  return m_command.createdInterval();
46  }
47 
48  const Id<StateModel>& createdState() const { return m_newState; }
49 
50  void undo(const score::DocumentContext& ctx) const override;
51  void redo(const score::DocumentContext& ctx) const override;
52 
53 protected:
54  void serializeImpl(DataStreamInput&) const override;
55  void deserializeImpl(DataStreamOutput&) override;
56 
57 private:
58  QString m_createdName;
59  Id<StateModel> m_newState;
60  CreateInterval m_command;
61  Id<EventModel> m_endEvent;
62  double m_stateY{};
63 };
64 }
65 }
Definition: CreateInterval_State.hpp:26
The CreateEventAfterEventCommand class.
Definition: CreateInterval.hpp:33
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