Manager class for LCIO direct access. More...
#include <SIO/LCIORandomAccessMgr.h>
Public Member Functions | |
long64 | getPosition (const RunEvent &re) |
Return the position of the specified Event record or Run record respectively (if EventNum == -1 ). More... | |
void | add (const RunEvent &re, long64 pos) |
Add a new entry to the event map - if the RunEvent already exists the new position will be stored. | |
bool | createEventMap (SIO_stream *s) |
Get the run and event header map from the stream - either by reading the random access records or by recreating it for old files. | |
const RunEventMap & | getEventMap () |
Return the event map - it will be empty, if not yet created. | |
bool | initAppend (SIO_stream *s) |
Initialize random access for append mode: read last LCIORandomAccess record if it exists - recreate the RunEvent map from the file if not (old files). | |
void | writeRandomAccessRecords (SIO_stream *stream) |
Write the current random access records LCIOIndex and LCIORandomAccess to the stream. | |
void | clear () |
Clear all lists and maps before closing a file. | |
Protected Member Functions | |
LCIORandomAccess * | createFromEventMap () |
Prepare an LCIORandomAccess object from the current contents of RunEventMap (all file locations set to 0). More... | |
void | addLCIORandomAccess (LCIORandomAccess *ra) |
Add a new LCIORandomAccess object to the list. | |
bool | readLCIORandomAccessAt (SIO_stream *stream, long64 pos) |
Read the LCIORandomAccess record at the specified position. | |
bool | readLCIOIndexAt (SIO_stream *stream, long64 pos) |
Read the LCIOIndex record at the specified position. | |
bool | recreateEventMap (SIO_stream *) |
Fill the RunEventMap from the event and run header records in the file. | |
bool | readLCIORandomAccess (SIO_stream *stream) |
Helper for reading the next LCIORandomAccess record (need preceeding call to LCSIO::seek() ) | |
bool | readLCIOIndex (SIO_stream *stream) |
Helper for reading the next LCIOIndex record (need preceeding call to LCSIO::seek() ) | |
void | createFileRecord () |
Create file record from all LCIORandomAccess records. | |
const LCIORandomAccess * | lastLCIORandomAccess () |
Pointer to the last LCIORandomAccess in the list. | |
Protected Attributes | |
RunEventMap | _runEvtMap |
std::list< LCIORandomAccess * > | _list |
LCIORandomAccess * | _fileRecord |
Friends | |
class | SIOIndexHandler |
class | SIORandomAccessHandler |
std::ostream & | operator<< (std::ostream &os, const LCIORandomAccessMgr &ra) |
Manager class for LCIO direct access.
Provides the functionality for reading and writing the LCIORandomAccess and LCIOIndex records as needed by SIOReader and SIOWriter. Direct Access is implemented through appending LCIOIndex and LCIORandomAccess and records to the end of the LCIO file. The LCIOIndex records hold the locations of the RunHeader and EventHeader in the file and are referenced by corresponding LCIORandomAccess records. The last record in the file will always be an LCIORandomAccess record - and previous records can be found through pointers to the previous record (simply linked list). LCIORandomAccess are always stored uncompressed. When reading a file with direct access mode a RunEvent map is created by reading all LCIORandomAccess and LCIOIndex records or - for old files - is recreated from all RunHeader and EventHeader records in the file. If an old file is opened in APPEND mode the corresponding records are created and written at the end on close()
|
protected |
Prepare an LCIORandomAccess object from the current contents of RunEventMap (all file locations set to 0).
Referenced by writeRandomAccessRecords().
|
inline |
Return the position of the specified Event record or Run record respectively (if EventNum == -1 ).
Returns RunEventMap::NPos if no record found.
References SIO::RunEventMap::getPosition().