1 |
/** @file |
/** @file |
2 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
3 |
* $Date: 2004/12/09 08:48:41 $ |
* $Date: 2004/12/16 17:32:57 $ |
4 |
* $Revision: 2.5 $ |
* $Revision: 2.6 $ |
5 |
* |
* |
6 |
* Implementation of the functions of a sample Algorithm class. |
* Implementation of the functions of a sample Algorithm class. |
7 |
* This file can be used as a templace to develop your own algorithm. |
* This file can be used as a templace to develop your own algorithm. |
88 |
*/ |
*/ |
89 |
std::string EventReader::GetVersionInfo(void) const { |
std::string EventReader::GetVersionInfo(void) const { |
90 |
return |
return |
91 |
"$Header: /home/cvsmanager/yoda/techmodel/EventReader.cpp,v 2.5 2004/12/09 08:48:41 kusanagi Exp $\n"; |
"$Header: /home/cvsmanager/yoda/techmodel/EventReader.cpp,v 2.6 2004/12/16 17:32:57 kusanagi Exp $\n"; |
92 |
} |
} |
93 |
|
|
94 |
/** |
/** |
231 |
|
|
232 |
//commented out because of the above test code |
//commented out because of the above test code |
233 |
InputFile->seekg(Header->GetPscuHeader()->GetPacketLenght(), std::ios::cur); |
InputFile->seekg(Header->GetPscuHeader()->GetPacketLenght(), std::ios::cur); |
234 |
FindStart(); |
if (FindStart()) { |
235 |
finalPos = (long int)InputFile->tellg() - (1 + initPos + (long int)(Header->GetPscuHeader()->GetPacketLenght())); |
finalPos = (long int)InputFile->tellg() - (initPos + (long int)(Header->GetPscuHeader()->GetPacketLenght())); |
236 |
if(finalPos == 0){ |
if(finalPos == 0){ |
237 |
logger->debug(_T("Correct packet length")); |
logger->debug(_T(" Correct packet length")); |
238 |
} |
} |
239 |
if (finalPos > 0 && finalPos < 64) { |
if (finalPos > 0 && finalPos < 64) { |
240 |
oss.str(""); |
oss.str(""); |
243 |
} |
} |
244 |
if (finalPos > 64){ |
if (finalPos > 64){ |
245 |
oss.str(""); |
oss.str(""); |
246 |
oss << "The begin of the next packet is far more than 64 byte from the end of the previous." |
oss << " The begin of the next packet is far more than 64 byte from the end of the previous." |
247 |
<< Header->GetPscuHeader()->Print(); |
<< Header->GetPscuHeader()->Print(); |
248 |
logger->error(oss.str().c_str()); |
logger->error(oss.str().c_str()); |
249 |
//throw LengthException("The begin of the next packet is far more than 64 byte from the end of the previous."); |
//throw LengthException("The begin of the next packet is far more than 64 byte from the end of the previous."); |
250 |
} |
} |
251 |
|
} |
252 |
|
else { |
253 |
|
logger->debug(_T(" END OF FILE")); |
254 |
|
} |
255 |
|
|
256 |
InputFile->seekg(initPos, std::ios::beg); |
InputFile->seekg(initPos, std::ios::beg); |
257 |
} else { |
} else { |
258 |
InputFile->seekg(-(13), std::ios::cur); |
InputFile->seekg(-(13), std::ios::cur); |
290 |
/** |
/** |
291 |
* Find the next starting poin for the PSCU event looking for a {0xFA, 0xFE, 0xDE} sequence |
* Find the next starting poin for the PSCU event looking for a {0xFA, 0xFE, 0xDE} sequence |
292 |
*/ |
*/ |
293 |
int EventReader::FindStart(void) throw (std::exception) { |
bool EventReader::FindStart(void) throw (std::exception) { |
294 |
//search an hexadecimal sequence in a file |
//search an hexadecimal sequence in a file |
295 |
//subSign ------> pointer to the sequence buffer |
//subSign ------> pointer to the sequence buffer |
296 |
//subSignDim ------> dimension of the buffer |
//subSignDim ------> dimension of the buffer |
318 |
if (dataByte == (char)(*(subSign+subIndex))){ |
if (dataByte == (char)(*(subSign+subIndex))){ |
319 |
if (subIndex++ == (subSignDim-1)) { |
if (subIndex++ == (subSignDim-1)) { |
320 |
InputFile->seekg( (index - (subIndex + buffSize)), std::ios::cur); |
InputFile->seekg( (index - (subIndex + buffSize)), std::ios::cur); |
321 |
return 1; |
return true; |
322 |
} |
} |
323 |
} else { |
} else { |
324 |
index = index - (subIndex); |
index = index - (subIndex); |
327 |
} |
} |
328 |
//Needs to guarantee the overap of the buffer(s) in several loop |
//Needs to guarantee the overap of the buffer(s) in several loop |
329 |
InputFile->seekg( (-1)*(subSignDim + 1) , std::ios::cur); |
InputFile->seekg( (-1)*(subSignDim + 1) , std::ios::cur); |
330 |
} |
} |
331 |
return 0; |
return false; |
332 |
} |
} |
333 |
|
|
334 |
ClassImp(EventReader) |
ClassImp(EventReader) |