source: trunk/FACT++/src/DataWriteRaw.h@ 12105

Last change on this file since 12105 was 11893, checked in by tbretz, 13 years ago
Implemented a new determination fo run-number after noon in the fadctrl; created the possibility to add the date to the raw-data path; allow to set the path as program option; for all this moved some code from the datalogger to DimWriteStatistics
File size: 2.1 KB
Line 
1#ifndef FACT_DataWriteRaw
2#define FACT_DataWriteRaw
3
4#include "DataProcessorImp.h"
5
6class DataWriteRaw : public DataProcessorImp
7{
8 std::ofstream fOut;
9
10 off_t fPosTail;
11
12 uint32_t fCounter;
13
14
15 // WRITE uint32_t 0xFAC77e1e (FACT Tele)
16 // ===
17 // WRITE uint32_t TYPE(>0) == 1
18 // WRITE uint32_t ID(>0) == 0
19 // WRITE uint32_t VERSION(>0) == 1
20 // WRITE uint32_t LENGTH
21 // -
22 // WRITE uint32_t TELESCOPE ID
23 // WRITE uint32_t RUNID
24 // ===
25 // WRITE uint32_t TYPE(>0) == 2
26 // WRITE uint32_t ID(>0) == 0
27 // WRITE uint32_t VERSION(>0) == 1
28 // WRITE uint32_t LENGTH
29 // -
30 // WRITE HEADER
31 // ===
32 // [ 40 TIMES
33 // WRITE uint32_t TYPE(>0) == 3
34 // WRITE uint32_t ID(>0) == 0..39
35 // WRITE uint32_t VERSION(>0) == 1
36 // WRITE uint32_t LENGTH
37 // -
38 // WRITE BOARD-HEADER
39 // ]
40 // ===
41 // WRITE uint32_t TYPE(>0) == 4
42 // WRITE uint32_t ID(>0) == 0
43 // WRITE uint32_t VERSION(>0) == 1
44 // WRITE uint32_t LENGTH
45 // -
46 // WRITE FOOTER (empty)
47 // ===
48 // [ N times
49 // WRITE uint32_t TYPE(>0) == 10
50 // WRITE uint32_t ID(>0) == counter
51 // WRITE uint32_t VERSION(>0) == 1
52 // WRITE uint32_t LENGTH HEADER
53 // -
54 // WRITE HEADER+DATA
55 // ]
56 // ===
57 // WRITE uint32_t TYPE ==0
58 // WRITE uint32_t VERSION==0
59 // WRITE uint32_t LENGTH ==0
60 // ===
61 // Go back and write footer
62
63 void WriteBlockHeader(uint32_t type, uint32_t ver, uint32_t cnt, uint32_t len);
64
65 template<typename T>
66 void WriteValue(const T &t);
67
68
69public:
70 DataWriteRaw(const std::string &path, uint32_t id, MessageImp &imp) : DataProcessorImp(path, id, imp), fPosTail(0) { }
71 ~DataWriteRaw() { if (fOut.is_open()) Close(); }
72
73 enum
74 {
75 kEndOfFile = 0,
76 kIdentifier = 1,
77 kRunHeader,
78 kBoardHeader,
79 kRunSummary,
80 kEvent,
81 };
82
83 bool Open(RUN_HEAD *h);
84 bool WriteEvt(EVENT *evt);
85 bool Close(RUN_TAIL *tail= 0);
86};
87
88#endif
Note: See TracBrowser for help on using the repository browser.