Loading...
Searching...
No Matches
CreateState.hpp
1#pragma once
2#include <Scenario/Commands/ScenarioCommandFactory.hpp>
3
4#include <score/command/Command.hpp>
5#include <score/model/Identifier.hpp>
6#include <score/model/path/Path.hpp>
7#include <score/tools/std/Optional.hpp>
8
9#include <QString>
10
11struct DataStreamInput;
12struct DataStreamOutput;
13
14namespace Scenario
15{
16class ProcessModel;
17class EventModel;
18class StateModel;
19namespace Command
20{
21class SCORE_PLUGIN_SCENARIO_EXPORT CreateState final : public score::Command
22{
23 SCORE_COMMAND_DECL(CommandFactoryName(), CreateState, "Create a state")
24public:
26 const Scenario::ProcessModel& scenario, Id<EventModel> event, double stateY);
28 const Scenario::ProcessModel& scenario, Id<StateModel> newId, Id<EventModel> event,
29 double stateY);
30
31 const Path<Scenario::ProcessModel>& scenarioPath() const { return m_path; }
32
33 const double& endStateY() const { return m_stateY; }
34
35 const Id<StateModel>& createdState() const { return m_newState; }
36
37 void undo(const score::DocumentContext& ctx) const override;
38 void redo(const score::DocumentContext& ctx) const override;
39
40protected:
41 void serializeImpl(DataStreamInput&) const override;
42 void deserializeImpl(DataStreamOutput&) override;
43
44private:
46 QString m_createdName;
47 Id<StateModel> m_newState;
48 Id<EventModel> m_event;
49 double m_stateY{};
50};
51}
52}
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
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:13
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition DocumentContext.hpp:18