--- yoda/techmodel/LogReader.cpp 2005/03/06 04:33:02 4.0 +++ yoda/techmodel/LogReader.cpp 2006/09/29 10:19:24 6.3 @@ -1,6 +1,6 @@ /** @file - * $Source: /home/cvsmanager/yoda/techmodel/LogReader.cpp,v $ - * $Id: LogReader.cpp,v 3.1 2005/03/06 04:29:20 kusanagi Exp $ + * $Source: /afs/ba.infn.it/user/pamela/src/CVS/yoda/techmodel/LogReader.cpp,v $ + * $Id: LogReader.cpp,v 6.2 2006/05/30 19:10:03 kusanagi Exp $ * $Author: kusanagi $ * * Implementation of the LogReader class. @@ -8,21 +8,11 @@ * Control the CRC for the entire data Packet not just for single records */ -#define UINT unsigned int -#define BYTE unsigned char -#include -#include extern "C" { -#include #include "CRC.h" } - -#include -#include "stdio.h" #include "ReaderAlgorithms.h" -#include "event/log/LogRecord.h" -using namespace pamela; using namespace pamela::techmodel; static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.LogReader")); @@ -41,7 +31,7 @@ */ std::string LogReader::GetVersionInfo(void) const { return - "$Header: /home/cvsmanager/yoda/techmodel/LogReader.cpp,v 3.1 2005/03/06 04:29:20 kusanagi Exp $\n"; + "$Header: /afs/ba.infn.it/user/pamela/src/CVS/yoda/techmodel/LogReader.cpp,v 6.2 2006/05/30 19:10:03 kusanagi Exp $\n"; } /** @@ -63,17 +53,17 @@ UINT16 subCRC; //calculated CRC of the data UINT16 readCRC; //CRC read from the end of the subpacket long int dataLength = length - 2; //the block of data - + memset(subData, 0, length*sizeof(char)); InputFile->read(subData, sizeof(subData)); subCRC = CM_Compute_CRC16(0, (UINT8*)subData, dataLength); //took the final CRC to compare it with the previous calculated CRC of the data readCRC = (((UINT16)(subData[length - 2]<<8))&0xFF00) + (((UINT16)subData[length - 1])&0x00FF); - //if (subCRC != readCRC) throw WrongCRCException(" Wrong CRC for Log Packet "); - if (subCRC != readCRC) { + if (subCRC != readCRC) throw WrongCRCException(" Wrong CRC for Log Packet "); + /*if (subCRC != readCRC) { logger->error("WRONG CRC FOR LOG PACKET. Processed anyway for CPU debugging"); - } + }*/ Log->COMPILATION_TIMESTAMP = (((UINT32)subData[0]<<24)&0xFF000000) + (((UINT32)subData[1]<<16)&0x00FF0000) + (((UINT32)subData[2]<<8)&0x0000FF00) + (((UINT32)subData[3])&0x000000FF); long int offset = 4;