Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* VariableOperationAbstraction.hpp
*
* Created on: 11. 7. 2017
* Author: Jan Travnicek
*/
#ifndef _VARIABLE_OPERATION_ABSTRACTION_HPP_
#define _VARIABLE_OPERATION_ABSTRACTION_HPP_
#include <alib/memory>
#include <alib/typeindex>
#include <abstraction/NaryOperationAbstractionImpl.hpp>
#include <abstraction/ValueOperationAbstraction.hpp>
#include <common/ParamQualifiers.hpp>
namespace abstraction {
template < class Type >
class VariableOperationAbstraction : virtual public NaryOperationAbstractionImpl < 1 >, virtual public ValueOperationAbstraction < Type > {
bool isAutoMove ( ) const override {
return false;
}
bool checkInput ( const std::shared_ptr < OperationAbstraction > & input, size_t index ) const override {
return abstraction::checkInput < ValueInterface < Type > > ( input, index );
}
public:
bool run ( ) override {
this->template run_helper < Type > ( []( Type value ) -> Type { return std::forward < Type > ( value ); }, this->getParams ( ) );
return true;
}
ext::type_index getParamTypeIndex ( size_t index ) const override {
return abstraction::paramType < Type > ( index );
}
ext::set < abstraction::ParamQualifiers::ParamQualifier > getParamTypeQualifiers ( size_t index ) const override {
return abstraction::paramTypeQualifiers < Type > ( index );
}
std::shared_ptr < abstraction::OperationAbstraction > getVariableOperationAbstraction ( ) override {
std::shared_ptr < abstraction::OperationAbstraction > res = std::make_shared < abstraction::VariableOperationAbstraction < Type > > ( );
res->attachInput ( this->getProxyAbstraction ( ), 0, false, false );
return res;
}
};
} /* namespace abstraction */
#endif /* _VARIABLE_OPERATION_ABSTRACTION_HPP_ */