Skip to content
Snippets Groups Projects
Select Git revision
  • 4a03910c548cc3e3cc24b1b0c64ca1b2377a4acc
  • master default protected
  • jul25_patches
  • nightly_master
  • online_mvd_readconf_cleanup protected
  • online_much_readconf_cleanup protected
  • cleanup_rich_v25a
  • jul24_patches
  • nov23_patches
  • DC_2404
  • nighly_master
  • DC_Jan24
  • DC_Nov23
  • DC_Oct23
  • feb23_patches
  • L1Algo-dev9
  • dec21_patches protected
  • apr21_patches protected
  • RC2_jul25
  • dev_2025_46
  • dev_2025_45
  • dev_2025_44
  • dev_2025_43
  • dev_2025_42
  • dev_2025_41
  • dev_2025_40
  • dev_2025_39
  • dev_2025_38
  • dev_2025_37
  • dev_2025_36
  • dev_2025_35
  • dev_2025_34
  • dev_2025_33
  • dev_2025_32
  • dev_2025_31
  • dev_2025_30
  • RC_jul25
  • dev_2025_29
38 results

inform_codeowners.sh

Blame
  • AlgoTraits.h 1.71 KiB
    /* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
       SPDX-License-Identifier: GPL-3.0-only
       Authors: Felix Weiglhofer [committer] */
    
    #pragma once
    
    #include <tuple>
    #include <type_traits>
    
    /**
     * @file AlgoTraits.h
     * @brief Type traits for online algorithms
     */
    
    namespace cbm::algo::algo_traits
    {
    
      namespace detail
      {
        template<typename...>
        struct ResultOf {
        };
    
        template<typename R, typename Algo, typename... Args>
        struct ResultOf<R (Algo::*)(Args...) const> {
          using type = R;
        };
    
        template<typename R, typename Algo, typename... Args>
        struct ResultOf<R (Algo::*)(Args...)> {
          using type = R;
        };
    
        template<typename Algo>
        struct ResultOf<Algo> : ResultOf<decltype(&Algo::operator())> {
        };
    
      }  // namespace detail
    
      /**
       * @brief Type alias for the return type produced by an algorithm when invoked via callable-operator
       */
      template<typename Algo>
      using ResultOf_t = typename detail::ResultOf<Algo>::type;
    
      // Currently assume algorithms return std::tuple<R, M, A>
      // where R is the output, M is the monitoring data and A is auxiliary data
    
      /**
       * @brief Type alias for the output type produced by an algorithm
       */
      template<typename Algo>
      using Output_t = typename std::tuple_element<0, ResultOf_t<Algo>>::type;
    
      /**
       * @brief Type alias for the monitoring type produced by an algorithm
       */
      template<typename Algo>
      using Monitor_t = typename std::tuple_element<1, ResultOf_t<Algo>>::type;
    
      /**
       * @brief Type alias for the auxiliary data type produced by an algorithm
       */
      template<typename Algo>
      using Aux_t = typename std::tuple_element<2, ResultOf_t<Algo>>::type;
    
    }  // namespace cbm::algo::algo_traits