11 #include <corsika/framework/stack/ParticleBase.hpp> 13 #include <boost/type_index.hpp> 16 template <
typename T,
template <
typename>
typename TParticleInterface>
22 template <
typename TStackData,
template <
typename>
typename TParticleInterface,
23 template <
class T1,
template <
class>
class T2>
class MSecondaryProducer>
26 template <
typename TStackData,
template <
typename>
typename TParticleInterface,
27 template <
class T1,
template <
class>
class T2>
class MSecondaryProducer>
30 template <
typename TStackData,
template <
typename>
typename TParticleInterface,
31 template <
class T1,
template <
class>
class T2>
class MSecondaryProducer,
75 template <
typename TStackData,
template <
typename>
typename TParticleInterface,
76 template <
typename T1,
template <
class>
class T2>
class MSecondaryProducer,
80 :
public TParticleInterface<StackIteratorInterface<
81 TStackData, TParticleInterface, MSecondaryProducer, TStackType>> {
85 TStackData, TParticleInterface, MSecondaryProducer, TStackType>>
86 particle_interface_type;
88 typedef TStackType stack_type;
89 typedef TStackData stack_data_type;
95 : index_(
std::move(rhs.index_))
96 , data_(
std::move(rhs.data_)) {}
129 template <
typename... TArgs>
135 (**this).setParticleData(args...);
150 template <
typename... TArgs>
156 (**this).setParticleData(*parent, args...);
159 bool isErased()
const {
return getStack().isErased(*
this); }
170 getStack().isErased(*
this));
178 getStack().isErased(*
this));
185 return index_ == rhs.index_;
188 return index_ != rhs.index_;
191 TStackData, TParticleInterface, MSecondaryProducer,
192 stack_type>& rhs)
const;
194 TStackData, TParticleInterface, MSecondaryProducer,
195 stack_type>& rhs)
const;
202 return static_cast<particle_interface_type&
>(*this);
210 return static_cast<particle_interface_type const&
>(*this);
219 unsigned int getIndex()
const {
return index_; }
224 stack_type
const&
getStack()
const {
return *data_; }
228 TStackData
const&
getStackData()
const {
return data_->getStackData(); }
231 return data_->getIndexFromIterator(index_);
236 friend class Stack<TStackData, TParticleInterface,
238 friend class Stack<TStackData&, TParticleInterface,
243 template <
typename T1,
244 template <
typename>
typename M1,
245 template <
typename T,
template <
typename>
typename T3>
typename M2>
248 template <
typename T,
template <
typename>
typename TParticleInterface_>
252 MSecondaryProducer, stack_type>;
255 unsigned int index_ = 0;
258 stack_type* data_ = 0;
277 template <
typename TStackData,
template <
typename>
typename TParticleInterface,
278 template <
typename T1,
template <
class>
class T2>
class MSecondaryProducer,
279 typename TStackType =
282 :
public TParticleInterface<ConstStackIteratorInterface<
283 TStackData, TParticleInterface, MSecondaryProducer, TStackType>> {
287 TStackData, TParticleInterface, MSecondaryProducer, TStackType>>
288 particle_interface_type;
290 typedef TStackType stack_type;
291 typedef TStackData stack_data_type;
298 : index_(
std::move(rhs.index_))
299 , data_(
std::move(rhs.data_)) {}
305 bool isErased()
const {
return getStack().isErased(*
this); }
315 getStack().isErased(*
this));
323 getStack().isErased(*
this));
330 return index_ == rhs.index_;
333 return index_ != rhs.index_;
337 stack_type>
const& rhs)
const {
338 return index_ == rhs.index_;
342 stack_type>
const& rhs)
const {
343 return index_ != rhs.index_;
346 particle_interface_type
const&
operator*()
const {
347 return static_cast<particle_interface_type const&
>(*this);
357 unsigned int getIndex()
const {
return index_; }
358 stack_type
const& getStack()
const {
return *data_; }
359 stack_data_type
const& getStackData()
const {
return data_->getStackData(); }
362 return data_->getIndexFromIterator(index_);
367 friend class Stack<stack_data_type, TParticleInterface,
369 friend class Stack<stack_data_type&, TParticleInterface,
374 template <
typename T1,
375 template <
typename>
typename M1,
376 template <
class T2,
template <
class>
class T3>
class M2>
377 friend class SecondaryView;
380 MSecondaryProducer, stack_type>;
382 template <
typename T,
template <
typename>
typename TParticleInterface_>
386 unsigned int index_ = 0;
389 stack_type
const* data_ = 0;
TStackData & getStackData()
Get current user particle TStackData object.
particle_interface_type const & operator*() const
Convert iterator to const value type, where value type is the user-provided particle readout class...
The Stack class provides (and connects) the main particle data storage machinery. ...
StackIteratorInterface(stack_type &data, unsigned int const index, const TArgs... args)
Constructor that also sets new values on particle data object.
particle_interface_type & operator*()
Convert iterator to value type, where value type is the user-provided particle readout class...
constexpr quantity< D, X > operator+(quantity< D, X > const &x)
stack_type const & getStack() const
Get current particle const Stack object.
TStackData const & getStackData() const
Get current const user particle TStackData object.
Vector< phys::units::detail::product_d< TDimension, UDimension > > operator*(quantity< UDimension > const n, Vector< TDimension > const &vec)
Free operator to allow commutative multiplications of quantities and Vector.
`, since they are used everywhere as integral part of the framework.
constexpr bool operator!=(quantity< D, X > const &x, quantity< D, Y > const &y)
inequality.
StackIteratorInterface(StackIteratorInterface &&rhs)
unsigned int getIndexFromIterator() const
Get data index as mapped in Stack class.
StackIteratorInterface(stack_type &data, unsigned int const index)
Iterator must always point to data, with an index.
SecondaryView can only be constructed by giving a valid Projectile particle, following calls to addSe...
ConstStackIteratorInterface(ConstStackIteratorInterface &&rhs)
unsigned int getIndexFromIterator() const
Get data index as mapped in Stack class.
stack_type & getStack()
Get current particle Stack object.
The base class to define the readout of particle properties from a particle stack.
This is the iterator class for const-access to stack data.
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...
The StackIteratorInterface is the main interface to iterator over particles on a stack.