aboutsummaryrefslogtreecommitdiff
path: root/src/tree.h
blob: 186f162164b6ca854d7106c9aaa40a93ee9b7515 (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
#ifndef PARSER_SRC_NODE_H_
#define PARSER_SRC_NODE_H_

#include <memory>
#include <string>
#include <vector>

#include "nodes.h"

namespace SimpleParser {

class Tree {
	public:
		Tree(const std::string&, const ConstantMap*);
		explicit Tree(const std::string&);

		double solve()      const;
		std::string print() const;

	private:
		template <class NType, typename... Args>
		Node* addNode(Node**, Args&&... args);
		Node* buildTree(std::string);

		const std::string  term_;
		const ConstantMap* constants_;

		std::vector<std::unique_ptr<Node>> node_collection_;
		Node* const root_node_;
};

}

#endif  // PARSER_SRC_NODE_H_