xpu
xpu::view< T > Class Template Reference

Public Member Functions

 view ()=default
 
XPU_D view (T *data, size_t size)
 
XPU_D view (buffer< T > &buffer, size_t size)
 
XPU_D T * data () const
 
XPU_D size_t size () const
 
XPU_D bool empty () const
 
XPU_D T & operator[] (size_t idx)
 
XPU_D const T & operator[] (size_t idx) const
 
XPU_D T & at (size_t idx)
 
XPU_D const T & at (size_t idx) const
 

Detailed Description

template<typename T>
class xpu::view< T >

Create a view of a buffer. The view is a pointer to the buffer's data and a size. This class should be used to access a buffer in device code only. To access buffer-data on the host, use 'h_view' instead.

Constructor & Destructor Documentation

◆ view() [1/3]

template<typename T >
xpu::view< T >::view ( )
default

Create an empty view.

◆ view() [2/3]

template<typename T >
XPU_D xpu::view< T >::view ( T *  data,
size_t  size 
)

Create a view from a pointer and a size.

◆ view() [3/3]

template<typename T >
XPU_D xpu::view< T >::view ( buffer< T > &  buffer,
size_t  size 
)

Create a view from a buffer and a size.

Member Function Documentation

◆ at() [1/2]

template<typename T >
XPU_D T& xpu::view< T >::at ( size_t  idx)

◆ at() [2/2]

template<typename T >
XPU_D const T& xpu::view< T >::at ( size_t  idx) const

◆ data()

template<typename T >
XPU_D T* xpu::view< T >::data ( ) const
inline

Return a pointer to the view's data.

◆ empty()

template<typename T >
XPU_D bool xpu::view< T >::empty ( ) const
inline

Check if the view is empty.

◆ operator[]() [1/2]

template<typename T >
XPU_D T& xpu::view< T >::operator[] ( size_t  idx)

◆ operator[]() [2/2]

template<typename T >
XPU_D const T& xpu::view< T >::operator[] ( size_t  idx) const

◆ size()

template<typename T >
XPU_D size_t xpu::view< T >::size ( ) const
inline

Return the view's size.


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