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