Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:09:37

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file corecel/data/detail/DisabledStorage.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <cstddef>
0010 #include <type_traits>
0011 
0012 #include "corecel/Assert.hh"
0013 
0014 namespace celeritas
0015 {
0016 namespace detail
0017 {
0018 //---------------------------------------------------------------------------//
0019 /*!
0020  * Null-op placeholder for "value" container on device.
0021  */
0022 template<class T>
0023 class DisabledStorage
0024 {
0025   public:
0026     //!@{
0027     //! \name Type aliases
0028     using element_type = T;
0029     using value_type = std::remove_cv_t<T>;
0030     using size_type = std::size_t;
0031     using pointer = T*;
0032     using const_pointer = T const*;
0033     using reference = T&;
0034     using const_reference = T const&;
0035     using iterator = pointer;
0036     using const_iterator = const_pointer;
0037     using SpanT = Span<T>;
0038     using SpanConstT = Span<T const>;
0039     //!@}
0040   public:
0041     //!@{
0042     //! Null-op functions that should never be called
0043     DisabledStorage() { CELER_ASSERT_UNREACHABLE(); }
0044     explicit DisabledStorage(size_type) { CELER_ASSERT_UNREACHABLE(); }
0045     CELER_FORCEINLINE_FUNCTION bool empty() const
0046     {
0047         CELER_ASSERT_UNREACHABLE();
0048         return true;
0049     }
0050     CELER_FORCEINLINE_FUNCTION size_type size() const
0051     {
0052         CELER_ASSERT_UNREACHABLE();
0053         return 0;
0054     }
0055     CELER_FORCEINLINE_FUNCTION pointer data() const
0056     {
0057         CELER_ASSERT_UNREACHABLE();
0058         return nullptr;
0059     }
0060     CELER_FORCEINLINE_FUNCTION void assign(T const*, T const*)
0061     {
0062         CELER_ASSERT_UNREACHABLE();
0063     }
0064     CELER_FORCEINLINE_FUNCTION void copy_to_device(SpanConstT)
0065     {
0066         CELER_ASSERT_UNREACHABLE();
0067     }
0068     CELER_FORCEINLINE_FUNCTION void copy_to_host(SpanT) const
0069     {
0070         CELER_ASSERT_UNREACHABLE();
0071     }
0072 
0073     //!@}
0074 };
0075 
0076 //---------------------------------------------------------------------------//
0077 }  // namespace detail
0078 }  // namespace celeritas