IAP GITLAB

Skip to content
Snippets Groups Projects
BaseProcess.h 1.74 KiB
Newer Older
ralfulrich's avatar
ralfulrich committed
 * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
 *
 * See file AUTHORS for a list of contributors.
 *
 * This software is distributed under the terms of the GNU General Public
 * Licence version 3 (GPL Version 3). See file LICENSE for a full version of
 * the license.
 */
ralfulrich's avatar
ralfulrich committed
#ifndef _include_corsika_baseprocess_h_
#define _include_corsika_baseprocess_h_

#include <corsika/process/ProcessReturn.h> // for convenience

namespace corsika::process {

  /**
     \class BaseProcess

     The structural base type of a process object in a
     ProcessSequence. Both, the ProcessSequence and all its elements
     are of type BaseProcess<T>

   */

  template <typename derived>
  struct BaseProcess {
    derived& GetRef() { return static_cast<derived&>(*this); }
    const derived& GetRef() const { return static_cast<const derived&>(*this); }
Ralf Ulrich's avatar
Ralf Ulrich committed
    template <typename Particle, typename Stack>
    inline EProcessReturn DoDiscrete(Particle&, Stack&) const; // {}
Ralf Ulrich's avatar
Ralf Ulrich committed
    template <typename Particle, typename Track, typename Stack>
    inline EProcessReturn DoContinuous(Particle&, Track&, Stack&) const; // {}
ralfulrich's avatar
ralfulrich committed
    template <typename Particle, typename Track>
      inline double GetInverseInteractionLength(Particle& p, Track& t) const {
      return 1./GetRef().GetInteractionLength(p, t);
    }
ralfulrich's avatar
ralfulrich committed
  /*
  template<template<typename, typename> class T, typename A, typename B>
    typename BaseProcess< T<A, B> >::is_process_sequence
ralfulrich's avatar
ralfulrich committed
    {
      static const bool value = true;
    };
  */
Ralf Ulrich's avatar
Ralf Ulrich committed
  /*
  template <typename T>
  struct is_base {
    static const bool value = false;
  };
  template <typename T>
  struct is_base<BaseProcess<T>> {
    static const bool value = true;
  };
Ralf Ulrich's avatar
Ralf Ulrich committed
  */

} // namespace corsika::process
ralfulrich's avatar
ralfulrich committed

#endif