1 | #ifndef FACT_DataProcessorImp
|
---|
2 | #define FACT_DataProcessorImp
|
---|
3 |
|
---|
4 | #include "MessageImp.h"
|
---|
5 |
|
---|
6 | struct RUN_HEAD;
|
---|
7 | struct EVT_CTRL2;
|
---|
8 | struct RUN_CTRL2;
|
---|
9 |
|
---|
10 | namespace FAD
|
---|
11 | {
|
---|
12 | struct RunDescription;
|
---|
13 | };
|
---|
14 |
|
---|
15 | class DataProcessorImp : public MessageImp
|
---|
16 | {
|
---|
17 | std::string fPath;
|
---|
18 | uint32_t fNight;
|
---|
19 | uint32_t fRunId;
|
---|
20 |
|
---|
21 | int Write(const Time &time, const std::string &txt, int qos=kMessage)
|
---|
22 | {
|
---|
23 | return fMsg.Write(time, txt, qos);
|
---|
24 | }
|
---|
25 |
|
---|
26 | protected:
|
---|
27 | MessageImp &fMsg;
|
---|
28 | std::string fFileName;
|
---|
29 |
|
---|
30 | public:
|
---|
31 | DataProcessorImp(const std::string &path, uint64_t night, uint32_t id, MessageImp &imp) : fPath(path), fNight(night), fRunId(id), fMsg(imp) { }
|
---|
32 | virtual ~DataProcessorImp() { }
|
---|
33 |
|
---|
34 | virtual bool Open(const RUN_HEAD &h, const FAD::RunDescription &desc) = 0;
|
---|
35 | virtual bool WriteEvt(const EVT_CTRL2 &) = 0;
|
---|
36 | virtual bool Close(const EVT_CTRL2 &) = 0;
|
---|
37 |
|
---|
38 | const std::string &GetFileName() const { return fFileName; }
|
---|
39 |
|
---|
40 | std::string GetPath() const { return fPath; }
|
---|
41 | uint32_t GetNight() const { return fNight; }
|
---|
42 | uint32_t GetRunId() const { return fRunId; }
|
---|
43 |
|
---|
44 | static std::string FormFileName(const std::string &path, uint64_t night, uint32_t runid, const std::string &extension);
|
---|
45 | std::string FormFileName(const std::string &extension)
|
---|
46 | {
|
---|
47 | return FormFileName(fPath, fNight, fRunId, extension);
|
---|
48 | }
|
---|
49 | };
|
---|
50 |
|
---|
51 | #include "Time.h"
|
---|
52 |
|
---|
53 | class DataDump : public DataProcessorImp
|
---|
54 | {
|
---|
55 | Time fTime;
|
---|
56 |
|
---|
57 | public:
|
---|
58 | DataDump(const std::string &path, uint64_t night, uint32_t id, MessageImp &imp) : DataProcessorImp(path, night, id, imp) { }
|
---|
59 |
|
---|
60 | bool Open(const RUN_HEAD &h, const FAD::RunDescription &d);
|
---|
61 | bool WriteEvt(const EVT_CTRL2 &);
|
---|
62 | bool Close(const EVT_CTRL2 &);
|
---|
63 | };
|
---|
64 |
|
---|
65 | class DataDebug : public DataDump
|
---|
66 | {
|
---|
67 | public:
|
---|
68 | DataDebug(const std::string &path, uint64_t night, uint32_t id, MessageImp &imp) : DataDump(path, night, id, imp) { }
|
---|
69 |
|
---|
70 | bool WriteEvt(const EVT_CTRL2 &);
|
---|
71 | };
|
---|
72 |
|
---|
73 | #endif
|
---|