CreateSequence.hpp
1 #pragma once
2 #include "CreateInterval_State_Event_TimeSync.hpp"
3 
4 #include <Process/State/MessageNode.hpp>
5 #include <Process/TimeValue.hpp>
6 
7 #include <Scenario/Commands/Cohesion/InterpolateMacro.hpp>
8 #include <Scenario/Commands/ScenarioCommandFactory.hpp>
9 
10 #include <score/command/Command.hpp>
11 #include <score/command/CommandStackFacade.hpp>
12 #include <score/model/Identifier.hpp>
13 #include <score/model/path/Path.hpp>
14 
15 struct DataStreamInput;
16 struct DataStreamOutput;
17 
18 namespace Scenario
19 {
20 class EventModel;
21 class IntervalModel;
22 class StateModel;
23 class TimeSyncModel;
24 class ProcessModel;
25 namespace Command
26 {
27 
29 {
30  SCORE_COMMAND_DECL(CommandFactoryName(), CreateSequence, "CreateSequence")
31 
32 public:
33  static CreateSequence* make(
34  const score::DocumentContext& ctx, const Scenario::ProcessModel& scenario,
35  const Id<StateModel>& start, const TimeVal& date, double endStateY);
36 
37  void undo(const score::DocumentContext& ctx) const override
38  {
39  m_cmds.front()->undo(ctx);
40  }
41 
42  const Id<IntervalModel>& createdInterval() const { return m_newInterval; }
43 
44  const Id<StateModel>& createdState() const { return m_newState; }
45 
46  const Id<EventModel>& createdEvent() const { return m_newEvent; }
47 
48  const Id<TimeSyncModel>& createdTimeSync() const { return m_newTimeSync; }
49 
50 private:
51  Id<IntervalModel> m_newInterval;
52  Id<StateModel> m_newState;
53  Id<EventModel> m_newEvent;
54  Id<TimeSyncModel> m_newTimeSync;
55 };
56 
58 {
59  SCORE_COMMAND_DECL(CommandFactoryName(), CreateSequenceProcesses, "CreateSequenceData")
60 
61 public:
63  const Scenario::ProcessModel& scenario, const Scenario::IntervalModel& interval);
64 
65  int addedProcessCount() const { return m_addedProcessCount; }
66 
67  void undo(const score::DocumentContext& ctx) const override;
68  void redo(const score::DocumentContext& ctx) const override;
69 
70 protected:
71  void serializeImpl(DataStreamInput&) const override;
72  void deserializeImpl(DataStreamOutput&) override;
73 
74 private:
76  AddMultipleProcessesToIntervalMacro m_interpolations;
77  Process::MessageNode m_stateData;
78  Id<StateModel> m_endState;
79  int m_addedProcessCount{};
80 };
81 }
82 }
Definition: CreateSequence.hpp:29
Definition: CreateSequence.hpp:58
Definition: IntervalModel.hpp:50
The core hierarchical and temporal process of score.
Definition: ScenarioModel.hpp:37
The id_base_t class.
Definition: Identifier.hpp:57
Allows for grouping of multiple commands in a single one.
Definition: AggregateCommand.hpp:15
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