source: trunk/FACT++/src/DataProcessorImp.h@ 15077

Last change on this file since 15077 was 14700, checked in by tbretz, 12 years ago
Not only the run number needs to be propagated for consistency but also the night. Otherwise we might check the night, configure the FADs and when we start the run it has changed already. Since it is at day time this is not a likely scenario but should be avoided nevertheless.
File size: 1.9 KB
Line 
1#ifndef FACT_DataProcessorImp
2#define FACT_DataProcessorImp
3
4#include "MessageImp.h"
5
6struct _RUN_HEAD;
7struct _EVENT;
8struct _RUN_TAIL;
9
10namespace FAD
11{
12 struct RunDescription;
13};
14
15typedef struct _RUN_HEAD RUN_HEAD;
16typedef struct _EVENT EVENT;
17typedef struct _RUN_TAIL RUN_TAIL;
18
19class DataProcessorImp : public MessageImp
20{
21 std::string fPath;
22 uint64_t fNight;
23 uint32_t fRunId;
24
25 int Write(const Time &time, const std::string &txt, int qos=kMessage)
26 {
27 return fMsg.Write(time, txt, qos);
28 }
29
30protected:
31 MessageImp &fMsg;
32 std::string fFileName;
33
34public:
35 DataProcessorImp(const std::string &path, uint64_t night, uint32_t id, MessageImp &imp) : fPath(path), fNight(night), fRunId(id), fMsg(imp) { }
36 virtual ~DataProcessorImp() { }
37
38 virtual bool Open(const RUN_HEAD* h, const FAD::RunDescription &desc) = 0;
39 virtual bool WriteEvt(EVENT *) = 0;
40 virtual bool Close(RUN_TAIL * = 0) = 0;
41
42 const std::string &GetFileName() const { return fFileName; }
43
44 std::string GetPath() const { return fPath; }
45 uint32_t GetRunId() const { return fRunId; }
46
47 static std::string FormFileName(const std::string &path, uint64_t night, uint32_t runid, const std::string &extension);
48 std::string FormFileName(const std::string &extension)
49 {
50 return FormFileName(fPath, fNight, fRunId, extension);
51 }
52};
53
54#include "Time.h"
55
56class DataDump : public DataProcessorImp
57{
58 Time fTime;
59
60public:
61 DataDump(const std::string &path, uint64_t night, uint32_t id, MessageImp &imp) : DataProcessorImp(path, night, id, imp) { }
62
63 bool Open(const RUN_HEAD* h, const FAD::RunDescription &d);
64 bool WriteEvt(EVENT *e);
65 bool Close(RUN_TAIL * = 0);
66};
67
68class DataDebug : public DataDump
69{
70public:
71 DataDebug(const std::string &path, uint64_t night, uint32_t id, MessageImp &imp) : DataDump(path, night, id, imp) { }
72
73 bool WriteEvt(EVENT *e);
74};
75
76#endif
Note: See TracBrowser for help on using the repository browser.