Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
ImmediateExpression.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <ast/Expression.h>
9
10namespace cli {
11
12template < class Type >
13class ImmediateExpression final : public Expression {
14 Type m_value;
15
16public:
17 ImmediateExpression ( Type value ) : m_value ( std::move ( value ) ) {
18 }
19
20 std::shared_ptr < abstraction::Value > translateAndEval ( Environment & environment ) const override {
21 Type copy = m_value;
22 std::shared_ptr < abstraction::ValueHolder < Type > > value = std::make_shared < abstraction::ValueHolder < Type > > ( std::move ( copy ), true );
23 environment.holdTemporary ( value );
24 return value;
25 }
26
27};
28
29} /* namespace cli */
30
void holdTemporary(std::shared_ptr< abstraction::Value > temporary)
Definition: TemporariesHolder.cpp:10
Definition: Environment.h:29
Definition: Expression.h:14
Definition: ImmediateExpression.h:13
ImmediateExpression(Type value)
Definition: ImmediateExpression.h:17
std::shared_ptr< abstraction::Value > translateAndEval(Environment &environment) const override
Definition: ImmediateExpression.h:20
Definition: Arg.h:11
Type
Definition: MeasurementTypes.hpp:20
Definition: FordFulkerson.hpp:16