HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CE_BufferDevice< T > Class Template Reference

#include <CE_ArrayView.h>

+ Inheritance diagram for CE_BufferDevice< T >:

Public Types

typedef T value_type
 

Public Member Functions

 CE_BufferDevice ()
 Empty buffer constructor. More...
 
 CE_BufferDevice (exint size)
 Allocated an uninitialized buffer of specified size (if > 0). More...
 
 CE_BufferDevice (cl::Buffer &&buf, exint size=-1)
 
 CE_BufferDevice (const CE_BufferDevice< T > &b)=delete
 No copy constructor. More...
 
 CE_BufferDevice (CE_BufferDevice< T > &&b) noexcept
 
 ~CE_BufferDevice ()
 
template<typename V >
CE_ArrayView< V > arrayView ()
 
template<typename V >
const CE_ArrayView< V > arrayView () const
 
cl::Buffer release ()
 
void reset (cl::Buffer &&buf, exint size=-1)
 
void init (exint size)
 
void initFromArray (const UT_Array< T > &src, exint len=-1, bool block=true)
 Initialize from a UT_Array. If len >= 0, only len elements are copied. More...
 
void matchAndCopyToArray (UT_Array< T > &dst, exint len=-1, bool block=true) const
 
void initFromData (const T *data, exint nelem, bool block=true)
 Initialize from raw data block of T elements of length nelem. More...
 
exint size () const
 Returns the buffer length. More...
 
bool isEmpty () const
 Returns true iff there are no occupied elements in the buffer. More...
 
const cl::Bufferbuffer () const
 
void copyFrom (const CE_BufferDevice< T > &b, exint len=-1)
 

Friends

void swap (CE_BufferDevice< T > &a, CE_BufferDevice< T > &b)
 

Detailed Description

template<typename T>
class CE_BufferDevice< T >

Definition at line 24 of file CE_ArrayView.h.

Member Typedef Documentation

template<typename T>
typedef T CE_BufferDevice< T >::value_type

Definition at line 25 of file CE_BufferDevice.h.

Constructor & Destructor Documentation

template<typename T>
CE_BufferDevice< T >::CE_BufferDevice ( )
inline

Empty buffer constructor.

Definition at line 28 of file CE_BufferDevice.h.

template<typename T>
CE_BufferDevice< T >::CE_BufferDevice ( exint  size)
inline

Allocated an uninitialized buffer of specified size (if > 0).

Definition at line 31 of file CE_BufferDevice.h.

template<typename T>
CE_BufferDevice< T >::CE_BufferDevice ( cl::Buffer &&  buf,
exint  size = -1 
)
inline

Initialize from a raw cl::Buffer, which this object now owns. If size is not provided, calc from the buffer size and type. The input cl::Buffer is empty after this call.

Definition at line 42 of file CE_BufferDevice.h.

template<typename T>
CE_BufferDevice< T >::CE_BufferDevice ( const CE_BufferDevice< T > &  b)
delete

No copy constructor.

template<typename T>
CE_BufferDevice< T >::CE_BufferDevice ( CE_BufferDevice< T > &&  b)
inlinenoexcept

Definition at line 63 of file CE_BufferDevice.h.

template<typename T>
CE_BufferDevice< T >::~CE_BufferDevice ( )
inline

Definition at line 72 of file CE_BufferDevice.h.

Member Function Documentation

template<typename T>
template<typename V >
CE_ArrayView<V> CE_BufferDevice< T >::arrayView ( )
inline

Definition at line 78 of file CE_BufferDevice.h.

template<typename T>
template<typename V >
const CE_ArrayView<V> CE_BufferDevice< T >::arrayView ( ) const
inline

Definition at line 94 of file CE_BufferDevice.h.

template<typename T>
const cl::Buffer& CE_BufferDevice< T >::buffer ( ) const
inline

Returns the underlying OpenCL buffer. Note: This is meant for directly passing to OpenCL functions. holding ownership over long times.

Definition at line 156 of file CE_BufferDevice.h.

template<typename T>
void CE_BufferDevice< T >::copyFrom ( const CE_BufferDevice< T > &  b,
exint  len = -1 
)

Copy from the input buffer. If len >= 0, only len elements are copied. NOTE: This object must already be initialized to a buffer of sufficient size.

Definition at line 272 of file CE_BufferDevice.h.

template<typename T >
SYS_FORCE_INLINE void CE_BufferDevice< T >::init ( exint  size)

Initialize to given size. NOTE- values are undefined.

Definition at line 196 of file CE_BufferDevice.h.

template<typename T>
void CE_BufferDevice< T >::initFromArray ( const UT_Array< T > &  src,
exint  len = -1,
bool  block = true 
)

Initialize from a UT_Array. If len >= 0, only len elements are copied.

Definition at line 203 of file CE_BufferDevice.h.

template<typename T>
void CE_BufferDevice< T >::initFromData ( const T data,
exint  nelem,
bool  block = true 
)

Initialize from raw data block of T elements of length nelem.

Definition at line 240 of file CE_BufferDevice.h.

template<typename T>
bool CE_BufferDevice< T >::isEmpty ( ) const
inline

Returns true iff there are no occupied elements in the buffer.

Definition at line 151 of file CE_BufferDevice.h.

template<typename T>
void CE_BufferDevice< T >::matchAndCopyToArray ( UT_Array< T > &  dst,
exint  len = -1,
bool  block = true 
) const

Resize the provided UT_Array to fit and copy this vector's data there. If len >= 0 then only len elements are copied.

Definition at line 221 of file CE_BufferDevice.h.

template<typename T>
cl::Buffer CE_BufferDevice< T >::release ( )
inline

Release and return the underlying buffer without deleting, after which this object is empty (similar to unique_ptr).

Definition at line 101 of file CE_BufferDevice.h.

template<typename T>
void CE_BufferDevice< T >::reset ( cl::Buffer &&  buf,
exint  size = -1 
)
inline

Reset to own the provided raw cl::Buffer. If size is not provided, calc from the buffer size and type. The input cl::Buffer is empty after this call.

Definition at line 112 of file CE_BufferDevice.h.

template<typename T>
exint CE_BufferDevice< T >::size ( ) const
inline

Returns the buffer length.

Definition at line 148 of file CE_BufferDevice.h.

Friends And Related Function Documentation

template<typename T>
void swap ( CE_BufferDevice< T > &  a,
CE_BufferDevice< T > &  b 
)
friend

Definition at line 163 of file CE_BufferDevice.h.


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