Loading...
Searching...
No Matches
SplitEvent.hpp
1#pragma once
2
3#include <Scenario/Commands/ScenarioCommandFactory.hpp>
4
5#include <score/command/AggregateCommand.hpp>
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#include <QVector>
13
14struct DataStreamInput;
15struct DataStreamOutput;
16
17namespace Scenario
18{
19class ProcessModel;
20class EventModel;
21class StateModel;
22
23namespace Command
24{
25class SplitEvent final : public score::Command
26{
27 SCORE_COMMAND_DECL(CommandFactoryName(), SplitEvent, "Split an event")
28
29public:
31 const Scenario::ProcessModel& scenario, Id<EventModel> event,
32 std::vector<Id<StateModel>> movingstates);
34 const Scenario::ProcessModel& scenario, Id<EventModel> event,
35 Id<EventModel> new_event, std::vector<Id<StateModel>> movingstates);
36
37 void undo(const score::DocumentContext& ctx) const override;
38 void redo(const score::DocumentContext& ctx) const override;
39
40 const Id<EventModel>& newEvent() const { return m_newEvent; }
41
42protected:
43 void serializeImpl(DataStreamInput&) const override;
44 void deserializeImpl(DataStreamOutput&) override;
45
46private:
47 Path<Scenario::ProcessModel> m_scenarioPath;
48
49 Id<EventModel> m_originalEvent;
50 Id<EventModel> m_newEvent;
51 QString m_createdName;
52 std::vector<Id<StateModel>> m_movingStates;
53};
54
55class SCORE_PLUGIN_SCENARIO_EXPORT SplitWholeEvent final : public score::Command
56{
57 SCORE_COMMAND_DECL(CommandFactoryName(), SplitWholeEvent, "Split an event")
58public:
59 SplitWholeEvent(const EventModel& path);
60 void undo(const score::DocumentContext& ctx) const override;
61 void redo(const score::DocumentContext& ctx) const override;
62
63protected:
64 void serializeImpl(DataStreamInput&) const override;
65 void deserializeImpl(DataStreamOutput&) override;
66
67private:
68 Path<EventModel> m_path;
69
70 Id<EventModel> m_originalEvent;
71 std::vector<Id<EventModel>> m_newEvents;
72};
73
75{
76 SCORE_COMMAND_DECL(CommandFactoryName(), SplitStateMacro, "Split state from node")
77};
78}
79}
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
Definition SplitEvent.hpp:26
Definition SplitEvent.hpp:75
Definition SplitEvent.hpp:56
Definition EventModel.hpp:36
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:13
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition DocumentContext.hpp:18