diff --git a/corsika/detail/framework/process/ProcessSequence.inl b/corsika/detail/framework/process/ProcessSequence.inl index 9a9cc4d4f00f96a451f403262b87a501ce317552..fc020079d28ef708a5cb1fd4884383f001967c96 100644 --- a/corsika/detail/framework/process/ProcessSequence.inl +++ b/corsika/detail/framework/process/ProcessSequence.inl @@ -121,7 +121,9 @@ namespace corsika { //~ "doContinuous(TParticle [const]&,TTrack [const]&,bool)\" required for " //~ "ContinuousProcess<TDerived>. "); - ret |= A_.doContinuous(step, limitId == ContinuousProcessIndex(IndexProcess1)); + ret |= A_.doContinuous( + step, limitId == ContinuousProcessIndex( + reinterpret_cast<void const*>(std::addressof(A_)))); } } @@ -142,7 +144,9 @@ namespace corsika { //~ "doContinuous(TParticle [const]&,TTrack [const]&,bool)\" required for " //~ "ContinuousProcess<TDerived>. "); - ret |= B_.doContinuous(step, limitId == ContinuousProcessIndex(IndexProcess2)); + ret |= B_.doContinuous( + step, limitId == ContinuousProcessIndex( + reinterpret_cast<void const*>(std::addressof(B_)))); } } @@ -279,8 +283,9 @@ namespace corsika { "getMaxStepLength(TParticle const&, TTrack const&)\" required for " "ContinuousProcess<TDerived>. "); - ContinuousProcessStepLength const step(A_.getMaxStepLength(particle, vTrack), - ContinuousProcessIndex(IndexProcess1)); + ContinuousProcessStepLength const step( + A_.getMaxStepLength(particle, vTrack), + ContinuousProcessIndex(reinterpret_cast<void const*>(std::addressof(A_)))); max_length = std::min(max_length, step); } } @@ -299,8 +304,9 @@ namespace corsika { "getMaxStepLength(TParticle const&, TTrack const&)\" required for " "ContinuousProcess<TDerived>. "); - ContinuousProcessStepLength const step(B_.getMaxStepLength(particle, vTrack), - ContinuousProcessIndex(IndexProcess2)); + ContinuousProcessStepLength const step( + B_.getMaxStepLength(particle, vTrack), + ContinuousProcessIndex(reinterpret_cast<void const*>(std::addressof(B_)))); max_length = std::min(max_length, step); } } diff --git a/corsika/detail/framework/process/SwitchProcessSequence.inl b/corsika/detail/framework/process/SwitchProcessSequence.inl index 0fbe23aacd022fa146dac2c756328777a0ec0703..ff81094f470a4cc27affeeed8f0650f200d7eee0 100644 --- a/corsika/detail/framework/process/SwitchProcessSequence.inl +++ b/corsika/detail/framework/process/SwitchProcessSequence.inl @@ -99,7 +99,9 @@ namespace corsika { // "doContinuous(TParticle[const]&,TTrack[const]&,bool)\" required for // " "ContinuousProcess<TDerived>. "); - return A_.doContinuous(step, idLimit == ContinuousProcessIndex(IndexProcess1)); + return A_.doContinuous( + step, idLimit == ContinuousProcessIndex( + reinterpret_cast<void const*>(std::addressof(A_)))); } } else { if constexpr (process2_type::is_process_sequence) { @@ -120,7 +122,9 @@ namespace corsika { // "doContinuous(TParticle [const]&,TTrack[const]&,bool)\" required for // " "ContinuousProcess<TDerived>. "); - return B_.doContinuous(step, idLimit == ContinuousProcessIndex(IndexProcess2)); + return B_.doContinuous( + step, idLimit == ContinuousProcessIndex( + reinterpret_cast<void const*>(std::addressof(B_)))); } } return ProcessReturn::Ok; @@ -184,8 +188,9 @@ namespace corsika { "getMaxStepLength(TParticle const&, TTrack const&)\" required for " "ContinuousProcess<TDerived>. "); - return ContinuousProcessStepLength(A_.getMaxStepLength(particle, vTrack), - ContinuousProcessIndex(IndexProcess1)); + return ContinuousProcessStepLength( + A_.getMaxStepLength(particle, vTrack), + ContinuousProcessIndex(reinterpret_cast<void const*>(std::addressof(A_)))); } } else { if constexpr (process2_type::is_process_sequence) { @@ -200,8 +205,9 @@ namespace corsika { "getMaxStepLength(TParticle const&, TTrack const&)\" required for " "ContinuousProcess<TDerived>. "); - return ContinuousProcessStepLength(B_.getMaxStepLength(particle, vTrack), - ContinuousProcessIndex(IndexProcess2)); + return ContinuousProcessStepLength( + B_.getMaxStepLength(particle, vTrack), + ContinuousProcessIndex(reinterpret_cast<void const*>(std::addressof(B_)))); } } diff --git a/corsika/framework/process/ContinuousProcessIndex.hpp b/corsika/framework/process/ContinuousProcessIndex.hpp index 7192b86bf968ffdc74b5420940ea549befa12c73..6898633e9b3cde1b6446ed2fe09b1ce4c2297d92 100644 --- a/corsika/framework/process/ContinuousProcessIndex.hpp +++ b/corsika/framework/process/ContinuousProcessIndex.hpp @@ -19,16 +19,16 @@ namespace corsika { class ContinuousProcessIndex { public: ContinuousProcessIndex() - : id_(-1) {} // default - ContinuousProcessIndex(int const id) + : id_(nullptr) {} // default + ContinuousProcessIndex(void const* id) : id_(id) {} - void setIndex(int const id) { id_ = id; } - int getIndex() const { return id_; } + void setIndex(void const* id) { id_ = id; } + void const* getIndex() const { return id_; } bool operator==(ContinuousProcessIndex const v) const { return id_ == v.id_; } - bool operator!=(ContinuousProcessIndex const v) const { return id_ != v.id_; } + bool operator!=(ContinuousProcessIndex const v) const { return !(*this == v); } private: - int id_; + void const* id_; }; } // namespace corsika