CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
corsika::ParticleBase< TStackIterator > Class Template Reference

The base class to define the readout of particle properties from a particle stack. More...

#include <ParticleBase.hpp>

Inheritance diagram for corsika::ParticleBase< TStackIterator >:

Public Types

typedef TStackIterator stack_iterator_type
 

Public Member Functions

 ParticleBase (ParticleBase &&)=delete
 
 ParticleBase (ParticleBase const &)=delete
 
ParticleBase operator= (ParticleBase &&)=delete
 
ParticleBase operator= (ParticleBase const &)=delete
 
void erase ()
 Delete this particle on the stack. More...
 
bool isErased () const
 Method to retrieve the status of the Particle. More...
 
template<typename... TArgs>
stack_iterator_type addSecondary (const TArgs... args)
 Add a secondary particle based on *this on the stack. More...
 
stack_iterator_type & getIterator ()
 return the corresponding TStackIterator for this particle
 
const stack_iterator_type & getIterator () const
 

Protected Member Functions

Access to underlying stack fData, these are service

function for user classes.

User code can only rely on getIndex and getStackData to retrieve data

auto & getStackData ()
 
const auto & getStackData () const
 
auto & getStack ()
 
const auto & getStack () const
 
std::size_t getIndex () const
 return the index number of the underlying iterator object
 

Detailed Description

template<typename TStackIterator>
class corsika::ParticleBase< TStackIterator >

The base class to define the readout of particle properties from a particle stack.

Every stack must implement this readout via the ParticleBase class.

The TStackIterator template argument is derived from StackIteratorInterface, which is of type template <typename StackData, template <typename> typename ParticleInterface> class StackIteratorInterface : public ParticleInterface<StackIteratorInterface<StackData, ParticleInterface>>

where StackData must refer to a Stack type, and ParticleInterface<StackIteratorInterface> is the corresponding particle readout class.

Thus, StackIteratorInterface is a CRTP class, injecting the full StackIteratorInterface machinery into the ParticleInterface (aka ParticleBase) type!

The declartion of a StackIteratorInterface type simultaneously declares the corresponding ParticleInterface type.

Furthermore, the operator* of the StackIteratorInterface returns a static_cast to the ParticleInterface type, allowing a direct readout of the particle data from the iterator.

Definition at line 43 of file ParticleBase.hpp.

Member Function Documentation

◆ addSecondary()

template<typename TStackIterator>
template<typename... TArgs>
stack_iterator_type corsika::ParticleBase< TStackIterator >::addSecondary ( const TArgs...  args)
inline

Add a secondary particle based on *this on the stack.

Parameters
argsis a variadic list of input data that has to match the function description in the user defined ParticleInterface::AddSecondary(...)

Definition at line 78 of file ParticleBase.hpp.

◆ erase()

template<typename TStackIterator>
void corsika::ParticleBase< TStackIterator >::erase ( )
inline

Delete this particle on the stack.

The corresponding iterator will be invalidated by this operation

Definition at line 62 of file ParticleBase.hpp.

◆ isErased()

template<typename TStackIterator>
bool corsika::ParticleBase< TStackIterator >::isErased ( ) const
inline

Method to retrieve the status of the Particle.

Is it already deleted? Or not.

Definition at line 68 of file ParticleBase.hpp.


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