|
CORSIKA
@c8_version@
The framework to simulate particle cascades for astroparticle physics
|
The StackIteratorInterface is the main interface to iterator over particles on a stack. More...
#include <StackIteratorInterface.hpp>

Public Types | |
| typedef TParticleInterface< corsika::StackIteratorInterface< TStackData, TParticleInterface, MSecondaryProducer, TStackType > > | particle_interface_type |
| typedef TStackType | stack_type |
| typedef TStackData | stack_data_type |
Public Member Functions | |
| StackIteratorInterface (StackIteratorInterface &&rhs) | |
| StackIteratorInterface (StackIteratorInterface const &vR) | |
| StackIteratorInterface & | operator= (StackIteratorInterface const &vR) |
| StackIteratorInterface (stack_type &data, unsigned int const index) | |
| Iterator must always point to data, with an index. More... | |
| template<typename... TArgs> | |
| StackIteratorInterface (stack_type &data, unsigned int const index, const TArgs... args) | |
| Constructor that also sets new values on particle data object. More... | |
| template<typename... TArgs> | |
| StackIteratorInterface (stack_type &data, unsigned int const index, StackIteratorInterface &parent, const TArgs... args) | |
| Constructor that also sets new values on particle data object, including reference to parent particle. More... | |
| bool | isErased () const |
Iterator interface | |
| StackIteratorInterface & | operator++ () |
| StackIteratorInterface | operator++ (int) |
| StackIteratorInterface | operator+ (int delta) const |
| bool | operator== (StackIteratorInterface const &rhs) const |
| bool | operator!= (StackIteratorInterface const &rhs) const |
| bool | operator== (const ConstStackIteratorInterface< TStackData, TParticleInterface, MSecondaryProducer, stack_type > &rhs) const |
| bool | operator!= (const ConstStackIteratorInterface< TStackData, TParticleInterface, MSecondaryProducer, stack_type > &rhs) const |
| particle_interface_type & | operator* () |
| Convert iterator to value type, where value type is the user-provided particle readout class. | |
| particle_interface_type const & | operator* () const |
| Convert iterator to const value type, where value type is the user-provided particle readout class. | |
Protected Member Functions | |
Stack data access | |
| unsigned int | getIndex () const |
| Get current particle index. | |
| stack_type & | getStack () |
| Get current particle Stack object. | |
| stack_type const & | getStack () const |
| Get current particle const Stack object. | |
| TStackData & | getStackData () |
| Get current user particle TStackData object. | |
| TStackData const & | getStackData () const |
| Get current const user particle TStackData object. | |
| unsigned int | getIndexFromIterator () const |
| Get data index as mapped in Stack class. | |
Protected Attributes | |
| unsigned int | index_ = 0 |
The StackIteratorInterface is the main interface to iterator over particles on a stack.
At the same time StackIteratorInterface is a Particle object by itself, thus there is no difference between type and ref_type for convenience of the physicist.
This allows to write code like:
The template argument Stack determines the type of Stack object the data is stored in. A pointer to the Stack object is part of the StackIteratorInterface. In addition to Stack the iterator only knows the index index_ in the Stack data.
The template argument TParticleInterface acts as a policy to provide readout function of Particle data from the stack. The TParticleInterface class must know how to retrieve information from the Stack data for a particle entry at any index index_.
The TParticleInterface class must be written and provided by the user, it contains methods like auto getData() const { return getStackData().getData(getIndex()); }, where StackIteratorInterface::getStackData() return a reference to the object storing the particle data of type TStackData. And StackIteratorInterface::getIndex() provides the iterator index to be readout. The TStackData is another user-provided class to store data and must implement functions compatible with TParticleInterface, in this example TStackData::getData(const unsigned int vIndex).
For two examples see stack_example.cc, or the corsika::sibyll::SibStack class.
Definition at line 79 of file StackIteratorInterface.hpp.
|
inline |
Definition at line 94 of file StackIteratorInterface.hpp.
|
inline |
Iterator must always point to data, with an index.
| data | reference to the stack [rw] |
| index | index on stack |
Definition at line 116 of file StackIteratorInterface.hpp.
|
inline |
Constructor that also sets new values on particle data object.
| data | reference to the stack [rw]. |
| index | index on stack. |
| args | variadic list of data to initialize stack entry, this must be consistent with the definition of the user-provided particle_interface_type::setParticleData(...) function. |
Definition at line 130 of file StackIteratorInterface.hpp.
|
inline |
Constructor that also sets new values on particle data object, including reference to parent particle.
| data | reference to the stack [rw] |
| index | index on stack |
| parent | to parent particle [rw]. This can be used for thinning, particle counting, history, etc. |
| args | variadic list of data to initialize stack entry, this must be consistent with the definition of the user-provided particle_interface_type::setParticleData(...) function. |
Definition at line 151 of file StackIteratorInterface.hpp.