source: trunk/IPs/systemC/hierarchy_memory/file/entry.h @ 2

Last change on this file since 2 was 2, checked in by kane, 17 years ago

Import Morpheo

File size: 1.7 KB
Line 
1#ifndef ENTRY_H
2#define ENTRY_H
3
4#include <stdint.h>
5#include <iostream>
6
7using namespace std; // Utilisation de l'espace de nommage standard
8
9namespace hierarchy_memory
10{
11  namespace sort_file
12  {
13    class Entry
14    {
15    public : uint32_t   trdid  ;  // number of thread
16    public : uint32_t   pktid  ;  // number of packet
17    public : uint32_t   nb_word;
18    public : uint32_t   size_word;
19    public : char    ** data   ;
20    public : uint32_t   error  ;
21     
22      Entry () {};
23     
24      Entry (uint32_t   trdid    ,
25             uint32_t   pktid    ,
26             uint32_t   nb_word  ,
27             uint32_t   size_word,
28             char    ** data     ,
29             uint32_t   error
30             )
31      {
32        this->trdid     = trdid;
33        this->pktid     = pktid;
34        this->nb_word   = nb_word;
35        this->size_word = size_word;
36        this->data      = new char * [nb_word];
37        this->error     = error;
38
39        for (uint32_t num_word = 0; num_word < nb_word; num_word++)
40          {
41            this->data[num_word] = new char [size_word];
42            memcpy(this->data[num_word],data[num_word],size_word);
43          }
44      };
45     
46      friend ostream& operator<< (ostream& output_stream, Entry x)
47      {
48        output_stream << x.trdid              << " " 
49                      << x.pktid              << " " 
50                      << x.error              << " ";
51
52        output_stream << hex;
53
54        for (uint32_t it_nb_word = 0; it_nb_word < x.nb_word; it_nb_word ++)
55          {
56            for (uint32_t it_size_word = x.size_word; it_size_word > 0 ; it_size_word --)
57              output_stream << setw(2) << setfill('0') << (0xff & (static_cast<uint32_t>(x.data [it_nb_word][it_size_word-1])));
58            output_stream << " - ";
59          } 
60        output_stream << dec;
61
62        return output_stream;
63      }
64    };
65  }; //sort_file
66}; //hierarchy_memory
67#endif //!ENTRY_H
Note: See TracBrowser for help on using the repository browser.