1 | #ifndef MOBJBUFFER_H
|
---|
2 | #define MOBJBUFFER_H
|
---|
3 |
|
---|
4 | #include "Magic.h"
|
---|
5 |
|
---|
6 | #include <TTree.h>
|
---|
7 | #include <TBranch.h>
|
---|
8 |
|
---|
9 | #include <TNamed.h>
|
---|
10 | #include <TObjArray.h>
|
---|
11 |
|
---|
12 | #include "MParContainer.h"
|
---|
13 |
|
---|
14 | class MFile;
|
---|
15 | class MFileDescrIn;
|
---|
16 | class MFileDescrOut;
|
---|
17 |
|
---|
18 | //class MRuntimeDb;
|
---|
19 |
|
---|
20 | class MObjBuffer : public MParContainer
|
---|
21 | {
|
---|
22 | private:
|
---|
23 | TObjArray objs;
|
---|
24 |
|
---|
25 | Int_t nPreObjs; // number of object in the future
|
---|
26 | Int_t nObjPos; // pos of present object
|
---|
27 | Int_t nPostObjs; // number of objects in the past
|
---|
28 | Int_t nEntries; // number of entries in ring buffer
|
---|
29 |
|
---|
30 | Bool_t fIsInput; // flag: is this an input container?
|
---|
31 | Bool_t fIsOutput; // flag: is this an output container?
|
---|
32 |
|
---|
33 | Bool_t fHasChanged; // flag: the data of the 'present'-object has changed
|
---|
34 |
|
---|
35 | MFileDescrIn *pFileIn; //! Input File
|
---|
36 | MFileDescrOut *pFileOut; //! Input File
|
---|
37 |
|
---|
38 | Int_t nPos; // in Tree
|
---|
39 |
|
---|
40 | public:
|
---|
41 | MObjBuffer(MParContainer *o, Int_t nevts=1,
|
---|
42 | const char *name=NULL, const char *title=NULL);
|
---|
43 |
|
---|
44 | Bool_t IsBuffer() { return kTRUE; }
|
---|
45 |
|
---|
46 | Bool_t IsInput() { return fIsInput; }
|
---|
47 | Bool_t IsOutput() { return fIsOutput; }
|
---|
48 |
|
---|
49 | Bool_t HasChanged() { return fHasChanged; }
|
---|
50 |
|
---|
51 | void SetAsInput(MFile *f, Bool_t i=kTRUE);
|
---|
52 | void SetAsOutput(MFile *f, Bool_t o=kTRUE);
|
---|
53 |
|
---|
54 | void SetChanged(Bool_t c=kTRUE) { fHasChanged = c; }
|
---|
55 |
|
---|
56 | MParContainer *operator() ()
|
---|
57 | {
|
---|
58 | return (MParContainer*)objs[(nObjPos+nEntries)%nEntries];
|
---|
59 | }
|
---|
60 |
|
---|
61 | MParContainer *GetEntry(Int_t i)
|
---|
62 | {
|
---|
63 | return (MParContainer*)objs[(nEntries+nObjPos+i)%nEntries];
|
---|
64 | }
|
---|
65 |
|
---|
66 | Int_t GetNextEvent(Int_t time);
|
---|
67 | void PutEvent();
|
---|
68 |
|
---|
69 | void Fill();
|
---|
70 |
|
---|
71 | Int_t GetEventNr()
|
---|
72 | {
|
---|
73 | return nPos;
|
---|
74 | }
|
---|
75 |
|
---|
76 | ClassDef(MObjBuffer, 1) // buffer for n complete events
|
---|
77 | };
|
---|
78 |
|
---|
79 | #endif
|
---|