/*
 * EvalHelper.hpp
 *
 *  Created on: 25. 8. 2017
 *	  Author: Jan Travnicek
 */

#ifndef _EVAL_HELPER_HPP_
#define _EVAL_HELPER_HPP_

#include <alib/string>
#include <alib/memory>
#include <alib/vector>
#include <common/AlgorithmCategories.hpp>
#include <common/Operators.hpp>
#include <abstraction/Value.hpp>
#include <abstraction/TemporariesHolder.h>

namespace abstraction {

class EvalHelper {
	static std::shared_ptr < abstraction::Value > evalAbstraction ( abstraction::TemporariesHolder & environment, std::shared_ptr < abstraction::OperationAbstraction > abstraction, const ext::vector < std::shared_ptr < abstraction::Value > > & params );

public:
	static std::shared_ptr < abstraction::Value > evalAlgorithm ( abstraction::TemporariesHolder & environment, const std::string & name, const ext::vector < std::string > & templateParams, const ext::vector < std::shared_ptr < abstraction::Value > > & params, abstraction::AlgorithmCategories::AlgorithmCategory category );

	static std::shared_ptr < abstraction::Value > evalOperator ( abstraction::TemporariesHolder & environment, abstraction::Operators::BinaryOperators type, const ext::vector < std::shared_ptr < abstraction::Value > > & params, abstraction::AlgorithmCategories::AlgorithmCategory category );

	static std::shared_ptr < abstraction::Value > evalOperator ( abstraction::TemporariesHolder & environment, abstraction::Operators::PrefixOperators type, const ext::vector < std::shared_ptr < abstraction::Value > > & params, abstraction::AlgorithmCategories::AlgorithmCategory category );

	static std::shared_ptr < abstraction::Value > evalOperator ( abstraction::TemporariesHolder & environment, abstraction::Operators::PostfixOperators type, const ext::vector < std::shared_ptr < abstraction::Value > > & params, abstraction::AlgorithmCategories::AlgorithmCategory category );
};

} /* namespace abstraction */

#endif /* _EVAL_HELPER_HPP_ */
