#ifndef VALUE_H_ #define VALUE_H_ #include #include "register_address.h" class evaluator; enum value_type { VALUE_TYPE_GENERIC, VALUE_TYPE_TREE, VALUE_TYPE_CONST, VALUE_TYPE_FLOAT }; class value { public: value(enum value_type type); virtual value * simplify() = 0; virtual value * clone() = 0; virtual std::string to_string() = 0; enum value_type get_type(); private: enum value_type m_type; }; class tree_value : public value { public: tree_value(evaluator *, value * lchild, value * rchild); value * simplify(); value * clone(); std::string to_string(); private: evaluator * m_evaluator; value * m_lchild; value * m_rchild; }; class float_value : public value { public: float_value(); float_value(float init_value); value * simplify(); value * clone(); std::string to_string(); void set_value(float value); bool m_has_value; float m_value; }; class const_value : public value { public: const_value( register_address reg, float_value * value); value * simplify(); value * clone(); std::string to_string(); private: register_address m_reg_address; float_value * m_value; }; #endif //VALUE_H_