C++ API Reference
|
Auto pointer for cl_kernel objects. More...
#include <MOpenCLAutoPtr.h>
Public Member Functions | |
MAutoCLKernel () | |
Construct a NULL MAutoCLKernel. | |
~MAutoCLKernel () | |
Destructor. | |
MAutoCLKernel (const MAutoCLKernel &other) | |
The copy ctor increments the reference count of the cl_kernel. More... | |
MAutoCLKernel & | operator= (const MAutoCLKernel &other) |
The assignment operator increments the reference count of the cl_kernel. More... | |
MAutoCLKernel (cl_kernel value, NoRef dummy) | |
This ctor does not increment the reference count of value. More... | |
void | attach (cl_kernel value) |
This method causes the "this" object to take over lifetime management for value. More... | |
cl_kernel | detach () |
This method causes the "this" object to stop managing the lifetime of its current cl_kernel. More... | |
void | reset () |
This method causes the "this" object to stop managing the lifetime of its current cl_kernel. More... | |
cl_kernel | get () const |
This method returns the current cl_kernel whose lifetime is being managed by the "this" object. More... | |
bool | isNull () const |
This method checks if the "this" object actually manages a non-null cl_kernel object. More... | |
const cl_kernel * | getReadOnlyRef () const |
This method returns a const pointer to the cl_kernel whose lifetime is being managed by the "this" object. More... | |
cl_kernel * | getReferenceForAssignment () |
This method returns a pointer to the memory appropriate for storing a cl_kernel. More... | |
bool | operator== (const MAutoCLKernel &other) const |
operator equal More... | |
bool | operator== (cl_kernel other) const |
operator equal More... | |
bool | operator! () const |
operator not More... | |
void | swap (MAutoCLKernel &other) |
This method swaps the cl_kernel managed by the "this" object with the cl_kernel managed by the other object. More... | |
bool | operator< (const MAutoCLKernel &other) const |
operator less than More... | |
Auto pointer for cl_kernel objects.
cl_kernel objects in openCL are reference-counted objects. When created, a cl_kernel has a preexisting reference count of 1. An MAutoCLKernel object does not need to increment the reference count when it takes over ownership of a cl_kernel from OpenCL. An MAutoCLKernel object does need to increment the reference count of a cl_kernel object when the cl_kernel is shared between MAutoCLKernel objects.
Always use MAutoCLKernel objects in user code. Only use raw cl_kernel handle when you use the OpenCL API.
Assignment or construction with a raw cl_kernel DOES NOT increment the reference count. Assignment or construction from another MAutoCLKernel DOES increment the reference count.
MAutoCLKernel | ( | const MAutoCLKernel & | other | ) |
The copy ctor increments the reference count of the cl_kernel.
[in] | other | The MAutoCLKernel to be copied. |
MAutoCLKernel | ( | cl_kernel | value, |
NoRef | dummy | ||
) |
This ctor does not increment the reference count of value.
The dummy parameter is included to prevent accidental use the ctor.
[in] | value | The cl_kernel that the "this" object manages of the lifetime of. |
[in] | dummy | A dummy parameter to make this ctor difficult to call by accident. |
MAutoCLKernel & operator= | ( | const MAutoCLKernel & | other | ) |
The assignment operator increments the reference count of the cl_kernel.
[in] | other | The MAutoCLKernel to be assigned to the "this" object. |
void attach | ( | cl_kernel | value | ) |
This method causes the "this" object to take over lifetime management for value.
The reference count of value is not modified by attach(). If "this" object already manages the lifetime of a cl_kernel object, the reference count of the old cl_kernel is decremented.
[in] | value | The cl_kernel the "this" object should manage the lifetime of. |
cl_kernel detach | ( | ) |
This method causes the "this" object to stop managing the lifetime of its current cl_kernel.
The reference count of the cl_kernel is not modified by detach().
void reset | ( | ) |
This method causes the "this" object to stop managing the lifetime of its current cl_kernel.
The reference count of the cl_kernel is decremented.
cl_kernel get | ( | ) | const |
This method returns the current cl_kernel whose lifetime is being managed by the "this" object.
The reference count of the cl_kernel is not modified by get().
bool isNull | ( | ) | const |
This method checks if the "this" object actually manages a non-null cl_kernel object.
const cl_kernel * getReadOnlyRef | ( | ) | const |
This method returns a const pointer to the cl_kernel whose lifetime is being managed by the "this" object.
The reference count of the cl_kernel is not modified.
cl_kernel * getReferenceForAssignment | ( | ) |
This method returns a pointer to the memory appropriate for storing a cl_kernel.
getReferenceForAssignment() decrements the reference count of the cl_kernel before returning, which means it is not safe to dereference the returned value. The "this" object manages the lifetime of the cl_kernel stored in the returned pointer.
bool operator== | ( | const MAutoCLKernel & | other | ) | const |
operator equal
[in] | other | The MAutoCLKernel to compare with the "this" object. |
bool operator== | ( | cl_kernel | other | ) | const |
operator equal
[in] | other | The cl_kernel that compares with the "this" object. |
bool operator! | ( | ) | const |
operator not
void swap | ( | MAutoCLKernel & | other | ) |
This method swaps the cl_kernel managed by the "this" object with the cl_kernel managed by the other object.
swap() does not modify the reference counts of either cl_kernel object.
[in] | other | The MAutoCLKernel to swap cl_kernel's with. |
bool operator< | ( | const MAutoCLKernel & | other | ) | const |
operator less than
[in] | other | the MAutoCLKernel with which the "this" is compared. |