Rev | Line | |
---|
[2] | 1 | #ifdef STATISTICS |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | * $Id$ |
---|
| 5 | * |
---|
| 6 | * [ Description ] |
---|
| 7 | * |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #include "Behavioural/include/Statistics.h" |
---|
| 11 | #include <time.h> |
---|
| 12 | #include <sstream> |
---|
| 13 | #include <fstream> |
---|
| 14 | using namespace std; |
---|
| 15 | |
---|
| 16 | namespace morpheo { |
---|
| 17 | namespace behavioural { |
---|
| 18 | |
---|
| 19 | void Statistics::generate_file(string stat) |
---|
| 20 | { |
---|
| 21 | ostringstream filename; |
---|
| 22 | filename << _name << ".stat"; |
---|
| 23 | |
---|
| 24 | cout << "Generate file \""<< filename.str() << "\"" << endl; |
---|
| 25 | |
---|
| 26 | ofstream file; |
---|
| 27 | file.open(filename.str().c_str(),ios::out | ios::trunc); |
---|
| 28 | |
---|
| 29 | time_t current_time; |
---|
| 30 | time (¤t_time); |
---|
| 31 | |
---|
| 32 | // print header |
---|
| 33 | file << "<!-- " << endl |
---|
| 34 | << "\tfile : " << filename.str() << endl |
---|
| 35 | << "\tdate : " << ctime (¤t_time ) |
---|
| 36 | << "\tcomment : it's a autogenerated file : don't modify" << endl |
---|
| 37 | << "-->" << endl |
---|
| 38 | << endl; |
---|
| 39 | |
---|
| 40 | file << stat; |
---|
| 41 | |
---|
| 42 | file.close(); |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | void Statistics::generate_file(void) |
---|
| 46 | { |
---|
| 47 | generate_file(print(0)); |
---|
| 48 | }; |
---|
| 49 | |
---|
| 50 | }; // end namespace behavioural |
---|
| 51 | }; // end namespace morpheo |
---|
| 52 | |
---|
| 53 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.