source: trunk/MagicSoft/MarsOctober/mbase/MObjBuffer.h@ 2136

Last change on this file since 2136 was 447, checked in by harald, 24 years ago
Bringing the sources for the octobertest under CVS controll. (november, 3rd, 2000)
  • Property svn:executable set to *
File size: 1.8 KB
Line 
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
14class MFile;
15class MFileDescrIn;
16class MFileDescrOut;
17
18//class MRuntimeDb;
19
20class MObjBuffer : public MParContainer
21{
22private:
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
40public:
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
Note: See TracBrowser for help on using the repository browser.