aboutsummaryrefslogtreecommitdiff
path: root/src/tree.h
blob: 1b673a2788e0961e5939c52011a02afc9cd12071 (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
#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 Type, typename... Args>
		typename std::add_pointer<Type>::type addNode(Args&&... args);

		Node* buildTree(const 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_