go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
itk::OpenCLMemoryObject Class Reference

#include <itkOpenCLMemoryObject.h>

Detailed Description

The OpenCLMemoryObject class represents all common memory objects such as buffers and image objects.

See also
OpenCLContext

Definition at line 38 of file itkOpenCLMemoryObject.h.

+ Inheritance diagram for itk::OpenCLMemoryObject:

Public Types

enum  Access { ReadWrite = 0x0001 , WriteOnly = 0x0002 , ReadOnly = 0x0004 }
 
typedef Point< std::vcl_size_t, 2 > PointType
 
typedef Size< 4 > RectangleType
 
typedef OpenCLMemoryObject Self
 
typedef Size< 2 > SizeType
 

Public Member Functions

OpenCLMemoryObject::Access GetAccess () const
 
OpenCLContextGetContext () const
 
cl_mem_flags GetFlags () const
 
void * GetHostPointer () const
 
cl_uint GetMapCount () const
 
cl_mem GetMemoryId () const
 
cl_mem_object_type GetMemoryType () const
 
cl_uint GetReferenceCount () const
 
std::vcl_size_t GetSize () const
 
bool IsNull () const
 
cl_int SetDestructorCallback (void(CL_CALLBACK *pfn_notify)(cl_mem, void *), void *user_data=nullptr)
 
void Unmap (void *ptr, const bool wait=false)
 
OpenCLEvent UnmapAsync (void *ptr, const OpenCLEventList &event_list=OpenCLEventList())
 

Protected Member Functions

cl_map_flags GetMapFlags (const OpenCLMemoryObject::Access access)
 
 OpenCLMemoryObject (OpenCLContext *context, const cl_mem id)
 
 OpenCLMemoryObject (OpenCLContext *context=0)
 
void SetId (OpenCLContext *context, const cl_mem id)
 
 ~OpenCLMemoryObject ()
 

Private Member Functions

 OpenCLMemoryObject (const Self &other)
 
const Selfoperator= (const Self &)
 

Private Attributes

OpenCLContextm_Context
 
cl_mem m_Id
 

Member Typedef Documentation

◆ PointType

typedef Point< std::vcl_size_t, 2 > itk::OpenCLMemoryObject::PointType

Definition at line 63 of file itkOpenCLMemoryObject.h.

◆ RectangleType

Definition at line 62 of file itkOpenCLMemoryObject.h.

◆ Self

Standard class typedefs.

Definition at line 61 of file itkOpenCLMemoryObject.h.

◆ SizeType

Definition at line 64 of file itkOpenCLMemoryObject.h.

Member Enumeration Documentation

◆ Access

Enumerator
ReadWrite 
WriteOnly 
ReadOnly 

Definition at line 83 of file itkOpenCLMemoryObject.h.

Constructor & Destructor Documentation

◆ OpenCLMemoryObject() [1/3]

itk::OpenCLMemoryObject::OpenCLMemoryObject ( OpenCLContext context = 0)
inlineprotected

Constructs a null OpenCL memory object and associates it with context.

Definition at line 43 of file itkOpenCLMemoryObject.h.

◆ OpenCLMemoryObject() [2/3]

itk::OpenCLMemoryObject::OpenCLMemoryObject ( OpenCLContext context,
const cl_mem  id 
)
inlineprotected

Constructs an OpenCL memory object from the native identifier id, and associates it with context. This class takes over ownership of id and will release it in the destructor.

Definition at line 48 of file itkOpenCLMemoryObject.h.

◆ ~OpenCLMemoryObject()

itk::OpenCLMemoryObject::~OpenCLMemoryObject ( )
protected

Destructor for OpenCL memory object. After the memory object reference count becomes zero and commands queued for execution on a command-queue(s) that use memory object have finished, the memory object is deleted. If memory object is a buffer object, memory object cannot be deleted until all sub-buffer objects associated with memory object are deleted.

◆ OpenCLMemoryObject() [3/3]

itk::OpenCLMemoryObject::OpenCLMemoryObject ( const Self other)
private

Member Function Documentation

◆ GetAccess()

OpenCLMemoryObject::Access itk::OpenCLMemoryObject::GetAccess ( ) const

Returns the access mode that was used to create this memory object.

◆ GetContext()

OpenCLContext * itk::OpenCLMemoryObject::GetContext ( ) const
inline

Returns the OpenCL context that created this memory object.

Definition at line 96 of file itkOpenCLMemoryObject.h.

◆ GetFlags()

cl_mem_flags itk::OpenCLMemoryObject::GetFlags ( ) const

Returns the access flags that were used to create this memory object.

◆ GetHostPointer()

void * itk::OpenCLMemoryObject::GetHostPointer ( ) const

Return the host pointer argument value specified when memory object is created. Otherwise a NULL value is returned.

◆ GetMapCount()

cl_uint itk::OpenCLMemoryObject::GetMapCount ( ) const

Returns map count. The map count returned should be considered immediately stale. It is unsuitable for general use in applications. This feature is provided for debugging.

◆ GetMapFlags()

cl_map_flags itk::OpenCLMemoryObject::GetMapFlags ( const OpenCLMemoryObject::Access  access)
protected

Helper function to get cl_map_flags from access.

◆ GetMemoryId()

cl_mem itk::OpenCLMemoryObject::GetMemoryId ( ) const
inline

Returns the native OpenCL identifier for this memory object.

Definition at line 93 of file itkOpenCLMemoryObject.h.

◆ GetMemoryType()

cl_mem_object_type itk::OpenCLMemoryObject::GetMemoryType ( ) const

Returns the memory object type used to create this object.

◆ GetReferenceCount()

cl_uint itk::OpenCLMemoryObject::GetReferenceCount ( ) const

Returns memory object reference count. The reference count returned should be considered immediately stale. It is unsuitable for general use in applications. This feature is provided for identifying memory leaks.

◆ GetSize()

std::vcl_size_t itk::OpenCLMemoryObject::GetSize ( ) const

Returns actual size of the data store associated with memory object in bytes.

◆ IsNull()

bool itk::OpenCLMemoryObject::IsNull ( ) const
inline

Returns true if this OpenCL memory object is null, false otherwise.

Definition at line 90 of file itkOpenCLMemoryObject.h.

◆ operator=()

const Self & itk::OpenCLMemoryObject::operator= ( const Self )
private

◆ SetDestructorCallback()

cl_int itk::OpenCLMemoryObject::SetDestructorCallback ( void(CL_CALLBACK *pfn_notify)(cl_mem, void *)  ,
void *  user_data = nullptr 
)

Registers a user callback function with a memory object. Each call to {clSetMemObjectDestructorCallback} registers the specified user callback function on a callback stack associated with memobj. The registered user callback functions are called in the reverse order in which they were registered. The user callback functions are called and then the memory objects resources are freed and the memory object is deleted. This provides a mechanism for the application (and libraries) using memobj to be notified when the memory referenced by host_ptr, specified when the memory object is created and used as the storage bits for the memory object, can be reused or freed.

◆ SetId()

void itk::OpenCLMemoryObject::SetId ( OpenCLContext context,
const cl_mem  id 
)
protected

Helper function to pass cl_mem id.

◆ Unmap()

void itk::OpenCLMemoryObject::Unmap ( void *  ptr,
const bool  wait = false 
)

Requests a command to unmap a previously mapped region at ptr of a memory object. This function will wait until the request has finished if the wait is true. The request is executed on the active command queue for context.

See also
UnmapAsync(), OpenCLBuffer::Map()

◆ UnmapAsync()

OpenCLEvent itk::OpenCLMemoryObject::UnmapAsync ( void *  ptr,
const OpenCLEventList event_list = OpenCLEventList() 
)

Requests a command to unmap a previously mapped region at ptr of a memory object. The request will be started after all events in event_list are finished. Returns an event object that can be used to wait for the request to finish. The request is executed on the active command queue for context().

See also
Unmap(), OpenCLBuffer::MapAsync()

Field Documentation

◆ m_Context

OpenCLContext* itk::OpenCLMemoryObject::m_Context
private

Definition at line 161 of file itkOpenCLMemoryObject.h.

◆ m_Id

cl_mem itk::OpenCLMemoryObject::m_Id
private

Definition at line 162 of file itkOpenCLMemoryObject.h.



Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo