|
37 | 37 | #include "Transaction.h"
|
38 | 38 | #include "PrintMacros.h"
|
39 | 39 |
|
40 |
| -using namespace DRAMSim; |
41 |
| -using namespace std; |
| 40 | +using std::endl; |
| 41 | +using std::hex; |
| 42 | +using std::dec; |
42 | 43 |
|
43 |
| -Transaction::Transaction(TransactionType transType, uint64_t addr, void *dat, ostream &dramsim_log_) : |
44 |
| - dramsim_log(dramsim_log_), |
| 44 | +namespace DRAMSim { |
| 45 | + |
| 46 | +Transaction::Transaction(TransactionType transType, uint64_t addr, void *dat) : |
45 | 47 | transactionType(transType),
|
46 | 48 | address(addr),
|
47 | 49 | data(dat)
|
48 | 50 | {}
|
49 | 51 |
|
50 |
| -void Transaction::print() |
| 52 | +Transaction::Transaction(const Transaction &t) |
| 53 | + : transactionType(t.transactionType) |
| 54 | + , address(t.address) |
| 55 | + , data(NULL) |
| 56 | + , timeAdded(t.timeAdded) |
| 57 | + , timeReturned(t.timeReturned) |
51 | 58 | {
|
52 |
| - if (transactionType == DATA_READ) |
| 59 | + #ifndef NO_STORAGE |
| 60 | + ERROR("Data storage is really outdated and these copies happen in an \n improper way, which will eventually cause problems. Please send an \n email to dramninjas [at] gmail [dot] com if you need data storage"); |
| 61 | + abort(); |
| 62 | + #endif |
| 63 | +} |
| 64 | + |
| 65 | +ostream &operator<<(ostream &os, const Transaction &t) |
| 66 | +{ |
| 67 | + if (t.transactionType == DATA_READ) |
53 | 68 | {
|
54 |
| - PRINT("T [Read] [0x" << hex << address << "]" << dec ); |
| 69 | + os<<"T [Read] [0x" << hex << t.address << "]" << dec <<endl; |
55 | 70 | }
|
56 |
| - else if (transactionType == DATA_WRITE) |
| 71 | + else if (t.transactionType == DATA_WRITE) |
57 | 72 | {
|
58 |
| - PRINT("T [Write] [0x" << hex << address << "] [" << dec << data << "]" ); |
| 73 | + os<<"T [Write] [0x" << hex << t.address << "] [" << dec << t.data << "]" <<endl; |
59 | 74 | }
|
60 |
| - else if (transactionType == RETURN_DATA) |
| 75 | + else if (t.transactionType == RETURN_DATA) |
61 | 76 | {
|
62 |
| - PRINT("T [Data] [0x" << hex << address << "] [" << dec << data << "]" ); |
| 77 | + os<<"T [Data] [0x" << hex << t.address << "] [" << dec << t.data << "]" <<endl; |
63 | 78 | }
|
| 79 | + return os; |
| 80 | +} |
64 | 81 | }
|
65 | 82 |
|
0 commit comments