SIO::LCIORandomAccessMgr Class Reference

Manager class for LCIO direct access. More...

#include <SIO/LCIORandomAccessMgr.h>

List of all members.

Public Member Functions

 LCIORandomAccessMgr (const LCIORandomAccessMgr &)
 no copy constructor
LCIORandomAccessMgroperator= (const LCIORandomAccessMgr &)
 no default assignment operator
long64 getPosition (const RunEvent &re)
 Return the position of the specified Event record or Run record respectively (if EventNum == -1 ).
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 RunEventMapgetEventMap ()
 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

LCIORandomAccesscreateFromEventMap ()
 Prepare an LCIORandomAccess object from the current contents of RunEventMap (all file locations set to 0).
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 LCIORandomAccesslastLCIORandomAccess ()
 Pointer to the last LCIORandomAccess in the list.

Protected Attributes

LCIORandomAccess_fileRecord

Friends

class SIOIndexHandler
class SIORandomAccessHandler
std::ostream & operator<< (std::ostream &os, const LCIORandomAccessMgr &ra)

Detailed Description

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()

See also:
writeRandomAccessRecords(). : currently the last LCIORandomAccess record is found by seeking a fixed size from the end - need to store the actual length as last word in the file for future changes of the records length
Author:
gaede
Version:
Id
LCIORandomAccessMgr.h,v 1.3 2011-03-03 16:00:12 gaede Exp

Member Function Documentation

LCIORandomAccess * SIO::LCIORandomAccessMgr::createFromEventMap (  )  [protected]

Prepare an LCIORandomAccess object from the current contents of RunEventMap (all file locations set to 0).

Referenced by writeRandomAccessRecords().

long64 SIO::LCIORandomAccessMgr::getPosition ( const RunEvent re  )  [inline]

Return the position of the specified Event record or Run record respectively (if EventNum == -1 ).

Returns RunEventMap::NPos if no record found.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Friends

Generated on 6 Mar 2020 for LCIO by  doxygen 1.6.1