|
//____________________________________________________________________ // // BrEventList // An event FIFO. This class is to be used if you want to cache a // certain number of events. Once cached you can go back and forth // in the list. //____________________________________________________________________ // // $Id: BrEventList.cxx,v 1.2 2001/08/17 16:27:43 jens Exp $ // $Author: jens $ // $Date: 2001/08/17 16:27:43 $ // $Copyright: (C) 2001 BRAHMS Collaboration <brahmlib@rhic.bnl.gov> // #ifndef BRAT_BrEventList #include "BrEventList.h" #endif //____________________________________________________________________ ClassImp(BrEventList); //____________________________________________________________________ BrEventList::BrEventList() { // Default constructor fMax = 100; fIndex = 0; } //____________________________________________________________________ BrEventList::BrEventList( Int_t max ) { // Constructor. fMax = max; fIndex = 0; } //____________________________________________________________________ void BrEventList::Add( TObject* obj ) { // Add event 'obj' to list. Remove first event if by adding this event // one exceeds fMax. if ( !fMax || !obj ) return; Int_t size = GetSize(); while ( size >= fMax ) { BrEvent* ev = (BrEvent*) First(); Remove( ev ); delete ev; size--; } AddLast( obj ); fIndex = GetSize() - 1; } //____________________________________________________________________ BrEvent* BrEventList::GetNextEvent() { // Get next event. Return 0 if no event // was found when reaching the end of the list. if ( IsAtLast() || !At( fIndex ) ) return NULL; return (BrEvent*) At( ++fIndex ); } //____________________________________________________________________ BrEvent* BrEventList::GetPreviousEvent() { // Get previous event that matches trigger mask 'mask'. Return 0 if no event // was found when reaching the beginning of the list. if ( IsAtFirst() || !At( fIndex ) ) return NULL; return (BrEvent*) At( --fIndex ); } //____________________________________________________________________ // // $Log: BrEventList.cxx,v $ // Revision 1.2 2001/08/17 16:27:43 jens // Removed all interface to BrTriggerManager // // Revision 1.1 2001/08/16 15:37:17 jens // // New class BrEventList // // // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|