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

Last change on this file since 12105 was 11893, checked in by tbretz, 13 years ago
Implemented a new determination fo run-number after noon in the fadctrl; created the possibility to add the date to the raw-data path; allow to set the path as program option; for all this moved some code from the datalogger to DimWriteStatistics
File size: 1.6 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
10typedef struct _RUN_HEAD RUN_HEAD;
11typedef struct _EVENT EVENT;
12typedef struct _RUN_TAIL RUN_TAIL;
13
14class 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
24protected:
25 MessageImp &fMsg;
26 std::string fFileName;
27
28public:
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
50class DataDump : public DataProcessorImp
51{
52 Time fTime;
53
54public:
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
62class DataDebug : public DataDump
63{
64public:
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
Note: See TracBrowser for help on using the repository browser.