oop_and_ml/src/eval_op.h

27 lines
No EOL
661 B
C++
Executable file

#ifndef EVAL_OP_H
#define EVAL_OP_H
#include <map>
#include "expression.h"
#include "assert.h"
#include <memory>
// typedef introduces alias for types.
typedef std::map<int, tensor> vars_type;
typedef std::map<std::string, tensor> kwargs_type;
class eval_op {
protected:
friend class evaluation;
eval_op(): expr_id_(-1) {}
eval_op(const expression &expr);
int expr_id_;
std::string op_name_, op_type_;
std::vector<int> inputs_;
public:
virtual ~eval_op();
virtual void eval(vars_type &variables, const kwargs_type &kwargs) = 0;
virtual std::shared_ptr<eval_op> clone(const expression &expr) = 0;
}; //class eval_op
#endif