vecmem 1.14.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
vecmem::data::jagged_vector_data< T > Class Template Reference

A data wrapper for jagged vectors. More...

#include <vecmem/containers/data/jagged_vector_data.hpp>

Inheritance diagram for vecmem::data::jagged_vector_data< T >:
vecmem::data::jagged_vector_view< T >

Public Types

using base_type = jagged_vector_view< T >
 Type of the base class.
 
using size_type = typename base_type::size_type
 Use the base class's size_type.
 
using value_type = typename base_type::value_type
 Use the base class's value_type.
 
using pointer = std::add_pointer_t< value_type >
 Pointer type to the jagged array.
 

Public Member Functions

 jagged_vector_data ()
 Default constructor.
 
 jagged_vector_data (size_type size, memory_resource &mem)
 Construct jagged vector data from raw information.
 
 jagged_vector_data (jagged_vector_data &&) noexcept=default
 Move constructor.
 
jagged_vector_dataoperator= (jagged_vector_data &&) noexcept=default
 Move assignment.
 
template<typename OTHERTYPE , std::enable_if_t< std::is_same< std::remove_cv_t< T >, std::remove_cv_t< OTHERTYPE > >::value, bool > = true>
VECMEM_HOST_AND_DEVICE bool operator== (const jagged_vector_view< OTHERTYPE > &rhs) const
 Equality check.
 
template<typename OTHERTYPE , std::enable_if_t< std::is_same< std::remove_cv_t< T >, std::remove_cv_t< OTHERTYPE > >::value, bool > = true>
VECMEM_HOST_AND_DEVICE bool operator!= (const jagged_vector_view< OTHERTYPE > &rhs) const
 Inequality check. Simply based on operator==.
 
VECMEM_HOST_AND_DEVICE size_type size () const
 Get the "outer" size of the jagged vector.
 
VECMEM_HOST_AND_DEVICE size_type capacity () const
 Get the maximum capacity of the "outer" vector.
 
VECMEM_HOST_AND_DEVICE pointer ptr () const
 Get a pointer to the vector elements.
 
VECMEM_HOST_AND_DEVICE pointer host_ptr () const
 Access the host accessible array describing the inner vectors.
 

Detailed Description

template<typename T>
class vecmem::data::jagged_vector_data< T >

A data wrapper for jagged vectors.

This class constructs the relevant administrative data from a vector of vectors, and is designed to be later turned into a jagged_vector_view object.

Constructor & Destructor Documentation

◆ jagged_vector_data() [1/2]

template<typename T >
vecmem::data::jagged_vector_data< T >::jagged_vector_data ( )

Default constructor.

A custom implementation for the default constructor is necessary because vecmem::data::jagged_vector_view does not set its members to anything explicitly in its default constructor.

(In order to be trivially default constructible.) So here we need to be explicit.

◆ jagged_vector_data() [2/2]

template<typename T >
vecmem::data::jagged_vector_data< T >::jagged_vector_data ( size_type  size,
memory_resource &  mem 
)

Construct jagged vector data from raw information.

This class converts from std vectors (or rather, vecmem::vectors) to a jagged vector data.

Parameters
[in]sizeSize of the "outer vector"
[in]memThe memory resource to manage the internal state

Member Function Documentation

◆ host_ptr()

template<typename T >
VECMEM_HOST_AND_DEVICE auto vecmem::data::jagged_vector_view< T >::host_ptr ( ) const
inherited

Access the host accessible array describing the inner vectors.

This may or may not return the same pointer as ptr(). If the underlying data is stored in host-accessible memory, then the two will be the same.

If not, then ptr() will return the device accessible array, and this function returns a host-accessible one.

Returns
A host-accessible pointer to the array describing the inner vectors

◆ operator==()

template<typename T >
template<typename OTHERTYPE , std::enable_if_t< std::is_same< std::remove_cv_t< T >, std::remove_cv_t< OTHERTYPE > >::value, bool > >
VECMEM_HOST_AND_DEVICE bool vecmem::data::jagged_vector_view< T >::operator== ( const jagged_vector_view< OTHERTYPE > &  rhs) const
inherited

Equality check.

Two objects are only equal if they point at the same memory.


The documentation for this class was generated from the following files: