/[PAMELA software]/yoda/techmodel/EventReader.cpp
ViewVC logotype

Diff of /yoda/techmodel/EventReader.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by kusanagi, Fri Aug 20 15:01:42 2004 UTC revision 1.9 by kusanagi, Wed Aug 25 10:14:26 2004 UTC
# Line 1  Line 1 
1  /** @file  /** @file
2   * $Author: kusanagi $   * $Author: kusanagi $
3   * $Date: 2004/08/19 15:24:46 $   * $Date: 2004/08/24 13:19:59 $
4   * $Revision: 1.6 $   * $Revision: 1.8 $
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.
# Line 75  EventReader::EventReader(void): Line 75  EventReader::EventReader(void):
75   */   */
76  std::string EventReader::GetVersionInfo(void) const {  std::string EventReader::GetVersionInfo(void) const {
77    return    return
78      "$Header: /home/cvsmanager/yoda/techmodel/EventReader.cpp,v 1.6 2004/08/19 15:24:46 kusanagi Exp $\n";      "$Header: /home/cvsmanager/yoda/techmodel/EventReader.cpp,v 1.8 2004/08/24 13:19:59 kusanagi Exp $\n";
79  }  }
80    
81  /**  /**
# Line 169  int EventReader::UnpackPscuHeader(void) Line 169  int EventReader::UnpackPscuHeader(void)
169    unsigned int  OrbitalTime  = (((UINT32)buff[8]<<24)&0xFF000000) + (((UINT32)buff[9]<<16)&0x00FF0000) +  (((UINT32)buff[10]<<8)&0x0000FF00) + (((UINT32)buff[11])&0x000000FF);    unsigned int  OrbitalTime  = (((UINT32)buff[8]<<24)&0xFF000000) + (((UINT32)buff[9]<<16)&0x00FF0000) +  (((UINT32)buff[10]<<8)&0x0000FF00) + (((UINT32)buff[11])&0x000000FF);
170    unsigned int  PacketLenght = (((UINT32)buff[12]<<16)&0x00FF0000) +  (((UINT32)buff[13]<<8)&0x0000FF00) + (((UINT32)buff[14])&0x000000FF);    unsigned int  PacketLenght = (((UINT32)buff[12]<<16)&0x00FF0000) +  (((UINT32)buff[13]<<8)&0x0000FF00) + (((UINT32)buff[14])&0x000000FF);
171    unsigned char CRC          = buff[15];    unsigned char CRC          = buff[15];
172      unsigned char FileOffset   = buff[15];
173    
174    if (Counter < prevPckCounter){    if (Counter < prevPckCounter){
175      cat <<  log4cpp::Priority::WARN      cat <<  log4cpp::Priority::WARN
# Line 195  int EventReader::UnpackPscuHeader(void) Line 196  int EventReader::UnpackPscuHeader(void)
196      //plus the CRC legth (which varies for each type of packet)      //plus the CRC legth (which varies for each type of packet)
197      Header->GetPscuHeader()->SetPacketLenght(PacketLenght);      Header->GetPscuHeader()->SetPacketLenght(PacketLenght);
198      Header->GetPscuHeader()->SetCRC(CRC);      Header->GetPscuHeader()->SetCRC(CRC);
199        Header->GetPscuHeader()->SetFileOffset(((long int)(InputFile->tellg()) - 16));
200            
201      //commented out because of the above test code      //commented out because of the above test code
202      InputFile->seekg(Header->GetPscuHeader()->GetPacketLenght(), std::ios::cur);      InputFile->seekg(Header->GetPscuHeader()->GetPacketLenght(), std::ios::cur);
# Line 218  int EventReader::UnpackPscuHeader(void) Line 220  int EventReader::UnpackPscuHeader(void)
220    } else {    } else {
221      cat <<  log4cpp::Priority::ERROR <<  " WRONG CRC FOR HEADER "      cat <<  log4cpp::Priority::ERROR <<  " WRONG CRC FOR HEADER "
222          <<  " " << log4cpp::CategoryStream::ENDLINE;          <<  " " << log4cpp::CategoryStream::ENDLINE;
223        InputFile->seekg(-(13), std::ios::cur);
224      response =  false;      response =  false;
225    }    }
226      char tmpId1[4];      char tmpId1[4];
# Line 228  int EventReader::UnpackPscuHeader(void) Line 231  int EventReader::UnpackPscuHeader(void)
231      sprintf(tmpId1, "%02X", PacketId1);      sprintf(tmpId1, "%02X", PacketId1);
232      sprintf(tmpId2, "%02X", PacketId2);      sprintf(tmpId2, "%02X", PacketId2);
233      sprintf(tmpLength, "%06X", Header->GetPscuHeader()->GetPacketLenght());      sprintf(tmpLength, "%06X", Header->GetPscuHeader()->GetPacketLenght());
234      sprintf(tmpStart, "%X", ((long int)(InputFile->tellg()) - 16));      sprintf(tmpStart, "%X", Header->GetPscuHeader()->GetFileOffset());
235      sprintf(tmpCRC, "%02X", CRC);      sprintf(tmpCRC, "%02X", CRC);
236      cat <<  log4cpp::Priority::INFO        cat <<  log4cpp::Priority::INFO  
237          <<  "\n Packet Counter (decimal) : "  <<  Counter          <<  "\n Packet Counter (decimal) : "  <<  Counter
# Line 282  int EventReader::FindStart(void) throw ( Line 285  int EventReader::FindStart(void) throw (
285        if (InputFile->eof()) {        if (InputFile->eof()) {
286          throw Exception("Extra bytes over the last packets");          throw Exception("Extra bytes over the last packets");
287        } else {        } else {
288          return 0;          subIndex = 0;
289            //return 0;
290        }        }
291        //InputFile->seekg(-(subIndex+1), std::ios::cur);        //InputFile->seekg(-(subIndex+1), std::ios::cur);
292        //subIndex = 0;        //subIndex = 0;

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.23