19#include "SamRecordPool.h"
31 myMaxAllowedRecs(maxNumRecs),
40 while (!myFreeSamRecords.empty())
42 delete(myFreeSamRecords.front());
43 myFreeSamRecords.pop();
52 if(!myFreeSamRecords.empty())
55 returnSam = myFreeSamRecords.front();
56 myFreeSamRecords.pop();
58 else if((myMaxAllowedRecs == -1) || (myAllocatedRecs < myMaxAllowedRecs))
67 throw(std::runtime_error(
"Failed to allocate SamRecord"));
90 myFreeSamRecords.push(record);
96 myMaxAllowedRecs = maxNumRecs;
void setMaxAllocatedRecs(int maxNumRecs)
Set the maximum number of records allowed to be allocated.
void releaseRecord(SamRecord *record)
If record is not NULL, adds it back to the free list.
~SamRecordPool()
Destructor.
SamRecordPool()
Constructor that sets there to be no max number of allocated records.
SamRecord * getRecord()
Get a SamRecord.
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record.