LCIO
02.17
|
Implementation of the LCCollection using (inheriting from) an STL vector of LCObjects. More...
#include <LCCollectionVec.h>
Public Member Functions | |
LCCollectionVec () | |
Default Constructor - don't use - only public for auto-generated streamers in the ROOT dictionary !! Should be protected really. More... | |
LCCollectionVec (const std::string &type) | |
The public default constructur that takes the name of the type of the elements. More... | |
virtual | ~LCCollectionVec () |
Destructor. More... | |
virtual int | getNumberOfElements () const |
Returns the number of entries in the collection. More... | |
virtual const std::string & | getTypeName () const |
Returns the type name of the collection - valid names are defined in LCIO. More... | |
virtual EVENT::LCObject * | getElementAt (int index) const |
Returns pointer to element at index - no range check !. More... | |
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. More... | |
virtual void | addElement (EVENT::LCObject *obj) |
Adds the given element to (end of) the collection. More... | |
virtual void | removeElementAt (int i) |
Removes the i-th element from the collection. More... | |
virtual const EVENT::LCParameters & | getParameters () const |
Parameters defined for this run. More... | |
virtual EVENT::LCParameters & | parameters () |
Parameters defined for this run. More... | |
![]() | |
virtual | ~LCCollection () |
Destructor. More... | |
![]() | |
LCObject * | assign (LCObject *...args) |
LCObject * | at (LCObject *...args) |
LCObject * | back (LCObject *...args) |
LCObject * | begin (LCObject *...args) |
LCObject * | capacity (LCObject *...args) |
LCObject * | cbegin (LCObject *...args) |
LCObject * | cend (LCObject *...args) |
LCObject * | clear (LCObject *...args) |
LCObject * | crbegin (LCObject *...args) |
LCObject * | crend (LCObject *...args) |
LCObject * | data (LCObject *...args) |
LCObject * | emplace (LCObject *...args) |
LCObject * | emplace_back (LCObject *...args) |
LCObject * | empty (LCObject *...args) |
LCObject * | end (LCObject *...args) |
LCObject * | erase (LCObject *...args) |
LCObject * | front (LCObject *...args) |
LCObject * | get_allocator (LCObject *...args) |
LCObject * | insert (LCObject *...args) |
LCObject * | max_size (LCObject *...args) |
LCObject * | operator= (LCObject *...args) |
LCObject * | operator[] (LCObject *...args) |
LCObject * | pop_back (LCObject *...args) |
LCObject * | push_back (LCObject *...args) |
LCObject * | rbegin (LCObject *...args) |
LCObject * | rend (LCObject *...args) |
LCObject * | reserve (LCObject *...args) |
LCObject * | resize (LCObject *...args) |
LCObject * | shrink_to_fit (LCObject *...args) |
LCObject * | size (LCObject *...args) |
LCObject * | swap (LCObject *...args) |
LCObject * | vector (LCObject *...args) |
LCObject * | ~vector (LCObject *...args) |
![]() | |
AccessChecked () | |
virtual | ~AccessChecked () |
virtual int | simpleUID () const |
Protected Member Functions | |
void | setReadOnly (bool readOnly) |
![]() | |
void | checkAccess () |
void | checkAccess (const char *what) |
Protected Attributes | |
std::string | _typeName |
int | _flag |
LCParametersImpl | _params {} |
![]() | |
bool | _readOnly {false} |
int | _id {-1} |
Additional Inherited Members | |
![]() | |
LCObject * | elements |
STL member. More... | |
![]() | |
static const int | BITTransient = 16 |
Transient bit in flag word. More... | |
static const int | BITDefault = 17 |
static const int | BITSubset = 18 |
![]() | |
static std::atomic_int | _lCObjectId |
Implementation of the LCCollection using (inheriting from) an STL vector of LCObjects.
Definition at line 25 of file LCCollectionVec.h.
|
inline |
Default Constructor - don't use - only public for auto-generated streamers in the ROOT dictionary !! Should be protected really.
Every LCCollection needs to know the type of its elements.
Definition at line 34 of file LCCollectionVec.h.
IMPL::LCCollectionVec::LCCollectionVec | ( | const std::string & | type | ) |
The public default constructur that takes the name of the type of the elements.
Definition at line 13 of file LCCollectionVec.cc.
|
virtual |
Destructor.
Definition at line 33 of file LCCollectionVec.cc.
References std::vector< LCObject * >::begin(), std::vector< LCObject * >::end(), and isSubset().
|
virtual |
Adds the given element to (end of) the collection.
Throws an exception if the collection (event) is 'read only'.
ReadOnlyException |
Implements EVENT::LCCollection.
Definition at line 103 of file LCCollectionVec.cc.
References IMPL::AccessChecked::checkAccess(), and std::vector< LCObject * >::push_back().
Referenced by UTIL::LCRelationNavigator::createLCCollection().
|
virtual |
Returns pointer to element at index - no range check !.
Implements EVENT::LCCollection.
Definition at line 60 of file LCCollectionVec.cc.
References std::vector< LCObject * >::operator[]().
Referenced by UTIL::LCStdHepRdr::readEvent(), and UTIL::LCStdHepRdrNew::readEvent().
|
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.
Definition at line 93 of file LCCollectionVec.cc.
References _flag.
|
virtual |
Returns the number of entries in the collection.
Implements EVENT::LCCollection.
Definition at line 49 of file LCCollectionVec.cc.
References std::vector< LCObject * >::size().
|
inlinevirtual |
Parameters defined for this run.
Implements EVENT::LCCollection.
Definition at line 139 of file LCCollectionVec.h.
References _params.
Referenced by UTIL::LCStdHepRdr::updateNextEvent(), and UTIL::LCStdHepRdrNew::updateNextEvent().
|
virtual |
Returns the type name of the collection - valid names are defined in LCIO.
Implements EVENT::LCCollection.
Definition at line 54 of file LCCollectionVec.cc.
References _typeName.
|
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.
Definition at line 74 of file LCCollectionVec.cc.
References _flag, and EVENT::LCCollection::BITDefault.
|
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.
Definition at line 83 of file LCCollectionVec.cc.
References _flag, and EVENT::LCCollection::BITSubset.
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.
Definition at line 64 of file LCCollectionVec.cc.
References _flag, and EVENT::LCCollection::BITTransient.
|
inlinevirtual |
Parameters defined for this run.
Implements EVENT::LCCollection.
Definition at line 143 of file LCCollectionVec.h.
References _params.
Referenced by UTIL::LCRelationNavigator::createLCCollection(), UTIL::LCStdHepRdrNew::readEvent(), and UTIL::LCStdHepRdr::readEvent().
|
virtual |
Removes the i-th element from the collection.
Throws an exception if the collection (event) is 'read only'.
ReadOnlyException |
Implements EVENT::LCCollection.
Definition at line 111 of file LCCollectionVec.cc.
References std::vector< LCObject * >::begin(), IMPL::AccessChecked::checkAccess(), and std::vector< LCObject * >::erase().
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.
Definition at line 78 of file LCCollectionVec.cc.
References _flag, and EVENT::LCCollection::BITDefault.
|
virtual |
Sets the flag word for this collection.
Implements EVENT::LCCollection.
Definition at line 98 of file LCCollectionVec.cc.
References _flag.
Referenced by UTIL::LCRelationNavigator::createLCCollection().
|
protectedvirtual |
Reimplemented from IMPL::AccessChecked.
Definition at line 20 of file LCCollectionVec.cc.
References std::vector< LCObject * >::begin(), std::vector< LCObject * >::end(), and IMPL::AccessChecked::setReadOnly().
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 !
Definition at line 87 of file LCCollectionVec.cc.
References _flag, and EVENT::LCCollection::BITSubset.
void IMPL::LCCollectionVec::setTransient | ( | bool | val = true | ) |
Sets the transient flag for this collection.
Transient collections are not written to LCIO files.
Definition at line 68 of file LCCollectionVec.cc.
References _flag, and EVENT::LCCollection::BITTransient.
Referenced by IMPL::LCEventImpl::takeCollection().
|
protected |
Definition at line 150 of file LCCollectionVec.h.
Referenced by getFlag(), isDefault(), isSubset(), isTransient(), setDefault(), setFlag(), setSubset(), and setTransient().
|
protected |
Definition at line 151 of file LCCollectionVec.h.
Referenced by getParameters(), and parameters().
|
protected |
Definition at line 149 of file LCCollectionVec.h.
Referenced by getTypeName().