-//-*- Mode: C++ -*-
-
// $Id$
-#ifndef ALIEVEEVENTBUFFER_H
-#define ALIEVEEVENTBUFFER_H
-
/* This file is property of and copyright by the ALICE HLT Project *
* ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice
/** @file AliEveEventBuffer.h
@author Svein Lindal
@date
- @brief Manager for HOMER in aliroot
+ @brief Event buffer for HOMER
*/
+#ifndef ALIEVEEVENTBUFFER_H
+#define ALIEVEEVENTBUFFER_H
+
+
+
+#include "TObject.h"
+#include "TMutex.h"
+
class TObjArray;
-class TObject;
class TTimer;
class TThread;
+class TTimer;
-#include "TTimer.h"
class AliEveEventBuffer : public TObject{
virtual ~AliEveEventBuffer();
void SetBufferSize(Int_t bs) { fBufferSize = bs;}
- void SetBusy(Bool_t busy) { fBusy = busy;}
- Bool_t GetBusy() { return fBusy;}
-
- //Navigate the event buffer
- // TObject * NavigateFwd();
- // TObject * NavigateBack();
+
TObject * NextEvent();
TObject * Back();
TObject * Fwd();
ULong64_t GetEventId() const { return fEventId[fBIndex[kCurrent]]; }
void SetEventId(ULong64_t eventId) { fEventId[fBIndex[kCurrent]] = eventId;}
+ Int_t LockMutex() { return fMutex->TryLock();}
+ Int_t UnLockMutex() { return fMutex->UnLock();}
+
+
protected:
enum fBufferIndex {
};
- Int_t fBufferSize;
- Int_t fPreBuffer;
- Bool_t fBusy;
-
- //TClonesArray containing the stored events
- TObjArray * fEventBuffer;
+ Int_t fBufferSize;//Size of event buffer
+ Int_t fPreBuffer;//How many events should be prefetched
+ TObjArray * fEventBuffer; //TClonesArray containing the stored events
+ TObject * fCurrentEvent; //Pointer to current event
+ Int_t fBIndex[kSize]; //Event buffer indexes
- //Pointer to current event
- TObject * fCurrentEvent;
-
- //Event buffer indexes
- Int_t fBIndex[kSize];
//Add event to buffer
//Calculate buffer index stuff
- Int_t CalculateDifference(Int_t top, Int_t low);
- Int_t CalculatePrevious(Int_t current);
- Int_t CalculateNext(Int_t current);
+ Int_t CalculateDifference(Int_t top, Int_t low) const;
+ Int_t CalculatePrevious(Int_t current) const;
+ Int_t CalculateNext(Int_t current) const;
void SetBufferMonStarted(Bool_t started) {fBufferMonStarted = started;}
void PrintIndeces();
void PrintBuffer();
- TTimer * fTimer;
+ TTimer * fTimer;//Timer to loop over buffer monitor
//Current event id
- ULong64_t * fEventId;
+ ULong64_t * fEventId;//Event id
- Bool_t fBufferMonStarted;
-
+ Bool_t fBufferMonStarted;//Has buffer monitor loop started?
+ TThread * fThread; //Thread pointer
+ TMutex * fMutex;//Mutex
ClassDef(AliEveEventBuffer, 0); // Manage connections to HLT data-sources.
};