Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:49

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2023-2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file corecel/sys/detail/ActionRegistryImpl.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <type_traits>
0011 
0012 namespace celeritas
0013 {
0014 //---------------------------------------------------------------------------//
0015 class ActionInterface;
0016 
0017 namespace detail
0018 {
0019 //---------------------------------------------------------------------------//
0020 //! Traits class for differentiating const from mutable actions.
0021 template<class T, class = void>
0022 struct ActionSpTraits
0023 {
0024     static constexpr bool is_const_action = false;
0025     static constexpr bool is_mutable_action = false;
0026 };
0027 template<class T>
0028 struct ActionSpTraits<T, std::enable_if_t<std::is_base_of_v<ActionInterface, T>>>
0029 {
0030     static constexpr bool is_const_action = std::is_const_v<T>;
0031     static constexpr bool is_mutable_action = !is_const_action;
0032 };
0033 
0034 //---------------------------------------------------------------------------//
0035 //! True if T is a const class inheriting from ActionInterface.
0036 template<class T>
0037 inline constexpr bool is_const_action_v = ActionSpTraits<T>::is_const_action;
0038 
0039 //---------------------------------------------------------------------------//
0040 //! True if T is a mutable class inheriting from ActionInterface.
0041 template<class T>
0042 inline constexpr bool is_mutable_action_v
0043     = ActionSpTraits<T>::is_mutable_action;
0044 
0045 //---------------------------------------------------------------------------//
0046 }  // namespace detail
0047 }  // namespace celeritas