Last change
on this file since 141 was
124,
checked in by rosiere, 15 years ago
|
1) Add test and configuration
2) Fix Bug
3) Add log file in load store unit
4) Fix Bug in environment
|
-
Property svn:keywords set to
Id
|
File size:
1.9 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 | { |
---|
[124] | 11 | public : uint32_t port ; |
---|
[81] | 12 | public : T1 trdid ; // number of thread |
---|
| 13 | public : T2 pktid ; // number of packet |
---|
| 14 | public : uint32_t nb_word; |
---|
| 15 | public : uint32_t size_word; |
---|
| 16 | public : char ** data ; |
---|
| 17 | public : T3 error ; |
---|
| 18 | |
---|
| 19 | // public : Respons () |
---|
| 20 | // { |
---|
| 21 | // trdid = 0; |
---|
| 22 | // pktid = 0; |
---|
| 23 | // nb_word = 0; |
---|
| 24 | // size_word = 0; |
---|
| 25 | // data = NULL; |
---|
| 26 | // error = 0; |
---|
| 27 | // }; |
---|
| 28 | |
---|
[124] | 29 | public : Respons (uint32_t port , |
---|
| 30 | T1 trdid , |
---|
[81] | 31 | T2 pktid , |
---|
| 32 | uint32_t nb_word , |
---|
| 33 | uint32_t size_word, |
---|
| 34 | char ** data , |
---|
| 35 | T3 error |
---|
| 36 | ) |
---|
| 37 | { |
---|
[124] | 38 | this->port = port; |
---|
[81] | 39 | this->trdid = trdid; |
---|
| 40 | this->pktid = pktid; |
---|
| 41 | this->nb_word = nb_word; |
---|
| 42 | this->size_word = size_word; |
---|
| 43 | this->data = new char * [nb_word]; |
---|
| 44 | this->error = error; |
---|
| 45 | |
---|
| 46 | for (uint32_t i=0;i < nb_word; i++) |
---|
| 47 | { |
---|
| 48 | this->data[i] = new char [size_word]; |
---|
| 49 | memcpy(this->data[i],data[i],size_word); |
---|
| 50 | } |
---|
| 51 | }; |
---|
| 52 | |
---|
| 53 | public : ~Respons (void) |
---|
| 54 | { |
---|
| 55 | for (uint32_t i=0; i<nb_word; i++) |
---|
| 56 | delete [] data [i]; |
---|
| 57 | delete [] data; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | public : friend std::ostream& operator<< (std::ostream& output, Respons x) |
---|
| 61 | { |
---|
[124] | 62 | output << x.port << " " |
---|
| 63 | << x.trdid << " " |
---|
[81] | 64 | << x.pktid << " " |
---|
| 65 | << x.error << " "; |
---|
| 66 | |
---|
| 67 | output << std::hex; |
---|
| 68 | |
---|
| 69 | for (uint32_t i = 0; i < x.nb_word; i ++) |
---|
| 70 | { |
---|
| 71 | for (uint32_t j = x.size_word; j > 0 ; j --) |
---|
| 72 | output << std::setw(2) << std::setfill('0') << (0xff & (static_cast<uint32_t>(x.data [i][j-1]))); |
---|
| 73 | output << " - "; |
---|
| 74 | } |
---|
| 75 | output << std::dec; |
---|
| 76 | |
---|
| 77 | return output; |
---|
| 78 | } |
---|
| 79 | }; |
---|
| 80 | |
---|
| 81 | }; |
---|
| 82 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.