1 |
/** @file |
2 |
* $Author: kusanagi $ |
3 |
* $Date: 2006/04/05 07:30:54 $ |
4 |
* $Revision: 6.1 $ |
5 |
* |
6 |
* Header file for the algorithms used to read the techmodel data file. |
7 |
*/ |
8 |
|
9 |
#include "TechmodelPamelaRun.h" |
10 |
#include "TechmodelAlgorithm.h" |
11 |
|
12 |
namespace pamela { |
13 |
namespace techmodel { |
14 |
/** |
15 |
* Main event reader algorithm. It handles all other specific |
16 |
* reader algorithms. |
17 |
*/ |
18 |
class EventReader: public TechmodelAlgorithm { |
19 |
private: |
20 |
/** |
21 |
* A map with an algorithm to read the techmodel file with the packet |
22 |
* type as key. |
23 |
*/ |
24 |
typedef std::map<const PacketType *, TechmodelAlgorithm *> AlgorithmMap; |
25 |
/** |
26 |
* The map that links every packet type to an algorithm that reads it. |
27 |
*/ |
28 |
AlgorithmMap TechmodelAlgorithmMap; //! |
29 |
/** |
30 |
* The event header. |
31 |
*/ |
32 |
EventHeader* Header; //! |
33 |
/** |
34 |
* The Run that is processed. |
35 |
*/ |
36 |
TechmodelPamelaRun *Run; //! |
37 |
void UnpackPscuHeader(void) throw (WrongCRCHeaderException, LengthException, BackwardCounterException); |
38 |
void UnpackPscuHeader(unsigned char*) throw (WrongCRCHeaderException, LengthException, BackwardCounterException); |
39 |
void UnpackPscuTrailer(void) throw (std::exception); |
40 |
|
41 |
/** |
42 |
maxPackets define the maximum number of packets |
43 |
the user wants to get from the raw file. |
44 |
By default is initialized to -1 (no limit) |
45 |
*/ |
46 |
static unsigned int maxPackets; |
47 |
|
48 |
/** |
49 |
prevPckCounter and prevPckOBT are used to check the |
50 |
integrity of the raw file stream |
51 |
*/ |
52 |
static unsigned int prevPckCounter; |
53 |
static unsigned int prevPckOBT; |
54 |
std::stringstream oss; |
55 |
ofstream corruptedPacketFile; |
56 |
public: |
57 |
//EventReader(void); |
58 |
EventReader(int); |
59 |
virtual void Init(PamelaRun *); |
60 |
virtual void RunEvent(int); |
61 |
virtual std::string GetVersionInfo(void) const; |
62 |
virtual bool FindStart(unsigned char*, long) throw (std::exception); |
63 |
int archiveCorruptedPacket(long int, long int); |
64 |
ClassDef(EventReader, 1) |
65 |
}; |
66 |
} |
67 |
} |