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

Class holding data about a 1 dimensional vector/array. More...

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

Inheritance diagram for vecmem::data::vector_view< TYPE >:
vecmem::data::vector_buffer< TYPE >

Public Types

using size_type = unsigned int
 We cannot use boolean types.
 
using size_pointer = std::conditional_t< std::is_const< TYPE >::value, std::add_pointer_t< std::add_const_t< size_type > >, std::add_pointer_t< size_type > >
 Pointer type to the size of the array.
 
using pointer = std::add_pointer_t< TYPE >
 Pointer type to the array.
 

Public Member Functions

 vector_view ()=default
 Default constructor.
 
VECMEM_HOST_AND_DEVICE vector_view (size_type size, pointer ptr)
 Constant size data constructor.
 
VECMEM_HOST_AND_DEVICE vector_view (size_type capacity, size_pointer size, pointer ptr)
 Resizable data constructor.
 
template<typename OTHERTYPE , std::enable_if_t< details::is_same_nc< TYPE, OTHERTYPE >::value, bool > = true>
VECMEM_HOST_AND_DEVICE vector_view (const vector_view< OTHERTYPE > &parent)
 Constructor from a "slightly different" vecmem::details::vector_view object.
 
template<typename OTHERTYPE , std::enable_if_t< details::is_same_nc< TYPE, OTHERTYPE >::value, bool > = true>
VECMEM_HOST_AND_DEVICE vector_viewoperator= (const vector_view< OTHERTYPE > &rhs)
 Copy from a "slightly different" vecmem::details::vector_view object.
 
template<typename OTHERTYPE , std::enable_if_t< std::is_same< std::remove_cv_t< TYPE >, std::remove_cv_t< OTHERTYPE > >::value, bool > = true>
VECMEM_HOST_AND_DEVICE bool operator== (const vector_view< OTHERTYPE > &rhs) const
 Equality check.
 
template<typename OTHERTYPE , std::enable_if_t< std::is_same< std::remove_cv_t< TYPE >, std::remove_cv_t< OTHERTYPE > >::value, bool > = true>
VECMEM_HOST_AND_DEVICE bool operator!= (const vector_view< OTHERTYPE > &rhs) const
 Inequality check. Simply based on operator==.
 
VECMEM_HOST_AND_DEVICE size_type size () const
 Get the size of the vector.
 
VECMEM_HOST_AND_DEVICE size_type capacity () const
 Get the maximum capacity of the vector.
 
VECMEM_HOST_AND_DEVICE size_pointer size_ptr () const
 Get a pointer to the size of the vector.
 
VECMEM_HOST_AND_DEVICE pointer ptr () const
 Get a pointer to the vector elements.
 
template<typename OTHERTYPE , std::enable_if_t< details::is_same_nc< TYPE, OTHERTYPE >::value, bool > >
VECMEM_HOST_AND_DEVICE vector_view< TYPE > & operator= (const vector_view< OTHERTYPE > &rhs)
 

Detailed Description

template<typename TYPE>
class vecmem::data::vector_view< TYPE >

Class holding data about a 1 dimensional vector/array.

This type is meant to "formalise" the communication of data between vecmem::vector, vecmem::array ("host types") and vecmem::(const_)device_vector, vecmem::(const_)device_array ("device types").

This type does not own the data that it points to. It merely provides a "view" of that data.

Member Typedef Documentation

◆ size_type

We cannot use boolean types.

Size type used in the class

Constructor & Destructor Documentation

◆ vector_view()

template<typename TYPE >
template<typename OTHERTYPE , std::enable_if_t< details::is_same_nc< TYPE, OTHERTYPE >::value, bool > >
VECMEM_HOST_AND_DEVICE vecmem::data::vector_view< TYPE >::vector_view ( const vector_view< OTHERTYPE > &  parent)

Constructor from a "slightly different" vecmem::details::vector_view object.

Only enabled if the wrapped type is different, but only by const-ness. This complication is necessary to avoid problems from SYCL. Which is very particular about having default copy constructors for the types that it sends to kernels.

Member Function Documentation

◆ operator=()

template<typename TYPE >
template<typename OTHERTYPE , std::enable_if_t< details::is_same_nc< TYPE, OTHERTYPE >::value, bool > = true>
VECMEM_HOST_AND_DEVICE vector_view & vecmem::data::vector_view< TYPE >::operator= ( const vector_view< OTHERTYPE > &  rhs)

Copy from a "slightly different" vecmem::details::vector_view object.

See the copy constructor for more details.

◆ operator==()

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

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: