Adding missing include file and forward declaration
[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);
cc87822c 56 virtual void WriteToFile(Int_t runnumber) = 0;
30e7579c 57
239fdf4e 58 void CreateBufferThread();
59
8676f4b1 60 ULong64_t GetEventId() const { return fEventId[fBIndex[kCurrent]]; }
cc87822c 61 void SetEventId(ULong64_t eventId) { fEventId[fBIndex[kCurrent]] = eventId;}
239fdf4e 62
30e7579c 63protected:
64
65 enum fBufferIndex {
66 kCurrent,
67 kLast,
68 kTop,
69 kSize
70 };
71
72
73 Int_t fBufferSize;
74 Int_t fPreBuffer;
75 Bool_t fBusy;
76
77 //TClonesArray containing the stored events
78 TObjArray * fEventBuffer;
79
80 //Pointer to current event
81 TObject * fCurrentEvent;
82
83 //Event buffer indexes
84 Int_t fBIndex[kSize];
85
86
87 //Add event to buffer
88 virtual void AddToBuffer(TObject * event);
30e7579c 89 virtual TObject * GetEventFromSource() = 0;
8676f4b1 90 virtual ULong64_t GetEventIdFromSource() { return 0;}
91
30e7579c 92
93 void FetchEvent();
94
95
96 //Calculate buffer index stuff
97 Int_t CalculateDifference(Int_t top, Int_t low);
98 Int_t CalculatePrevious(Int_t current);
99 Int_t CalculateNext(Int_t current);
100
30e7579c 101
b088c0a1 102 void SetBufferMonStarted(Bool_t started) {fBufferMonStarted = started;}
103 Bool_t GetBufferMonStarted () const { return fBufferMonStarted;}
30e7579c 104
105private:
106
107 /** copy constructor prohibited */
108 AliEveEventBuffer(const AliEveEventBuffer&);
109
110 /** assignment operator prohibited */
111 AliEveEventBuffer& operator=(const AliEveEventBuffer&);
112
239fdf4e 113
30e7579c 114
115 TObject * GetNextUnSeen();
116
117 void PrintIndeces();
118 void PrintBuffer();
119
120 TTimer * fTimer;
121
30e7579c 122 //Current event id
8676f4b1 123 ULong64_t * fEventId;
30e7579c 124
b088c0a1 125 Bool_t fBufferMonStarted;
126
1c2d08b8 127 TThread * fThread;
b088c0a1 128
30e7579c 129
130 ClassDef(AliEveEventBuffer, 0); // Manage connections to HLT data-sources.
131};
132
133#endif