OpenCL C++ Bindings
cl::Memory Class Reference

Class interface for cl_mem. More...

#include <opencl.hpp>

Inheritance diagram for cl::Memory:
cl::detail::Wrapper< cl_mem > cl::Buffer cl::Image cl::Pipe cl::BufferGL cl::BufferRenderGL cl::Image1D cl::Image1DArray cl::Image1DBuffer cl::Image2D cl::Image2DArray cl::Image3D cl::ImageGL

Public Member Functions

 Memory ()
 Default constructor - initializes to NULL. More...
 
 Memory (const cl_mem &memory, bool retainObject)
 Constructor from cl_mem - takes ownership. More...
 
Memoryoperator= (const cl_mem &rhs)
 Assignment operator from cl_mem - takes ownership. More...
 
 Memory (const Memory &mem)
 Copy constructor to forward copy to the superclass correctly. Required for MSVC. More...
 
Memoryoperator= (const Memory &mem)
 Copy assignment to forward copy to the superclass correctly. Required for MSVC. More...
 
 Memory (Memory &&mem) CL_HPP_NOEXCEPT_
 Move constructor to forward move to the superclass correctly. Required for MSVC. More...
 
Memoryoperator= (Memory &&mem)
 Move assignment to forward move to the superclass correctly. Required for MSVC. More...
 
template<typename T >
cl_int getInfo (cl_mem_info name, T *param) const
 Wrapper for clGetMemObjectInfo(). More...
 
template<cl_mem_info name>
detail::param_traits< detail::cl_mem_info, name >::param_type getInfo (cl_int *err=NULL) const
 Wrapper for clGetMemObjectInfo() that returns by value. More...
 
cl_int setDestructorCallback (void(CL_CALLBACK *pfn_notify)(cl_mem, void *), void *user_data=NULL)
 Registers a callback function to be called when the memory object is no longer needed. More...
 
- Public Member Functions inherited from cl::detail::Wrapper< cl_mem >
 Wrapper (const cl_type &obj, bool retainObject)
 
 Wrapper (const Wrapper< cl_type > &rhs)
 
 Wrapper (Wrapper< cl_type > &&rhs) CL_HPP_NOEXCEPT_
 
Wrapper< cl_type > & operator= (const Wrapper< cl_type > &rhs)
 
Wrapper< cl_type > & operator= (Wrapper< cl_type > &&rhs)
 
Wrapper< cl_type > & operator= (const cl_type &rhs)
 
const cl_type & operator() () const
 
cl_type & operator() ()
 
cl_type get () const
 

Additional Inherited Members

- Public Types inherited from cl::detail::Wrapper< cl_mem >
typedef cl_mem cl_type
 
- Protected Member Functions inherited from cl::detail::Wrapper< cl_mem >
cl_int retain () const
 
cl_int release () const
 
- Protected Attributes inherited from cl::detail::Wrapper< cl_mem >
cl_type object_
 

Detailed Description

Class interface for cl_mem.

Note
Copies of these objects are shallow, meaning that the copy will refer to the same underlying cl_mem as the original. For details, see clRetainMemObject() and clReleaseMemObject().
See also
cl_mem

Definition at line 3433 of file opencl.hpp.

Constructor & Destructor Documentation

◆ Memory() [1/4]

cl::Memory::Memory ( )
inline

Default constructor - initializes to NULL.

Definition at line 3437 of file opencl.hpp.

◆ Memory() [2/4]

cl::Memory::Memory ( const cl_mem &  memory,
bool  retainObject 
)
inlineexplicit

Constructor from cl_mem - takes ownership.

Optionally transfer ownership of a refcount on the cl_mem into the new Memory object.

Parameters
retainObjectwill cause the constructor to retain its cl object. Defaults to false to maintain compatibility with earlier versions.

See Memory for further details.

Definition at line 3450 of file opencl.hpp.

◆ Memory() [3/4]

cl::Memory::Memory ( const Memory mem)
inline

Copy constructor to forward copy to the superclass correctly. Required for MSVC.

Definition at line 3467 of file opencl.hpp.

◆ Memory() [4/4]

cl::Memory::Memory ( Memory &&  mem)
inline

Move constructor to forward move to the superclass correctly. Required for MSVC.

Definition at line 3481 of file opencl.hpp.

Member Function Documentation

◆ getInfo() [1/2]

template<cl_mem_info name>
detail::param_traits< detail::cl_mem_info, name >::param_type cl::Memory::getInfo ( cl_int *  err = NULL) const
inline

Wrapper for clGetMemObjectInfo() that returns by value.

Definition at line 3505 of file opencl.hpp.

◆ getInfo() [2/2]

template<typename T >
cl_int cl::Memory::getInfo ( cl_mem_info  name,
T *  param 
) const
inline

Wrapper for clGetMemObjectInfo().

Definition at line 3495 of file opencl.hpp.

◆ operator=() [1/3]

Memory & cl::Memory::operator= ( const cl_mem &  rhs)
inline

Assignment operator from cl_mem - takes ownership.

This effectively transfers ownership of a refcount on the rhs and calls clReleaseMemObject() on the value previously held by this instance.

Definition at line 3458 of file opencl.hpp.

◆ operator=() [2/3]

Memory & cl::Memory::operator= ( const Memory mem)
inline

Copy assignment to forward copy to the superclass correctly. Required for MSVC.

Definition at line 3472 of file opencl.hpp.

◆ operator=() [3/3]

Memory & cl::Memory::operator= ( Memory &&  mem)
inline

Move assignment to forward move to the superclass correctly. Required for MSVC.

Definition at line 3486 of file opencl.hpp.

◆ setDestructorCallback()

cl_int cl::Memory::setDestructorCallback ( void(CL_CALLBACK *pfn_notify)(cl_mem, void *)  ,
void *  user_data = NULL 
)
inline

Registers a callback function to be called when the memory object is no longer needed.

Wraps clSetMemObjectDestructorCallback().

Repeated calls to this function, for a given cl_mem value, will append to the list of functions called (in reverse order) when memory object's resources are freed and the memory object is deleted.

Note
The registered callbacks are associated with the underlying cl_mem value - not the Memory class instance.

Definition at line 3530 of file opencl.hpp.


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