[71] | 1 | #ifdef STATISTICS |
---|
| 2 | #include "Behavioural/include/Stat.h" |
---|
| 3 | |
---|
| 4 | namespace morpheo { |
---|
| 5 | namespace behavioural { |
---|
| 6 | |
---|
| 7 | Stat::Stat (std::string name_instance, |
---|
| 8 | std::string name_component, |
---|
| 9 | Parameters_Statistics * param): |
---|
| 10 | _name_instance (name_instance), |
---|
| 11 | _name_component (name_component), |
---|
| 12 | _nb_cycle_before_begin (static_cast<cycle_t>(param->_nb_cycle_before_begin)), |
---|
| 13 | _period (static_cast<cycle_t>(param->_period_save)), |
---|
| 14 | _save_periodic (_period>0) |
---|
| 15 | { |
---|
| 16 | _list_operand = new std::map<std::string, var_t>; |
---|
| 17 | _list_expr = new std::list<expr_t>; |
---|
| 18 | |
---|
| 19 | _cycle = create_variable("cycle"); |
---|
| 20 | *_cycle = 0; // for the first period |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | Stat::Stat (std::string name_instance, |
---|
| 24 | std::string name_component, |
---|
| 25 | cycle_t nb_cycle_before_begin, |
---|
| 26 | cycle_t period): |
---|
| 27 | _name_instance (name_instance), |
---|
| 28 | _name_component (name_component), |
---|
| 29 | _nb_cycle_before_begin (nb_cycle_before_begin), |
---|
| 30 | _period (period), |
---|
| 31 | _save_periodic (period>0) |
---|
| 32 | { |
---|
| 33 | _list_operand = new std::map<std::string, var_t>; |
---|
| 34 | _list_expr = new std::list<expr_t>; |
---|
| 35 | |
---|
| 36 | _cycle = create_variable("cycle"); |
---|
| 37 | *_cycle = 0; // for the first period |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | Stat::~Stat (void) |
---|
| 41 | { |
---|
| 42 | generate_file(); |
---|
| 43 | |
---|
| 44 | // parcourir la liste et desallouer les counters |
---|
| 45 | for (std::map<std::string, var_t>::iterator i=_list_operand->begin(); |
---|
| 46 | i!= _list_operand->end(); |
---|
| 47 | ++i) |
---|
| 48 | { |
---|
| 49 | delete i->second.counter; |
---|
| 50 | } |
---|
| 51 | delete _list_operand; |
---|
| 52 | |
---|
| 53 | // parcourir la liste et desallouer les arbres |
---|
| 54 | for (std::list<expr_t>::iterator i=_list_expr->begin(); |
---|
| 55 | i!= _list_expr->end(); |
---|
| 56 | ++i) |
---|
| 57 | { |
---|
| 58 | delete i->expression; |
---|
| 59 | } |
---|
| 60 | delete _list_expr; |
---|
| 61 | } |
---|
| 62 | }; |
---|
| 63 | }; |
---|
| 64 | #endif |
---|