CreateEvent_State.hpp
1 #pragma once
2 #include "CreateState.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 EventModel;
19 class StateModel;
20 class ProcessModel;
21 class TimeSyncModel;
22 namespace Command
23 {
24 class SCORE_PLUGIN_SCENARIO_EXPORT CreateEvent_State final : public score::Command
25 {
26  SCORE_COMMAND_DECL(
27  CommandFactoryName(), CreateEvent_State, "Create an event and a state")
28 public:
30  const Scenario::ProcessModel& scenario, Id<TimeSyncModel> timeSync, double stateY);
31 
32  const Path<Scenario::ProcessModel>& scenarioPath() const
33  {
34  return m_command.scenarioPath();
35  }
36 
37  const Id<StateModel>& createdState() const { return m_command.createdState(); }
38 
39  const Id<EventModel>& createdEvent() const { return m_newEvent; }
40 
41  void undo(const score::DocumentContext& ctx) const override;
42  void redo(const score::DocumentContext& ctx) const override;
43 
44 protected:
45  void serializeImpl(DataStreamInput&) const override;
46  void deserializeImpl(DataStreamOutput&) override;
47 
48 private:
49  Id<EventModel> m_newEvent;
50  QString m_createdName;
51 
52  CreateState m_command;
53 
54  Id<TimeSyncModel> m_timeSync;
55 };
56 }
57 }
Definition: CreateEvent_State.hpp:25
Definition: CreateState.hpp:22
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