IMPL::LCCollectionVec Class Reference

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

#include <IMPL/LCCollectionVec.h>

Inheritance diagram for IMPL::LCCollectionVec:
EVENT::LCCollection IMPL::AccessChecked IOIMPL::LCCollectionIOVec

List of all members.

Public Member Functions

 LCCollectionVec ()
 Default Constructor - don't use - only public for auto-generated streamers in the ROOT dictionary !! Should be protected really.
 LCCollectionVec (const std::string &type)
 The public default constructur that takes the name of the type of the elements.
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::LCObjectgetElementAt (int index) const
 Returns pointer to element at index - no range check !.
virtual int getFlag () const
 Returns flag word for collection.
virtual bool isTransient () const
 True if collection is transient, i.e.
void setTransient (bool val=true)
 Sets the transient flag for this collection.
virtual bool isDefault () const
 True if collection is the default collection for the given type.
void setDefault (bool val=true)
 Sets the default flag for this collection.
virtual bool isSubset () const
 True if the collection holds a subset of objects from other collections.
void setSubset (bool val=true)
 Sets the subset flag for this collection.
void setFlag (int flag)
 Sets the flag word for this collection.
virtual void addElement (EVENT::LCObject *obj)
 Adds the given element to (end of) the collection.
virtual void removeElementAt (int i)
 Removes the i-th element from the collection.
virtual const EVENT::LCParametersgetParameters () const
 Parameters defined for this run.
virtual EVENT::LCParametersparameters ()
 Parameters defined for this run.

Protected Member Functions

void setReadOnly (bool readOnly)

Protected Attributes

std::string _typeName
int _flag

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

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.

IMPL::LCCollectionVec::LCCollectionVec ( const std::string &  type  ) 

The public default constructur that takes the name of the type of the elements.


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.

Referenced by UTIL::LCRelationNavigator::createLCCollection().

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.

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.

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.

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.

References EVENT::LCCollection::BITTransient.

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.

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


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