Skip to content

Commit 1940b5c

Browse files
committed
adds expression tree node base class
1 parent dd48667 commit 1940b5c

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

include/attwoodn/expression_tree.hpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#include <iostream>
4-
53
namespace attwoodn::expression_tree {
64

75
namespace op {
@@ -28,7 +26,21 @@ namespace attwoodn::expression_tree {
2826

2927
}
3028

31-
static inline void say_hello() {
32-
std::cout << "hello world!" << std::endl;
29+
namespace tree {
30+
31+
/**
32+
* The base class representing expression tree nodes
33+
*/
34+
template<typename Obj>
35+
class expression_tree_node_base {
36+
public:
37+
virtual ~expression_tree_node_base() {};
38+
virtual bool evaluate(const Obj& obj) = 0;
39+
};
40+
41+
class expression_tree_op_node;
42+
class expression_tree_leaf_node;
43+
44+
3345
}
3446
}

tests/test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#include <attwoodn/expression_tree.hpp>
1+
#include <iostream>
22

33
int main(int argc, char** argv) {
4-
attwoodn::expression_tree::say_hello();
4+
std::cout << "hello world!" << std::endl;
55

66
return EXIT_SUCCESS;
77
}

0 commit comments

Comments
 (0)