00001 #ifndef BspPut_HPP 00002 #define BspPut_HPP 00003 00004 00005 #include <cstring> 00006 00007 #include <iostream> //FIXME: for debugging only 00008 00009 #include <vector> 00010 00011 using namespace std; 00012 00024 class BspPut{ 00025 00026 private: 00027 00028 int logicAddr_; 00030 int offset_; 00033 int nBytes_; 00034 int superstep_; 00038 vector<unsigned char> memArea_; 00040 public: 00041 00045 BspPut & logicAddr(const int & aLogicAddr){ 00046 logicAddr_ = aLogicAddr; 00047 return (*this); 00048 } 00049 00053 BspPut & offset(const int & aOffset){ 00054 offset_ = aOffset; 00055 return (*this); 00056 } 00057 00061 BspPut & nBytes(const int & aNBytes){ 00062 nBytes_ = aNBytes; 00063 return (*this); 00064 } 00065 00069 BspPut & superstep(const int & aSuperstep){ 00070 superstep_ = aSuperstep; 00071 return (*this); 00072 } 00073 00074 //Getters--------------------------------------------------------------------- 00075 00079 int logicAddr() const{ return logicAddr_; } 00080 00084 int offset() const{ return offset_; } 00085 00089 int nBytes() const{ return nBytes_; } 00090 00094 int superstep() const{ return superstep_; } 00095 00099 const unsigned char * memArea() const{ return &memArea_[0]; } 00100 00101 //Other Methods--------------------------------------------------------------- 00102 00110 void writeInMem(const void * src){ 00111 00112 assert(nBytes_ >= 0); 00113 memArea_.resize(nBytes_); 00114 memcpy(&memArea_[0], src, nBytes_); 00115 00116 } 00117 00118 00125 void dump (bool dumpMem) const{ 00126 00127 cerr << "logicAddr: " << logicAddr_ << endl 00128 << "offset: " << offset_ << endl 00129 << "nBytes: " << nBytes_ << endl 00130 << "superstep: " << superstep_ << endl 00131 << "memArea: "; 00132 if(dumpMem){ 00133 00134 for(int i = 0; i < nBytes_; i++){ 00135 00136 00137 cerr << (int) memArea_[i]; 00138 cerr << " * "; 00139 } 00140 cerr << endl; 00141 } 00142 00143 } 00144 00145 }; 00146 00147 #endif//BspPut_HPP 00148 00149 00150 00151 00152