score
Home
Classes
Namespaces
Files
CreationMetaCommand.hpp
1
#pragma once
2
#include "CreateEvent_State.hpp"
3
#include "CreateInterval.hpp"
4
#include "CreateInterval_State.hpp"
5
#include "CreateInterval_State_Event.hpp"
6
#include "CreateInterval_State_Event_TimeSync.hpp"
7
#include "CreateSequence.hpp"
8
#include "CreateState.hpp"
9
10
#include <score/command/AggregateCommand.hpp>
11
12
#include <boost/range/adaptor/reversed.hpp>
13
namespace
Scenario
14
{
15
namespace
Command
16
{
17
class
CreationMetaCommand
final :
public
score::AggregateCommand
18
{
19
SCORE_COMMAND_DECL(
20
CommandFactoryName(),
CreationMetaCommand
,
"Create elements in scenario"
)
21
public
:
22
void
undo(
const
score::DocumentContext
& ctx)
const override
23
{
24
// We only undo the creation commands
25
// since the move ones perform unnecessary serialization / etc in this case
26
// and don't bring anything to the table.
27
// TODO REFACTOR WITH SCENARIOROLLBACKSTRATEGY
28
for
(
auto
& cmd : boost::adaptors::reverse(m_cmds))
29
{
30
if
(cmd->key() == CreateInterval::static_key()
31
|| cmd->key() == CreateState::static_key()
32
|| cmd->key() == CreateEvent_State::static_key()
33
|| cmd->key() == CreateInterval_State::static_key()
34
|| cmd->key() == CreateInterval_State_Event::static_key()
35
|| cmd->key() == CreateInterval_State_Event_TimeSync::static_key()
36
|| cmd->key() == CreateSequence::static_key())
37
{
38
cmd->undo(ctx);
39
}
40
}
41
}
42
};
43
}
44
}
Scenario::Command::CreationMetaCommand
Definition:
CreationMetaCommand.hpp:18
score::AggregateCommand
Allows for grouping of multiple commands in a single one.
Definition:
AggregateCommand.hpp:15
Scenario
Main plug-in of score.
Definition:
score-plugin-dataflow/Dataflow/PortItem.hpp:14
score::DocumentContext
Definition:
DocumentContext.hpp:18