umd-memsys / DRAMSim2

DRAMSim2: A cycle accurate DRAM simulator
http://www.ece.umd.edu/~blj/papers/cal10-1.pdf
258 stars 150 forks source link

cannot create a new Transaction object #34

Closed ahmed-shafik closed 10 years ago

ahmed-shafik commented 10 years ago

I need to use the create and object tmp of type Transaction on the below code in Memory controller.cpp

Transaction tmp; tmp=new Transaction (transType,1,1," ",NULL); for (int j=1; j< Trans2d[0][i].size(); j ++) { if (Trans2d[0][i][j].transtp == "P_MEM_WR_H" && Trans2d[0][i][j-1].transtp == "P_MEM_WR_NH" ) { DEBUG("== We need to swap WR H and NH == "); tmp=Trans2d[0][i][j]; Trans2d[0][i][j]=Trans2d[0][i][j-1]; Trans2d[0][i][j-1]=tmp; }

I changed the constructor in Transaction.cpp to be

Transaction::Transaction(TransactionType transType, uint64_t addr, uint64_t pr,string transtp, void *dat) : transactionType(transType), address(addr), priority (pr), transtp(transtp), data(dat) { DEBUG("== Creating new Transaction == "); DEBUG("== transType '"<<transtp<<"' == "); DEBUG("== address '"<<address<<"' == "); DEBUG("== pr '"<<pr<<"' == "); DEBUG("== data '"<<data<<"' == "); }

Transaction::Transaction(): transactionType(transType), address(addr), priority (pr), transtp(transtp), data(dat) { DEBUG("== Creating new Transaction == "); DEBUG("== transType '"<<transtp<<"' == "); DEBUG("== address '"<<address<<"' == "); DEBUG("== pr '"<<pr<<"' == "); DEBUG("== data '"<<data<<"' == "); }

But I got the below error

In file included from MemoryController.cpp:38:0: MemoryController.h: In constructor قDRAMSim::MemoryController::MemoryController(DRAMSim::MemorySystem_, DRAMSim::CSVWriter&, std::ostream&)ق: MemoryController.h:80:11: warning: قDRAMSim::MemoryController::dramsimlogق will be initialized after [-Wreorder] MemoryController.h:77:41: warning: قstd::vectorstd::vector<std::vector > DRAMSim::MemoryController::Trans2dق [-Wreorder] MemoryController.cpp:66:1: warning: when initialized here [-Wreorder] MemoryController.cpp:104:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] MemoryController.cpp: In member function قbool DRAMSim::MemoryController::addTransaction(DRAMSim::Transaction)ق: MemoryController.cpp:818:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] MemoryController.cpp:820:48: error: no match for قoperator=ق in قtmp = (std::basicstring(((const char)" "), ((const std::allocator)(& std::allocator()))), (operator new(56ul), (, ((DRAMSim::Transaction_)))))ق MemoryController.cpp:820:48: note: candidate is: In file included from MemoryController.h:41:0, from MemoryController.cpp:38: Transaction.h:54:7: note: DRAMSim::Transaction& DRAMSim::Transaction::operator=(const DRAMSim::Transaction&) Transaction.h:54:7: note: no known conversion for argument 1 from قDRAMSim::Transactionق to قconst DRAMSim::Transaction&ق MemoryController.cpp:821:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] MemoryController.cpp:849:1: warning: control reaches end of non-void function [-Wreturn-type] make: ** [MemoryController.o] Error 1