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

#include <CE_BufferDevice.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 ()
 
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)
 

Protected Member Functions

void initInternal (exint size, bool doalloc=true)
 
const cl::BufferallocBuffer () const
 
void releaseBuffer ()
 

Protected Attributes

cl::Buffer myBuffer
 
exint mySize
 

Friends

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

Detailed Description

template<typename T>
class CE_BufferDevice< T >

Definition at line 18 of file CE_BufferDevice.h.

Member Typedef Documentation

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

Definition at line 22 of file CE_BufferDevice.h.

Constructor & Destructor Documentation

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

Empty buffer constructor.

Definition at line 25 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 28 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 39 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 52 of file CE_BufferDevice.h.

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

Definition at line 61 of file CE_BufferDevice.h.

Member Function Documentation

template<typename T >
const cl::Buffer & CE_BufferDevice< T >::allocBuffer ( ) const
protected

Definition at line 206 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 112 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 225 of file CE_BufferDevice.h.

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

Initialize to given size. NOTE- values are undefined.

Definition at line 149 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 156 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 193 of file CE_BufferDevice.h.

template<typename T >
void CE_BufferDevice< T >::initInternal ( exint  size,
bool  doalloc = true 
)
protected

Definition at line 139 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 107 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 174 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 65 of file CE_BufferDevice.h.

template<typename T >
void CE_BufferDevice< T >::releaseBuffer ( )
protected

Definition at line 216 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 76 of file CE_BufferDevice.h.

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

Returns the buffer length.

Definition at line 104 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 119 of file CE_BufferDevice.h.

Member Data Documentation

template<typename T>
cl::Buffer CE_BufferDevice< T >::myBuffer
mutableprotected

Definition at line 133 of file CE_BufferDevice.h.

template<typename T>
exint CE_BufferDevice< T >::mySize
protected

Definition at line 134 of file CE_BufferDevice.h.


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