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