Last change
on this file since 112 was
81,
checked in by rosiere, 17 years ago
|
- Finish Environment (and test)
- Continue predictor_unit
- Add external tools
- svn keyword "Id" set
|
-
Property svn:keywords set to
Id
|
File size:
1.7 KB
|
Rev | Line | |
---|
[81] | 1 | #ifndef ENVIRONMENT_RESPONS_H |
---|
| 2 | #define ENVIRONMENT_RESPONS_H |
---|
| 3 | |
---|
| 4 | #include "Types.h" |
---|
| 5 | |
---|
| 6 | namespace environment { |
---|
| 7 | |
---|
| 8 | template <class T1, class T2, class T3> |
---|
| 9 | class Respons |
---|
| 10 | { |
---|
| 11 | public : T1 trdid ; // number of thread |
---|
| 12 | public : T2 pktid ; // number of packet |
---|
| 13 | public : uint32_t nb_word; |
---|
| 14 | public : uint32_t size_word; |
---|
| 15 | public : char ** data ; |
---|
| 16 | public : T3 error ; |
---|
| 17 | |
---|
| 18 | // public : Respons () |
---|
| 19 | // { |
---|
| 20 | // trdid = 0; |
---|
| 21 | // pktid = 0; |
---|
| 22 | // nb_word = 0; |
---|
| 23 | // size_word = 0; |
---|
| 24 | // data = NULL; |
---|
| 25 | // error = 0; |
---|
| 26 | // }; |
---|
| 27 | |
---|
| 28 | public : Respons (T1 trdid , |
---|
| 29 | T2 pktid , |
---|
| 30 | uint32_t nb_word , |
---|
| 31 | uint32_t size_word, |
---|
| 32 | char ** data , |
---|
| 33 | T3 error |
---|
| 34 | ) |
---|
| 35 | { |
---|
| 36 | this->trdid = trdid; |
---|
| 37 | this->pktid = pktid; |
---|
| 38 | this->nb_word = nb_word; |
---|
| 39 | this->size_word = size_word; |
---|
| 40 | this->data = new char * [nb_word]; |
---|
| 41 | this->error = error; |
---|
| 42 | |
---|
| 43 | for (uint32_t i=0;i < nb_word; i++) |
---|
| 44 | { |
---|
| 45 | this->data[i] = new char [size_word]; |
---|
| 46 | memcpy(this->data[i],data[i],size_word); |
---|
| 47 | } |
---|
| 48 | }; |
---|
| 49 | |
---|
| 50 | public : ~Respons (void) |
---|
| 51 | { |
---|
| 52 | for (uint32_t i=0; i<nb_word; i++) |
---|
| 53 | delete [] data [i]; |
---|
| 54 | delete [] data; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | public : friend std::ostream& operator<< (std::ostream& output, Respons x) |
---|
| 58 | { |
---|
| 59 | output << x.trdid << " " |
---|
| 60 | << x.pktid << " " |
---|
| 61 | << x.error << " "; |
---|
| 62 | |
---|
| 63 | output << std::hex; |
---|
| 64 | |
---|
| 65 | for (uint32_t i = 0; i < x.nb_word; i ++) |
---|
| 66 | { |
---|
| 67 | for (uint32_t j = x.size_word; j > 0 ; j --) |
---|
| 68 | output << std::setw(2) << std::setfill('0') << (0xff & (static_cast<uint32_t>(x.data [i][j-1]))); |
---|
| 69 | output << " - "; |
---|
| 70 | } |
---|
| 71 | output << std::dec; |
---|
| 72 | |
---|
| 73 | return output; |
---|
| 74 | } |
---|
| 75 | }; |
---|
| 76 | |
---|
| 77 | }; |
---|
| 78 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.