21 template <
typename... Args>
24 , m_aggregateCommand{std::make_unique<Command_T>()}
27 std::is_base_of<score::AggregateCommand, Command_T>::value,
28 "MacroCommandDispatcher: Command_T must be AggregateCommand-derived");
31 template <
typename... Args>
33 std::unique_ptr<score::AggregateCommand> cmd, Args&&... args)
35 , m_aggregateCommand{std::move(cmd)}
37 SCORE_ASSERT(m_aggregateCommand);
44 RedoStrategy_T::redo(stack().context(), *cmd);
46 m_aggregateCommand->addCommand(cmd);
51 if(m_aggregateCommand)
53 if(m_aggregateCommand->count() != 0)
55 SendStrategy_T::send(stack(), m_aggregateCommand.release());
58 m_aggregateCommand.reset();
64 if(m_aggregateCommand)
67 m_aggregateCommand->undo(stack().context());
68 m_aggregateCommand.reset();
72 void release() { m_aggregateCommand.release(); }
74 auto command()
const {
return m_aggregateCommand.get(); }
77 std::unique_ptr<Command_T> m_aggregateCommand;