LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
IOIMPL::LCEventLazyImpl Class Reference

Implementation of the event class with a lazy record unpacking. More...

#include <LCEventLazyImpl.h>

+ Inheritance diagram for IOIMPL::LCEventLazyImpl:

Public Member Functions

 LCEventLazyImpl ()=default
 Constructor. More...
 
 ~LCEventLazyImpl ()=default
 Destructor. More...
 
EVENT::LCCollectiongetCollection (const std::string &name) const
 Returns the collection for the given name. More...
 
EVENT::LCCollectiontakeCollection (const std::string &name) const
 Returns the collection for the given name and transfers the ownership of the collection to the caller. More...
 
void removeCollection (const std::string &name)
 Removes (and deletes) the collection with name (if it exists in the event). More...
 
void setBuffer (const sio::record_info &recinfo, sio::buffer &&recordBuffer)
 Set the event record buffer. More...
 
- Public Member Functions inherited from IMPL::LCEventImpl
 LCEventImpl ()
 
virtual ~LCEventImpl ()
 Copy contructor, creates a deep copy of the event. More...
 
virtual int getRunNumber () const
 Return the run number off this event. More...
 
virtual int getEventNumber () const
 Returns this event's number . More...
 
virtual const std::stringgetDetectorName () const
 Returns the name of the detector setup used in the simulation. More...
 
virtual EVENT::long64 getTimeStamp () const
 Returns the time stamp of the event. More...
 
virtual double getWeight () const
 Returns the event weight. More...
 
virtual const std::vector
< std::string > * 
getCollectionNames () const
 Returns the names of the collections in the event. More...
 
virtual void addCollection (EVENT::LCCollection *col, const std::string &name)
 Adds a collection with the given name (has to be a valid C/C++ variable name). More...
 
virtual const EVENT::LCParametersgetParameters () const
 Returns the names of the relations in the event. More...
 
virtual EVENT::LCParametersparameters ()
 Parameters defined for this run. More...
 
virtual lcrtrel::LCRTRelationsruntime ()
 Get the runtime extensions for this event. More...
 
void setRunNumber (int rn)
 Sets the run number. More...
 
void setEventNumber (int en)
 Sets the event number. More...
 
void setDetectorName (const std::string &dn)
 Sets the detector name. More...
 
void setTimeStamp (EVENT::long64 ts)
 Sets the event time stamp. More...
 
void setWeight (double w)
 Set the event weight. More...
 
- Public Member Functions inherited from EVENT::LCEvent
virtual ~LCEvent ()
 Destructor. More...
 
- Public Member Functions inherited from IMPL::AccessChecked
 AccessChecked ()
 
virtual ~AccessChecked ()
 
virtual int simpleUID () const
 

Private Member Functions

void unpackEvent ()
 Unpack the event record. More...
 
void postProcessEvent ()
 Post process the event after unpacking. More...
 
void setupBlocks ()
 Setup the collection blocks before unpacking. More...
 

Private Attributes

std::unique_ptr< sio::buffer > _recordBuffer {nullptr}
 
sio::record_info _recordInfo {}
 
sio::block_list _blocks {}
 
bool _unpacked {false}
 
SIO::SIOHandlerMgr _eventHandlerMgr {}
 

Additional Inherited Members

- Protected Member Functions inherited from IMPL::LCEventImpl
void setAccessMode (int accessMode)
 
bool validateCollectionName (const char *name)
 Tests the validity of a collection name. More...
 
- Protected Member Functions inherited from IMPL::AccessChecked
virtual void setReadOnly (bool readOnly)
 
void checkAccess ()
 
void checkAccess (const char *what)
 
- Protected Attributes inherited from IMPL::LCEventImpl
int _runNumber
 
int _eventNumber
 
EVENT::long64 _timeStamp
 
std::string _detectorName
 
LCCollectionMap _colMap {}
 
std::vector< std::string_colNames {}
 
LCParametersImpl _params {}
 
LCCollectionSet _notOwned {}
 
lcrtrel::LCRTRelations _runtime {}
 
- Protected Attributes inherited from IMPL::AccessChecked
bool _readOnly {false}
 
int _id {-1}
 
- Static Protected Attributes inherited from IMPL::AccessChecked
static std::atomic_int _lCObjectId
 

Detailed Description

Implementation of the event class with a lazy record unpacking.

This is used by the MT::LCReader LCIO file reader implementation. SIO internal buffer are kept

Author
gaede
Version
Mar 5, 2003
See Also
LCEvent
LCCollection

Definition at line 27 of file LCEventLazyImpl.h.

Constructor & Destructor Documentation

IOIMPL::LCEventLazyImpl::LCEventLazyImpl ( )
default

Constructor.

IOIMPL::LCEventLazyImpl::~LCEventLazyImpl ( )
default

Destructor.

Member Function Documentation

EVENT::LCCollection * IOIMPL::LCEventLazyImpl::getCollection ( const std::string name) const
virtual

Returns the collection for the given name.

Triggers the event unpacking

Exceptions
DataNotAvailableException

Reimplemented from IMPL::LCEventImpl.

Definition at line 17 of file LCEventLazyImpl.cc.

References unpackEvent().

Referenced by postProcessEvent().

void IOIMPL::LCEventLazyImpl::postProcessEvent ( )
private
void IOIMPL::LCEventLazyImpl::removeCollection ( const std::string name)
virtual

Removes (and deletes) the collection with name (if it exists in the event).

Throws an exception if the event is 'read only' as defined by the read mode in LCReader.

Exceptions
ReadOnlyException

Reimplemented from IMPL::LCEventImpl.

Definition at line 31 of file LCEventLazyImpl.cc.

References _blocks, and std::remove_if().

void IOIMPL::LCEventLazyImpl::setBuffer ( const sio::record_info &  recinfo,
sio::buffer &&  recordBuffer 
)

Set the event record buffer.

Definition at line 38 of file LCEventLazyImpl.cc.

References _recordBuffer, _recordInfo, std::unique_ptr< T >::reset(), and setupBlocks().

Referenced by MT::LCReader::readEvent(), and MT::LCReader::readNextEvent().

void IOIMPL::LCEventLazyImpl::setupBlocks ( )
private

Setup the collection blocks before unpacking.

Definition at line 106 of file LCEventLazyImpl.cc.

References _blocks, IMPL::LCEventImpl::_colMap, _eventHandlerMgr, std::map< K, T >::begin(), std::map< K, T >::end(), and SIO::SIOHandlerMgr::getHandler().

Referenced by setBuffer().

EVENT::LCCollection * IOIMPL::LCEventLazyImpl::takeCollection ( const std::string name) const
virtual

Returns the collection for the given name and transfers the ownership of the collection to the caller.

The caller is responsible for deleting the collection after the Event is deleted. The collection is still in the event but flagged as transient after the call returns.
This is usefull when you want to keep the collection for the next events.
Use with care! Triggers the event unpacking

Exceptions
DataNotAvailableException

Reimplemented from IMPL::LCEventImpl.

Definition at line 24 of file LCEventLazyImpl.cc.

References unpackEvent().

void IOIMPL::LCEventLazyImpl::unpackEvent ( )
private

Unpack the event record.

Definition at line 52 of file LCEventLazyImpl.cc.

References _blocks, _recordBuffer, _recordInfo, _unpacked, and postProcessEvent().

Referenced by getCollection(), and takeCollection().

Member Data Documentation

sio::block_list IOIMPL::LCEventLazyImpl::_blocks {}
private

Definition at line 83 of file LCEventLazyImpl.h.

Referenced by removeCollection(), setupBlocks(), and unpackEvent().

SIO::SIOHandlerMgr IOIMPL::LCEventLazyImpl::_eventHandlerMgr {}
private

Definition at line 85 of file LCEventLazyImpl.h.

Referenced by setupBlocks().

std::unique_ptr<sio::buffer> IOIMPL::LCEventLazyImpl::_recordBuffer {nullptr}
private

Definition at line 81 of file LCEventLazyImpl.h.

Referenced by setBuffer(), and unpackEvent().

sio::record_info IOIMPL::LCEventLazyImpl::_recordInfo {}
private

Definition at line 82 of file LCEventLazyImpl.h.

Referenced by setBuffer(), and unpackEvent().

bool IOIMPL::LCEventLazyImpl::_unpacked {false}
private

Definition at line 84 of file LCEventLazyImpl.h.

Referenced by unpackEvent().


The documentation for this class was generated from the following files: