-
Jan Trávníček authoredJan Trávníček authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
VariableOperationAbstraction.hpp 1.69 KiB
/*
* 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_ */