]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/AliEventBuffer.cxx
Moved to AODParticle
[u/mrichter/AliRoot.git] / ANALYSIS / AliEventBuffer.cxx
CommitLineData
78d7c6d3 1#include "AliEventBuffer.h"
2
3ClassImp(AliEventBuffer)
4
5//______________________________________________________
6////////////////////////////////////////////////////////
7//
8// class AliEventBuffer
9//
10// FIFO type event buffer
11//
12// Piotr.Skowronski@cern.ch
13//
14////////////////////////////////////////////////////////
15
16AliEventBuffer::AliEventBuffer():
17 fSize(-1),fEvents(),fIter(&fEvents)
18{
19 //ctor
20}
21/***********************************************************/
22
23AliEventBuffer::AliEventBuffer(Int_t size):
24 fSize(size),fEvents(),fIter(&fEvents)
25{
26 //ctor
27}
28/***********************************************************/
29
30AliEventBuffer::~AliEventBuffer()
31{
32 //dtor -- TList::IsOwner(1) does not work - Valgrind says that there is mem leak
33 //take care owerseves
34 if (fEvents.IsOwner())
35 {
36 AliAOD* e=0x0;
37 while (( e=RemoveLast() )) delete e;
38 }
39}
40/***********************************************************/
41
42AliAOD* AliEventBuffer::Push(AliAOD* event)
43{
44 //adds a new event, and returns old of do not fit in size
45 if (fSize == 0) return event;
46
47 AliAOD* ret = 0x0;
48
49 if (fSize == fEvents.GetSize())
50 ret = dynamic_cast<AliAOD*>(fEvents.Remove(fEvents.Last()));
51 if (event) fEvents.AddFirst(event);
52 return ret;
53}
54