Implementation of the LCCollection using (inheriting from) an STL vector of LCObjects. More...
#include <IMPL/LCCollectionVec.h>
Public Member Functions | |
LCCollectionVec () | |
Default Constructor should be protected - every LCCollection needs to know the type of its elements. | |
LCCollectionVec (const std::string &type) | |
The public default constructur that takes the name of the type of the elements. More... | |
virtual | ~LCCollectionVec () |
Destructor. | |
virtual int | getNumberOfElements () const |
Returns the number of entries in the collection. | |
virtual const std::string & | getTypeName () const |
Returns the type name of the collection - valid names are defined in LCIO. | |
virtual EVENT::LCObject * | getElementAt (int index) const |
Returns pointer to element at index - no range check !. | |
virtual int | getFlag () const |
Returns flag word for collection. More... | |
virtual bool | isTransient () const |
True if collection is transient, i.e. More... | |
void | setTransient (bool val=true) |
Sets the transient flag for this collection. More... | |
virtual bool | isDefault () const |
True if collection is the default collection for the given type. More... | |
void | setDefault (bool val=true) |
Sets the default flag for this collection. More... | |
virtual bool | isSubset () const |
True if the collection holds a subset of objects from other collections. More... | |
void | setSubset (bool val=true) |
Sets the subset flag for this collection. More... | |
void | setFlag (int flag) |
Sets the flag word for this collection. | |
virtual void | addElement (EVENT::LCObject *obj) throw (EVENT::ReadOnlyException) |
Adds the given element to (end of) the collection. More... | |
virtual void | removeElementAt (int i) throw (EVENT::ReadOnlyException) |
Removes the i-th element from the collection. More... | |
virtual const EVENT::LCParameters & | getParameters () const |
Parameters defined for this run. | |
virtual EVENT::LCParameters & | parameters () |
Parameters defined for this run. | |
![]() | |
virtual | ~LCCollection () |
Destructor. | |
![]() | |
virtual int | simpleUID () const |
Protected Member Functions | |
void | setReadOnly (bool readOnly) |
![]() | |
void | checkAccess () throw ( EVENT::ReadOnlyException ) |
void | checkAccess (const char *what) throw ( EVENT::ReadOnlyException ) |
Protected Attributes | |
std::string | _typeName |
int | _flag |
LCParametersImpl | _params |
![]() | |
bool | _readOnly |
int | _id |
Additional Inherited Members | |
![]() | |
static const int | BITTransient = 16 |
Transient bit in flag word. | |
static const int | BITDefault = 17 |
static const int | BITSubset = 18 |
Implementation of the LCCollection using (inheriting from) an STL vector of LCObjects.
IMPL::LCCollectionVec::LCCollectionVec | ( | const std::string & | type | ) |
The public default constructur that takes the name of the type of the elements.
|
virtual |
Adds the given element to (end of) the collection.
Throws an exception if the collection (event) is 'read only'.
ReadOnlyException |
Implements EVENT::LCCollection.
Referenced by UTIL::LCRelationNavigator::createLCCollection().
|
virtual |
Returns flag word for collection.
Bits 16-31 are reserved for LCIO Depending on the object type stored they have a special meaning, e.g. for SimCalorimeterHits:
CHBIT_LONG = 31 - store position
CHBIT_BARREL = 30 - endcap or barrel
CHBIT_ID1 = 29 - cellid1 is sored
CHBIT_PDG = 28 - store pdg of secondaries
Bit 16 is used to flag collection as transient
Bit 17 is used to flag collection as default
Bit 18 is used to flag collection as subset
Bits 0-15 are subdetector/user specific.
Implements EVENT::LCCollection.
|
virtual |
True if collection is the default collection for the given type.
This implies that the collection is complete and unambigous. Convenient method that checks bit BITDefault of the flag word.
Implements EVENT::LCCollection.
|
virtual |
True if the collection holds a subset of objects from other collections.
If the collection is not transient only the pointers/references to the original objects will be stored. Convenient method that checks bit BITSubset of the flag word.
Implements EVENT::LCCollection.
Referenced by ~LCCollectionVec().
|
virtual |
True if collection is transient, i.e.
will not be written to any LCIO file. Convenient method that checks bit 16 of the flag word.
Implements EVENT::LCCollection.
References EVENT::LCCollection::BITTransient.
|
virtual |
Removes the i-th element from the collection.
Throws an exception if the collection (event) is 'read only'.
ReadOnlyException |
Implements EVENT::LCCollection.
void IMPL::LCCollectionVec::setDefault | ( | bool | val = true | ) |
Sets the default flag for this collection.
User need to make sure this flag is unique for a type.
void IMPL::LCCollectionVec::setSubset | ( | bool | val = true | ) |
Sets the subset flag for this collection.
Collections of subsets are only written as pointers to LCIO files, i.e. the objects have to exist in another non-transient collections.
NB: Do not add any 'real' objects to a collection flagged as subset, as this will lead to memory leaks !
void IMPL::LCCollectionVec::setTransient | ( | bool | val = true | ) |
Sets the transient flag for this collection.
Transient collections are not written to LCIO files.
References EVENT::LCCollection::BITTransient.
Referenced by IMPL::LCEventImpl::takeCollection().