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

Last change on this file since 20071 was 17330, checked in by tbretz, 11 years ago
Give access to the full information in Open/Write/Close
File size: 1.9 KB
Line 
1#ifndef FACT_DataProcessorImp
2#define FACT_DataProcessorImp
3
4#include "MessageImp.h"
5
6struct RUN_HEAD;
7struct EVT_CTRL2;
8struct RUN_CTRL2;
9
10namespace FAD
11{
12 struct RunDescription;
13};
14
15class 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
26protected:
27 MessageImp &fMsg;
28 std::string fFileName;
29
30public:
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
53class DataDump : public DataProcessorImp
54{
55 Time fTime;
56
57public:
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
65class DataDebug : public DataDump
66{
67public:
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
Note: See TracBrowser for help on using the repository browser.