Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
BlockCommand.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <ast/Command.h>
9
10namespace cli {
11
12class BlockCommand final : public Command {
13 std::unique_ptr < Command > m_innerCommand;
14
15public:
16 BlockCommand ( std::unique_ptr < Command > innerCommand ) : m_innerCommand ( std::move ( innerCommand ) ) {
17 }
18
19 CommandResult run ( Environment & environment ) const override {
20 Environment newEnvironment { ext::optional_ref < Environment > ( environment ) };
21 CommandResult res = m_innerCommand->run ( newEnvironment );
22 if ( newEnvironment.getResult ( ) )
23 environment.setResult ( newEnvironment.getResult ( ) );
24 return res;
25 }
26
27};
28
29} /* namespace cli */
30
Definition: BlockCommand.h:12
CommandResult run(Environment &environment) const override
Definition: BlockCommand.h:19
BlockCommand(std::unique_ptr< Command > innerCommand)
Definition: BlockCommand.h:16
Definition: Command.h:14
Definition: Environment.h:29
void setResult(std::shared_ptr< abstraction::Value > value)
Definition: Environment.h:101
Definition: optional_ref.hpp:33
return res
Definition: MinimizeByPartitioning.h:145
Definition: Arg.h:11
CommandResult
Definition: CommandResult.h:10
Definition: FordFulkerson.hpp:16