Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
ResultFileStatement.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <ast/Statement.h>
9
11
12namespace cli {
13
14class ResultFileStatement final : public Statement {
15 std::unique_ptr < cli::Arg > m_file;
16 std::unique_ptr < Arg > m_fileType;
17
18public:
19 ResultFileStatement ( std::unique_ptr < cli::Arg > file, std::unique_ptr < Arg > fileType ) : m_file ( std::move ( file ) ), m_fileType ( std::move ( fileType ) ) {
20 }
21
22 std::shared_ptr < abstraction::Value > translateAndEval ( const std::shared_ptr < abstraction::Value > & prev, Environment & environment ) const override {
23 std::string filetype = "xml";
24 if ( m_fileType )
25 filetype = m_fileType->eval ( environment );
26
27 std::shared_ptr < abstraction::OperationAbstraction > res = abstraction::OutputFileRegistry::getAbstraction ( filetype, prev->getType ( ) );
28
29 std::shared_ptr < abstraction::ValueHolder < std::string > > file = std::make_shared < abstraction::ValueHolder < std::string > > ( m_file->eval ( environment ), true );
30 res->attachInput ( file, 0 );
31 res->attachInput ( prev, 1 );
32 return res->eval ( );
33 }
34
35};
36
37} /* namespace cli */
38
static std::shared_ptr< abstraction::OperationAbstraction > getAbstraction(const std::string &fileType, const std::string &typehint)
Definition: OutputFileRegistry.cpp:26
Definition: Environment.h:29
Definition: ResultFileStatement.h:14
std::shared_ptr< abstraction::Value > translateAndEval(const std::shared_ptr< abstraction::Value > &prev, Environment &environment) const override
Definition: ResultFileStatement.h:22
ResultFileStatement(std::unique_ptr< cli::Arg > file, std::unique_ptr< Arg > fileType)
Definition: ResultFileStatement.h:19
Definition: Statement.h:14
return res
Definition: MinimizeByPartitioning.h:145
Definition: Arg.h:11
Definition: FordFulkerson.hpp:16