| 1 | 
  | 
 /** @file | 
| 2 | 
  | 
  * $Author: kusanagi $ | 
| 3 | 
  | 
  * $Date: 2006/02/04 12:37:44 $ | 
| 4 | 
  | 
  * $Revision: 5.1 $ | 
| 5 | 
  | 
  *  | 
| 6 | 
  | 
  * Implementation of the Ac1InitReader class. | 
| 7 | 
  | 
  */ | 
| 8 | 
  | 
  | 
 | 
 // Implementation of the Ac1InitReader class. | 
  | 
 | 
   | 
  | 
 | 
  | 
  | 
 | 
 #define UINT unsigned int | 
  | 
 | 
 #define BYTE  unsigned char | 
  | 
 | 
 #include <string> | 
  | 
 | 
 #include <log4cxx/logger.h> | 
  | 
 | 
 extern "C" { | 
  | 
 | 
     #include "CRC.h" | 
  | 
 | 
 } | 
  | 
 | 
  | 
  | 
 | 
 #include <fstream> | 
  | 
 | 
 #include "stdio.h" | 
  | 
| 9 | 
 #include "ReaderAlgorithms.h" | 
 #include "ReaderAlgorithms.h" | 
| 10 | 
  | 
  | 
 | 
  | 
  | 
 | 
 using namespace pamela; | 
  | 
| 11 | 
 using namespace pamela::techmodel; | 
 using namespace pamela::techmodel; | 
| 12 | 
  | 
  | 
| 13 | 
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.Ac1InitReader")); | 
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.Ac1InitReader")); | 
| 14 | 
  | 
  | 
| 15 | 
 /** | 
 /** | 
| 16 | 
  * Constructor.  | 
  * Constructor.  | 
| 17 | 
  | 
  * @param   | 
| 18 | 
  | 
  * @return  | 
| 19 | 
  */ | 
  */ | 
| 20 | 
 Ac1InitReader::Ac1InitReader(void):  | 
 Ac1InitReader::Ac1InitReader(void):  | 
| 21 | 
   TechmodelAlgorithm(PacketType::Ac1Init, "Ac1InitReader") {  | 
   TechmodelAlgorithm(PacketType::Ac1Init, "Ac1InitReader") {  | 
| 25 | 
  | 
  | 
| 26 | 
 /** | 
 /** | 
| 27 | 
  * Get a string with the version info of the algorithm. | 
  * Get a string with the version info of the algorithm. | 
| 28 | 
  | 
  * @param | 
| 29 | 
  | 
  * @return | 
| 30 | 
  */ | 
  */ | 
| 31 | 
 std::string Ac1InitReader::GetVersionInfo(void) const { | 
 std::string Ac1InitReader::GetVersionInfo(void) const { | 
| 32 | 
   return  | 
   return  | 
| 33 | 
     "$Trailer: /home/cvsmanager/yoda/techmodel/Ac1InitReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $\n"; | 
     "$Trailer: /opt/cvsmanager/yoda/techmodel/Ac1InitReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 Maurizio Nagni Exp $\n"; | 
| 34 | 
 } | 
 } | 
| 35 | 
  | 
  | 
| 36 | 
  | 
  | 
| 37 | 
 /** | 
 /** | 
| 38 | 
  * Initialize the algorithm with a special run. This will initialize the | 
  * Initialize the algorithm with a special run. This will initialize the | 
| 39 | 
  * event reader routines for all packet types. | 
  * event reader routines for all packet types. | 
| 40 | 
  | 
  * @param run  | 
| 41 | 
  */ | 
  */ | 
| 42 | 
 void Ac1InitReader::Init(PamelaRun *run) { | 
 void Ac1InitReader::Init(PamelaRun *run) { | 
| 43 | 
   logger->debug(_T("Initialize")); | 
   logger->debug(_T("Initialize")); | 
| 47 | 
  | 
  | 
| 48 | 
 /** | 
 /** | 
| 49 | 
  * Unpack the Ac1Init event from an input file. | 
  * Unpack the Ac1Init event from an input file. | 
| 50 | 
  | 
  * The CPU does not add any CRC control at the packet end. | 
| 51 | 
  | 
  * @param EventNumber  | 
| 52 | 
  | 
  * @param dataLength  | 
| 53 | 
  */ | 
  */ | 
| 54 | 
 void Ac1InitReader::RunEvent(int EventNumber, long int length) throw (WrongCRCException){ | 
 void Ac1InitReader::RunEvent(int EventNumber, long int dataLength) throw (WrongCRCException){ | 
| 55 | 
      | 
     char      subData[dataLength]; | 
| 56 | 
      | 
     InputFile->read(subData, sizeof(subData)); | 
| 57 | 
  | 
     ac1Init->ac1InitData        = new TArrayC(dataLength, subData); | 
| 58 | 
 } | 
 } | 
| 59 | 
  | 
  |