1 #include "AliHBTEventBuffer.h"
3 ClassImp(AliHBTEventBuffer)
5 //______________________________________________________
6 ////////////////////////////////////////////////////////
8 // class AliHBTEventBuffer
10 // FIFO type event buffer
12 // Piotr.Skowronski@cern.ch
14 ////////////////////////////////////////////////////////
16 AliHBTEventBuffer::AliHBTEventBuffer():
17 fSize(-1),fEvents(),fIter(&fEvents)
21 /***********************************************************/
23 AliHBTEventBuffer::AliHBTEventBuffer(Int_t size):
24 fSize(size),fEvents(),fIter(&fEvents)
28 /***********************************************************/
30 AliHBTEventBuffer::~AliHBTEventBuffer()
32 //dtor -- TList::IsOwner(1) does not work - Valgrind says that there is mem leak
34 if (fEvents.IsOwner())
37 while (( e=RemoveLast() )) delete e;
40 /***********************************************************/
42 AliHBTEvent* AliHBTEventBuffer::Push(AliHBTEvent* event)
44 //adds a new event, and returns old of do not fit in size
45 if (fSize == 0) return event;
47 AliHBTEvent* ret = 0x0;
49 if (fSize == fEvents.GetSize())
50 ret = dynamic_cast<AliHBTEvent*>(fEvents.Remove(fEvents.Last()));
51 if (event) fEvents.AddFirst(event);