Last change
on this file since 81 was
81,
checked in by rosiere, 16 years ago
|
- Finish Environment (and test)
- Continue predictor_unit
- Add external tools
- svn keyword "Id" set
|
-
Property svn:executable set to
*
-
Property svn:keywords set to
Id
|
File size:
1.5 KB
|
Rev | Line | |
---|
[71] | 1 | #ifdef STATISTICS |
---|
| 2 | #include "Behavioural/include/Stat_binary_tree.h" |
---|
| 3 | |
---|
| 4 | namespace morpheo { |
---|
| 5 | namespace behavioural { |
---|
| 6 | // static pair_operator_string_t operator2string [] = {std::make_pair(add,"+" ), |
---|
| 7 | // std::make_pair(sub,"-" ), |
---|
| 8 | // std::make_pair(mul,"*" ), |
---|
| 9 | // std::make_pair(div,"/" ), |
---|
| 10 | // std::make_pair(inc,"++"), |
---|
| 11 | // std::make_pair(dec,"--")}; |
---|
| 12 | |
---|
| 13 | // Stat_binary_tree:: Stat_binary_tree (data_type_t data_type, data_t data) |
---|
| 14 | // { |
---|
| 15 | // _valid_left = false; |
---|
| 16 | // _valid_right = false; |
---|
| 17 | // _data_type = data_type; |
---|
| 18 | // _data = data; |
---|
| 19 | // } |
---|
| 20 | |
---|
| 21 | Stat_binary_tree:: Stat_binary_tree (counter_t cst) |
---|
| 22 | { |
---|
| 23 | _root = NULL; |
---|
| 24 | _left = NULL; |
---|
| 25 | _right = NULL; |
---|
| 26 | |
---|
| 27 | data_t data; |
---|
| 28 | data.cst = cst; |
---|
| 29 | _data_type = CONSTANT; |
---|
| 30 | _data = data; |
---|
| 31 | |
---|
| 32 | // Stat_binary_tree(CONSTANT, data); |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | Stat_binary_tree:: Stat_binary_tree (counter_t * var) |
---|
| 36 | { |
---|
| 37 | _root = NULL; |
---|
| 38 | _left = NULL; |
---|
| 39 | _right = NULL; |
---|
| 40 | |
---|
| 41 | data_t data; |
---|
| 42 | data.var = var; |
---|
| 43 | _data_type = VARIABLE; |
---|
| 44 | _data = data; |
---|
| 45 | |
---|
| 46 | // Stat_binary_tree(VARIABLE, data); |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | Stat_binary_tree:: Stat_binary_tree (operator_t op) |
---|
| 50 | { |
---|
| 51 | _root = NULL; |
---|
| 52 | _left = NULL; |
---|
| 53 | _right = NULL; |
---|
| 54 | |
---|
| 55 | data_t data; |
---|
| 56 | data.op = op; |
---|
| 57 | _data_type = ((op == inc) or (op == dec))?OPERATOR_UNARY:OPERATOR_BINARY; |
---|
| 58 | _data = data; |
---|
| 59 | |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | Stat_binary_tree::~Stat_binary_tree (void) |
---|
| 63 | { |
---|
| 64 | if (_left != NULL) |
---|
| 65 | delete _left; |
---|
| 66 | if (_right != NULL) |
---|
| 67 | delete _right; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | }; |
---|
| 71 | }; |
---|
| 72 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.