Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
CommandList.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <ast/Command.h>
9
10namespace cli {
11
12class CommandList final : public Command {
14
15public:
16 CommandList ( ext::vector < std::unique_ptr < Command > > commands ) : m_commands ( std::move ( commands ) ) {
17 }
18
19 CommandResult run ( Environment & environment ) const override {
21 for ( size_t i = 0; i < m_commands.size ( ) && res == CommandResult::OK; ++ i ) {
22 res = m_commands [ i ]->run ( environment );
23 environment.clearTemporaries ( );
24
26 return res;
27 }
28
29 return res;
30 }
31
32 void append ( std::unique_ptr < Command > command ) {
33 m_commands.emplace_back ( std::move ( command ) );
34 }
35
36};
37
38} /* namespace cli */
39
void clearTemporaries()
Definition: TemporariesHolder.cpp:14
Definition: CommandList.h:12
void append(std::unique_ptr< Command > command)
Definition: CommandList.h:32
CommandResult run(Environment &environment) const override
Definition: CommandList.h:19
CommandList(ext::vector< std::unique_ptr< Command > > commands)
Definition: CommandList.h:16
Definition: Command.h:14
Definition: Environment.h:29
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
int i
Definition: AllEpsilonClosure.h:118
return res
Definition: MinimizeByPartitioning.h:145
Definition: Arg.h:11
CommandResult
Definition: CommandResult.h:10
Definition: FordFulkerson.hpp:16