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

Implementation of the LCCollection using (inheriting from) an STL vector of LCObjects. More...

#include <LCCollectionVec.h>

+ Inheritance diagram for IMPL::LCCollectionVec:

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::stringgetTypeName () const
 Returns the type name of the collection - valid names are defined in LCIO. More...
 
virtual EVENT::LCObjectgetElementAt (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::LCParametersgetParameters () const
 Parameters defined for this run. More...
 
virtual EVENT::LCParametersparameters ()
 Parameters defined for this run. More...
 
- Public Member Functions inherited from EVENT::LCCollection
virtual ~LCCollection ()
 Destructor. More...
 
- Public Member Functions inherited from std::vector< LCObject * >
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)
 
- Public Member Functions inherited from IMPL::AccessChecked
 AccessChecked ()
 
virtual ~AccessChecked ()
 
virtual int simpleUID () const
 

Protected Member Functions

void setReadOnly (bool readOnly)
 
- Protected Member Functions inherited from IMPL::AccessChecked
void checkAccess ()
 
void checkAccess (const char *what)
 

Protected Attributes

std::string _typeName
 
int _flag
 
LCParametersImpl _params {}
 
- Protected Attributes inherited from IMPL::AccessChecked
bool _readOnly {false}
 
int _id {-1}
 

Additional Inherited Members

- Public Attributes inherited from std::vector< LCObject * >
LCObject * elements
 STL member. More...
 
- Static Public Attributes inherited from EVENT::LCCollection
static const int BITTransient = 16
 Transient bit in flag word. More...
 
static const int BITDefault = 17
 
static const int BITSubset = 18
 
- Static Protected Attributes inherited from IMPL::AccessChecked
static std::atomic_int _lCObjectId
 

Detailed Description

Implementation of the LCCollection using (inheriting from) an STL vector of LCObjects.

Author
gaede
Version
Id:
LCCollectionVec.h,v 1.12 2010-01-21 16:27:36 gaede Exp
See Also
LCObject
LCCollection

Definition at line 25 of file LCCollectionVec.h.

Constructor & Destructor Documentation

IMPL::LCCollectionVec::LCCollectionVec ( )
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.

IMPL::LCCollectionVec::~LCCollectionVec ( )
virtual

Destructor.

Definition at line 33 of file LCCollectionVec.cc.

References std::vector< LCObject * >::begin(), std::vector< LCObject * >::end(), and isSubset().

Member Function Documentation

void IMPL::LCCollectionVec::addElement ( EVENT::LCObject obj)
virtual

Adds the given element to (end of) the collection.

Throws an exception if the collection (event) is 'read only'.

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

EVENT::LCObject * IMPL::LCCollectionVec::getElementAt ( int  index) const
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().

int IMPL::LCCollectionVec::getFlag ( ) const
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.

See Also
isTransient()

Implements EVENT::LCCollection.

Definition at line 93 of file LCCollectionVec.cc.

References _flag.

int IMPL::LCCollectionVec::getNumberOfElements ( ) const
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().

virtual const EVENT::LCParameters& IMPL::LCCollectionVec::getParameters ( ) const
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().

const std::string & IMPL::LCCollectionVec::getTypeName ( ) const
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.

bool IMPL::LCCollectionVec::isDefault ( ) const
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.

bool IMPL::LCCollectionVec::isSubset ( ) const
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().

bool IMPL::LCCollectionVec::isTransient ( ) const
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.

virtual EVENT::LCParameters& IMPL::LCCollectionVec::parameters ( )
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().

void IMPL::LCCollectionVec::removeElementAt ( int  i)
virtual

Removes the i-th element from the collection.

Throws an exception if the collection (event) is 'read only'.

Exceptions
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.

void IMPL::LCCollectionVec::setFlag ( int  flag)
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().

void IMPL::LCCollectionVec::setReadOnly ( bool  readOnly)
protectedvirtual
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().

Member Data Documentation

int IMPL::LCCollectionVec::_flag
protected
LCParametersImpl IMPL::LCCollectionVec::_params {}
protected

Definition at line 151 of file LCCollectionVec.h.

Referenced by getParameters(), and parameters().

std::string IMPL::LCCollectionVec::_typeName
protected

Definition at line 149 of file LCCollectionVec.h.

Referenced by getTypeName().


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