Newer
Older
/*
* AlgorithmAbstraction.hpp
*
* Created on: 11. 7. 2017
* Author: Jan Travnicek
*/
#ifndef _ALGORITHM_ABSTRACTION_HPP_
#define _ALGORITHM_ABSTRACTION_HPP_
#include <abstraction/NaryOperationAbstraction.hpp>
#include <registry/Registry.h>
namespace abstraction {
template < class ReturnType, class ... ParamTypes >
class AlgorithmAbstraction : public NaryOperationAbstraction < ReturnType, ParamTypes ... > {
std::function < ReturnType ( ParamTypes ... ) > m_callback;
AlgorithmAbstraction ( std::function < ReturnType ( ParamTypes ... ) > callback ) : m_callback ( callback ) {
}
virtual bool run ( ) override {
if ( ! this->inputsReady ( ) )
return false;
if ( this->cached ( ) )
return true;
this->run_helper ( m_callback, this->m_params, this->m_moves, std::make_index_sequence < sizeof ... ( ParamTypes ) > { } );
return true;
}
};
} /* namespace abstraction */
#endif /* _ALGORITHM_ABSTRACTION_HPP_ */