]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/EveHLT/AliEveEventBuffer.h
-Fixed bug in offline buffer that deleted event object.
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveEventBuffer.h
CommitLineData
30e7579c 1//-*- Mode: C++ -*-
2
3// $Id$
4
5#ifndef ALIEVEEVENTBUFFER_H
6#define ALIEVEEVENTBUFFER_H
7
8/* This file is property of and copyright by the ALICE HLT Project *
9 * ALICE Experiment at CERN, All rights reserved. *
10 * See cxx source for full Copyright notice
11 */
12
13/** @file AliEveEventBuffer.h
14 @author Svein Lindal
15 @date
16 @brief Manager for HOMER in aliroot
17*/
18
19
20class TObjArray;
21class TObject;
22class TTimer;
23class TThread;
24
25#include "TTimer.h"
26
27class AliEveEventBuffer : public TObject{
28
29public:
30
31 /** default constructor */
32 AliEveEventBuffer();
33
34 /** destructor */
35 virtual ~AliEveEventBuffer();
36
37 void SetBufferSize(Int_t bs) { fBufferSize = bs;}
38 void SetBusy(Bool_t busy) { fBusy = busy;}
239fdf4e 39 Bool_t GetBusy() { return fBusy;}
40
30e7579c 41 //Navigate the event buffer
42 // TObject * NavigateFwd();
43 // TObject * NavigateBack();
44 TObject * NextEvent();
45 TObject * Back();
46 TObject * Fwd();
47
48 void StartBufferMonitor();
49 void StopBufferMonitor();
50 //Needed for Homer buffer
51 virtual void ConnectToSource() = 0;
52 //Check if more events are needed in buffer
53 void MonitorBuffer();
54
55 static void * BufferThread(void * buffer);
56 virtual void WriteToFile() {//Do nothing
57 ;
58 }
59
60 Int_t GetEventId() const { return fEventId[fBIndex[kCurrent]];}
61
239fdf4e 62 void CreateBufferThread();
63
64
30e7579c 65protected:
66
67 enum fBufferIndex {
68 kCurrent,
69 kLast,
70 kTop,
71 kSize
72 };
73
74
75 Int_t fBufferSize;
76 Int_t fPreBuffer;
77 Bool_t fBusy;
78
79 //TClonesArray containing the stored events
80 TObjArray * fEventBuffer;
81
82 //Pointer to current event
83 TObject * fCurrentEvent;
84
85 //Event buffer indexes
86 Int_t fBIndex[kSize];
87
88
89 //Add event to buffer
90 virtual void AddToBuffer(TObject * event);
91
92 virtual TObject * GetEventFromSource() = 0;
93
94 void FetchEvent();
95
96
97 //Calculate buffer index stuff
98 Int_t CalculateDifference(Int_t top, Int_t low);
99 Int_t CalculatePrevious(Int_t current);
100 Int_t CalculateNext(Int_t current);
101
102 void SetEventId(Int_t eventId) { fEventId[fBIndex[kCurrent]] = eventId;}
103
b088c0a1 104 void SetBufferMonStarted(Bool_t started) {fBufferMonStarted = started;}
105 Bool_t GetBufferMonStarted () const { return fBufferMonStarted;}
30e7579c 106
107private:
108
109 /** copy constructor prohibited */
110 AliEveEventBuffer(const AliEveEventBuffer&);
111
112 /** assignment operator prohibited */
113 AliEveEventBuffer& operator=(const AliEveEventBuffer&);
114
239fdf4e 115
30e7579c 116
117 TObject * GetNextUnSeen();
118
119 void PrintIndeces();
120 void PrintBuffer();
121
122 TTimer * fTimer;
123
30e7579c 124 //Current event id
125 Int_t * fEventId;
126
b088c0a1 127 Bool_t fBufferMonStarted;
128
129
30e7579c 130
131 ClassDef(AliEveEventBuffer, 0); // Manage connections to HLT data-sources.
132};
133
134#endif