summaryrefslogtreecommitdiff
path: root/value.h
blob: ba1eae1c552197ce54f4692fac4546941473ad7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

#ifndef VALUE_H_
#define VALUE_H_

#include <string>

#include "register_address.h"

class evaluator;

class value {
public:
	virtual value * simplify() = 0;
	virtual value * clone() = 0;
	virtual std::string to_string() = 0;

};

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();
	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_