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

Last change on this file since 13142 was 12477, checked in by tbretz, 13 years ago
Moved RunDescription to HeadersFAD, added it as a second argument to Open and write the run-type to the header.
File size: 1.8 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 uint32_t fRunId;
23
24 int Write(const Time &time, const std::string &txt, int qos)
25 {
26 return fMsg.Write(time, txt, qos);
27 }
28
29protected:
30 MessageImp &fMsg;
31 std::string fFileName;
32
33public:
34 DataProcessorImp(const std::string &path, uint32_t id, MessageImp &imp) : fPath(path), fRunId(id), fMsg(imp) { }
35 virtual ~DataProcessorImp() { }
36
37 virtual bool Open(const RUN_HEAD* h, const FAD::RunDescription &desc) = 0;
38 virtual bool WriteEvt(EVENT *) = 0;
39 virtual bool Close(RUN_TAIL * = 0) = 0;
40
41 const std::string &GetFileName() const { return fFileName; }
42
43 std::string GetPath() const { return fPath; }
44 uint32_t GetRunId() const { return fRunId; }
45
46 static std::string FormFileName(const std::string &path, uint32_t runid, const std::string &extension);
47 std::string FormFileName(const std::string &extension)
48 {
49 return FormFileName(fPath, fRunId, extension);
50 }
51};
52
53#include "Time.h"
54
55class DataDump : public DataProcessorImp
56{
57 Time fTime;
58
59public:
60 DataDump(const std::string &path, uint32_t id, MessageImp &imp) : DataProcessorImp(path, id, imp) { }
61
62 bool Open(const RUN_HEAD* h, const FAD::RunDescription &d);
63 bool WriteEvt(EVENT *e);
64 bool Close(RUN_TAIL * = 0);
65};
66
67class DataDebug : public DataDump
68{
69public:
70 DataDebug(const std::string &path, uint32_t id, MessageImp &imp) : DataDump(path, id, imp) { }
71
72 bool WriteEvt(EVENT *e);
73};
74
75#endif
Note: See TracBrowser for help on using the repository browser.