11#include "vecmem/containers/details/aligned_multiple_placement.hpp"
12#include "vecmem/utils/details/narrow_size.hpp"
25template <
typename TYPE>
28allocate_jagged_buffer_outer_memory(
30 vecmem::memory_resource& resource) {
50template <
typename TYPE>
53template <
typename TYPE>
55 std::enable_if_t<std::is_convertible<TYPE, OTHERTYPE>::value,
bool> >
62template <
typename TYPE>
64 std::enable_if_t<std::is_integral<SIZE_TYPE>::value &&
65 std::is_unsigned<SIZE_TYPE>::value,
68 const std::vector<SIZE_TYPE, SIZE_ALLOC>&
capacities,
85 TYPE>::value_type::size_type;
101 details::aligned_multiple_placement<header_t, TYPE>(
107 vecmem::details::narrow_size<size_type>(
capacities.size()),
109 : m_outer_host_memory.get()),
110 m_outer_host_memory.get()});
128template <
typename TYPE>
132 if (m_inner_memory) {
133 return m_inner_memory.get_deleter().resource();
139 if ((this->capacity() != 0) && (!m_outer_memory)) {
140 return m_outer_host_memory.get_deleter().resource();
144 return m_outer_memory.get_deleter().resource();
147template <
typename TYPE>
150 return m_outer_host_memory.get_deleter().resource();
155template <
typename TYPE>
162template <
typename TYPE>
An allocator class that wraps a memory resource.
Definition allocator.hpp:37
Object owning all the data of a jagged vector.
Definition jagged_vector_buffer.hpp:30
memory_resource * resource() const
Get the main (device-accessible) memory resource used by this buffer.
Definition jagged_vector_buffer.ipp:129
typename base_type::size_type size_type
Use the base class's size_type.
Definition jagged_vector_buffer.hpp:36
memory_resource * host_resource() const
Get the optional, host-accessible memory resource used by this buffer.
Definition jagged_vector_buffer.ipp:148
typename base_type::value_type value_type
Use the base class's value_type.
Definition jagged_vector_buffer.hpp:38
jagged_vector_buffer()
Make sure that the template type does not have a custom destructor.
Definition jagged_vector_buffer.ipp:51
VECMEM_HOST_AND_DEVICE pointer host_ptr() const
Access the host accessible array describing the inner vectors.
Definition jagged_vector_view.ipp:105
VECMEM_HOST_AND_DEVICE jagged_vector_view & operator=(const jagged_vector_view< OTHERTYPE > &rhs)
Assignment operator from a "slightly different" object.
VECMEM_HOST std::vector< typename vector_view< T >::size_type > get_capacities(const jagged_vector_view< T > &data)
Get the capacities of the inner vectors of a jagged vector.
Definition jagged_vector_view.ipp:111
buffer_type
"Overall type" for a buffer object
Definition buffer_type.hpp:13
@ fixed_size
The buffer has a fixed number of elements.
@ resizable
The buffer is resizable/expandable.
Main namespace for the vecmem classes/functions.
Definition atomic_ref.hpp:16
std::unique_ptr< T, details::unique_alloc_deleter< T > > unique_alloc_ptr
A unique pointer type for trivial types.
Definition unique_ptr.hpp:72
VECMEM_HOST data::vector_view< T > get_data(array< T, N > &a)
Helper function creating a vecmem::data::vector_view object.
Definition array.ipp:217
unique_alloc_ptr< T > make_unique_alloc(memory_resource &m, std::align_val_t alignment)
Create a unique allocation pointer to a type, with a minimum alignment.
Definition unique_ptr.hpp:233