Back to home page

EIC code displayed by LXR

 
 

    


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

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