Compute Library
 19.08
ICLArray< T > Class Template Referenceabstract

Interface for OpenCL Array. More...

#include <ICLArray.h>

Collaboration diagram for ICLArray< T >:
[legend]

Public Member Functions

 ICLArray (size_t max_num_values)
 Constructor. More...
 
 ICLArray (const ICLArray &)=delete
 Prevent instances of this class from being copy constructed. More...
 
ICLArrayoperator= (const ICLArray &)=delete
 Prevent instances of this class from being copied. More...
 
 ICLArray (ICLArray &&)=default
 Allow instances of this class to be move constructed. More...
 
ICLArrayoperator= (ICLArray &&)=default
 Allow instances of this class to be moved. More...
 
virtual ~ICLArray ()=default
 Default virtual destructor. More...
 
virtual const cl::Buffer & cl_buffer () const =0
 Interface to be implemented by the child class to return a reference to the OpenCL buffer containing the array's data. More...
 
void map (cl::CommandQueue &q, bool blocking=true)
 Enqueue a map operation of the allocated buffer on the given queue. More...
 
void unmap (cl::CommandQueue &q)
 Enqueue an unmap operation of the allocated and mapped buffer on the given queue. More...
 
T * buffer () const override
 Pointer to the first element of the array. More...
 
- Public Member Functions inherited from IArray< T >
 IArray ()
 Default constructor. More...
 
 IArray (size_t max_num_values)
 Constructor: initializes an array which can contain up to max_num_points values. More...
 
size_t max_num_values () const
 Maximum number of values which can be stored in this array. More...
 
virtual ~IArray ()=default
 Default virtual destructor. More...
 
size_t num_values () const
 Number of values currently stored in the array. More...
 
bool push_back (const T &val)
 Append the passed argument to the end of the array if there is room. More...
 
void clear ()
 Clear all the points from the array. More...
 
bool overflow () const
 Did we lose some values because the array is too small? More...
 
virtual T & at (size_t index) const
 Reference to the element of the array located at the given index. More...
 
void resize (size_t num)
 Resizes the array to contain "num" elements. More...
 

Detailed Description

template<class T>
class arm_compute::ICLArray< T >

Interface for OpenCL Array.

Definition at line 35 of file ICLArray.h.

Constructor & Destructor Documentation

◆ ICLArray() [1/3]

ICLArray ( size_t  max_num_values)
inlineexplicit

Constructor.

Parameters
[in]max_num_valuesMaximum size of the array.

Definition at line 43 of file ICLArray.h.

44  : IArray<T>(max_num_values), _mapping(nullptr)
45  {
46  }
size_t max_num_values() const
Maximum number of values which can be stored in this array.
Definition: IArray.h:58

◆ ICLArray() [2/3]

ICLArray ( const ICLArray< T > &  )
delete

Prevent instances of this class from being copy constructed.

◆ ICLArray() [3/3]

ICLArray ( ICLArray< T > &&  )
default

Allow instances of this class to be move constructed.

◆ ~ICLArray()

virtual ~ICLArray ( )
virtualdefault

Default virtual destructor.

Member Function Documentation

◆ buffer()

T* buffer ( ) const
inlineoverridevirtual

Pointer to the first element of the array.

Other elements of the array can be accessed using buffer()[idx] for 0 <= idx < num_poins().

Returns
A pointer to the first element of the array

Implements IArray< T >.

Definition at line 90 of file ICLArray.h.

91  {
92  return reinterpret_cast<T *>(_mapping);
93  }

◆ cl_buffer()

virtual const cl::Buffer& cl_buffer ( ) const
pure virtual

Interface to be implemented by the child class to return a reference to the OpenCL buffer containing the array's data.

Returns
A reference to an OpenCL buffer containing the array's data.

Implemented in CLArray< T >, CLArray< cl_float >, and CLArray< cl_int >.

Referenced by ICLKernel::add_array_argument(), CLHOGDetectorKernel::configure(), CLLKTrackerInitKernel::configure(), CLMinMaxLocationKernel::configure(), CLCopyToArrayKernel::configure(), CLLKTrackerFinalizeKernel::configure(), CLLKTrackerStage0Kernel::configure(), and CLLKTrackerStage1Kernel::configure().

◆ map()

void map ( cl::CommandQueue &  q,
bool  blocking = true 
)
inline

Enqueue a map operation of the allocated buffer on the given queue.

Parameters
[in,out]qThe CL command queue to use for the mapping operation.
[in]blockingIf true, then the mapping will be ready to use by the time this method returns, else it is the caller's responsibility to flush the queue and wait for the mapping operation to have completed before using the returned mapping pointer.
Returns
The mapping address.

Definition at line 72 of file ICLArray.h.

73  {
74  _mapping = do_map(q, blocking);
75  }

Referenced by CLHOGMultiDetection::configure(), CLArray< cl_int >::map(), CLHarrisCorners::run(), and CLHOGMultiDetection::run().

◆ operator=() [1/2]

ICLArray& operator= ( const ICLArray< T > &  )
delete

Prevent instances of this class from being copied.

◆ operator=() [2/2]

ICLArray& operator= ( ICLArray< T > &&  )
default

Allow instances of this class to be moved.

◆ unmap()

void unmap ( cl::CommandQueue &  q)
inline

Enqueue an unmap operation of the allocated and mapped buffer on the given queue.

Note
This method simply enqueues the unmap operation, it is the caller's responsibility to flush the queue and make sure the unmap is finished before the memory is accessed by the device.
Parameters
[in,out]qThe CL command queue to use for the mapping operation.

Definition at line 83 of file ICLArray.h.

84  {
85  do_unmap(q, _mapping);
86  _mapping = nullptr;
87  }

Referenced by CLHOGMultiDetection::configure(), CLHarrisCorners::run(), CLHOGMultiDetection::run(), and CLArray< cl_int >::unmap().


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