Public Member Functions | |
bool | nextSample (VoidVec &vv) |
Reader (int fd) | |
Private Attributes | |
int | fd_ |
Definition at line 98 of file ProfParse.cc.
Reader::Reader | ( | int | fd | ) | [inline, explicit] |
Definition at line 107 of file ProfParse.cc.
References TestMuL1L2Filter_cff::cerr, fd_, and SiStripLorentzAngle_cfi::read.
Referenced by writeProfileData().
00108 { 00109 unsigned int cnt; 00110 int sz = read(fd_,&cnt,sizeof(unsigned int)); 00111 00112 if(sz<0) { 00113 perror("Reader::nextSample: read count"); 00114 std::cerr << "could not read next sample from profile data\n"; 00115 return false; 00116 } 00117 if(sz == 0) return false; 00118 if((unsigned)sz<sizeof(unsigned int)) { 00119 std::cerr << "Reader::nextSample: " 00120 << "could not read the correct amount of profile data\n"; 00121 return false; 00122 } 00123 if(cnt > 1000) { 00124 std::cerr << "Reader::nextSample: stack length is nonsense " << cnt << "\n"; 00125 return false; 00126 } 00127 00128 vv.resize(cnt); 00129 void** pos = &vv[0]; 00130 int byte_cnt = cnt*sizeof(void*); 00131 00132 while((sz = read(fd_,pos,byte_cnt)) < byte_cnt) { 00133 if(sz < 0) { 00134 perror("Reader::nextSample: read stack"); 00135 std::cerr << "could not read stack\n"; 00136 return false; 00137 } 00138 byte_cnt -= sz; 00139 pos += sz; 00140 } 00141 return true; 00142 }
int Reader::fd_ [private] |