Point Cloud Library (PCL)  1.9.1-dev
List of all members | Public Types | Public Member Functions
pcl::gpu::DeviceArray< T > Class Template Reference

DeviceArray class More...

#include </__w/1/s/gpu/containers/include/pcl/gpu/containers/device_array.h>

+ Inheritance diagram for pcl::gpu::DeviceArray< T >:

Public Types

enum  { elem_size = sizeof(T) }
 Element size. More...
 
typedef T type
 Element type. More...
 

Public Member Functions

 DeviceArray ()
 Empty constructor. More...
 
 DeviceArray (size_t size)
 Allocates internal buffer in GPU memory. More...
 
 DeviceArray (T *ptr, size_t size)
 Initializes with user allocated buffer. More...
 
 DeviceArray (const DeviceArray &other)
 Copy constructor. More...
 
DeviceArrayoperator= (const DeviceArray &other)
 Assignment operator. More...
 
void create (size_t size)
 Allocates internal buffer in GPU memory. More...
 
void release ()
 Decrements reference counter and releases internal buffer if needed. More...
 
void copyTo (DeviceArray &other) const
 Performs data copying. More...
 
void upload (const T *host_ptr, size_t size)
 Uploads data to internal buffer in GPU memory. More...
 
void download (T *host_ptr) const
 Downloads data from internal buffer to CPU memory. More...
 
template<class A >
void upload (const std::vector< T, A > &data)
 Uploads data to internal buffer in GPU memory. More...
 
template<typename A >
void download (std::vector< T, A > &data) const
 Downloads data from internal buffer to CPU memory. More...
 
void swap (DeviceArray &other_arg)
 Performs swap of data pointed with another device array. More...
 
T * ptr ()
 Returns pointer for internal buffer in GPU memory. More...
 
const T * ptr () const
 Returns const pointer for internal buffer in GPU memory. More...
 
 operator T * ()
 Returns pointer for internal buffer in GPU memory. More...
 
 operator const T * () const
 Returns const pointer for internal buffer in GPU memory. More...
 
size_t size () const
 Returns size in elements. More...
 
- Public Member Functions inherited from pcl::gpu::DeviceMemory
 DeviceMemory ()
 Empty constructor. More...
 
 ~DeviceMemory ()
 Destructor. More...
 
 DeviceMemory (size_t sizeBytes_arg)
 Allocates internal buffer in GPU memory. More...
 
 DeviceMemory (void *ptr_arg, size_t sizeBytes_arg)
 Initializes with user allocated buffer. More...
 
 DeviceMemory (const DeviceMemory &other_arg)
 Copy constructor. More...
 
DeviceMemoryoperator= (const DeviceMemory &other_arg)
 Assignment operator. More...
 
void create (size_t sizeBytes_arg)
 Allocates internal buffer in GPU memory. More...
 
void release ()
 Decrements reference counter and releases internal buffer if needed. More...
 
void copyTo (DeviceMemory &other) const
 Performs data copying. More...
 
void upload (const void *host_ptr_arg, size_t sizeBytes_arg)
 Uploads data to internal buffer in GPU memory. More...
 
void download (void *host_ptr_arg) const
 Downloads data from internal buffer to CPU memory. More...
 
void swap (DeviceMemory &other_arg)
 Performs swap of data pointed with another device memory. More...
 
template<class T >
T * ptr ()
 Returns pointer for internal buffer in GPU memory. More...
 
template<class T >
const T * ptr () const
 Returns constant pointer for internal buffer in GPU memory. More...
 
template<class U >
 operator PtrSz< U > () const
 Conversion to PtrSz for passing to kernel functions. More...
 
bool empty () const
 Returns true if unallocated otherwise false. More...
 
size_t sizeBytes () const
 

Detailed Description

template<class T>
class pcl::gpu::DeviceArray< T >

DeviceArray class

Note
Typed container for GPU memory with reference counting.
Author
Anatoly Baksheev

Definition at line 56 of file device_array.h.

Member Typedef Documentation

template<class T>
typedef T pcl::gpu::DeviceArray< T >::type

Element type.

Definition at line 60 of file device_array.h.

Member Enumeration Documentation

template<class T>
anonymous enum

Element size.

Enumerator
elem_size 

Definition at line 63 of file device_array.h.

Constructor & Destructor Documentation

template<class T >
pcl::gpu::DeviceArray< T >::DeviceArray ( )
inline

Empty constructor.

Definition at line 43 of file device_array.hpp.

template<class T >
pcl::gpu::DeviceArray< T >::DeviceArray ( size_t  size)
inline

Allocates internal buffer in GPU memory.

Parameters
sizenumber of elements to allocate

Definition at line 44 of file device_array.hpp.

template<class T>
pcl::gpu::DeviceArray< T >::DeviceArray ( T *  ptr,
size_t  size 
)
inline

Initializes with user allocated buffer.

Reference counting is disabled in this case.

Parameters
ptrpointer to buffer
sizeelements number

Definition at line 45 of file device_array.hpp.

template<class T>
pcl::gpu::DeviceArray< T >::DeviceArray ( const DeviceArray< T > &  other)
inline

Copy constructor.

Just increments reference counter.

Definition at line 46 of file device_array.hpp.

Member Function Documentation

template<class T >
void pcl::gpu::DeviceArray< T >::copyTo ( DeviceArray< T > &  other) const
inline

Performs data copying.

If destination size differs it will be reallocated.

Parameters
otherdestination container

Definition at line 55 of file device_array.hpp.

References pcl::gpu::DeviceMemory::copyTo().

template<class T >
void pcl::gpu::DeviceArray< T >::create ( size_t  size)
inline

Allocates internal buffer in GPU memory.

If internal buffer was created before the function recreates it with new size. If new and old sizes are equal it does nothing.

Parameters
sizeelements number

Definition at line 50 of file device_array.hpp.

References pcl::gpu::DeviceMemory::create(), and pcl::gpu::DeviceArray< T >::elem_size.

Referenced by pcl::gpu::copyFieldsEx(), pcl::gpu::NeighborIndices::create(), and pcl::gpu::extractEuclideanClusters().

template<class T>
void pcl::gpu::DeviceArray< T >::download ( T *  host_ptr) const
inline

Downloads data from internal buffer to CPU memory.

Parameters
host_ptrpointer to buffer to download

Definition at line 59 of file device_array.hpp.

References pcl::gpu::DeviceMemory::download().

Referenced by pcl::gpu::kinfuLS::StandaloneMarchingCubes< PointT >::convertTrianglesToMesh(), pcl::gpu::DeviceArray< T >::download(), pcl::gpu::extractEuclideanClusters(), and pcl::gpu::extractLabeledEuclideanClusters().

template<class T>
template<class A >
void pcl::gpu::DeviceArray< T >::download ( std::vector< T, A > &  data) const
inline

Downloads data from internal buffer to CPU memory.

Parameters
datahost vector to download to

Definition at line 72 of file device_array.hpp.

References pcl::gpu::DeviceArray< T >::download(), and pcl::gpu::DeviceArray< T >::size().

template<class T >
pcl::gpu::DeviceArray< T >::operator const T * ( ) const
inline

Returns const pointer for internal buffer in GPU memory.

Definition at line 65 of file device_array.hpp.

References pcl::gpu::DeviceArray< T >::ptr().

template<class T >
pcl::gpu::DeviceArray< T >::operator T * ( )
inline

Returns pointer for internal buffer in GPU memory.

Definition at line 64 of file device_array.hpp.

References pcl::gpu::DeviceArray< T >::ptr().

template<class T >
pcl::gpu::DeviceArray< T > & pcl::gpu::DeviceArray< T >::operator= ( const DeviceArray< T > &  other)
inline

Assignment operator.

Just increments reference counter.

Definition at line 47 of file device_array.hpp.

References pcl::gpu::DeviceMemory::operator=().

template<class T >
T * pcl::gpu::DeviceArray< T >::ptr ( )
inline
template<class T >
const T * pcl::gpu::DeviceArray< T >::ptr ( ) const
inline

Returns const pointer for internal buffer in GPU memory.

Definition at line 69 of file device_array.hpp.

template<class T >
void pcl::gpu::DeviceArray< T >::release ( )
inline

Decrements reference counter and releases internal buffer if needed.

Definition at line 52 of file device_array.hpp.

References pcl::gpu::DeviceMemory::release().

template<class T >
size_t pcl::gpu::DeviceArray< T >::size ( ) const
inline
template<class T >
void pcl::gpu::DeviceArray< T >::swap ( DeviceArray< T > &  other_arg)

Performs swap of data pointed with another device array.

Parameters
other_argdevice array to swap with

Definition at line 62 of file device_array.hpp.

References pcl::gpu::DeviceMemory::swap().

template<class T>
void pcl::gpu::DeviceArray< T >::upload ( const T *  host_ptr,
size_t  size 
)
inline

Uploads data to internal buffer in GPU memory.

It calls create() inside to ensure that intenal buffer size is enough.

Parameters
host_ptrpointer to buffer to upload
sizeelements number

Definition at line 57 of file device_array.hpp.

References pcl::gpu::DeviceArray< T >::elem_size, and pcl::gpu::DeviceMemory::upload().

Referenced by pcl::gpu::extractEuclideanClusters(), pcl::gpu::extractLabeledEuclideanClusters(), and pcl::gpu::DeviceArray< T >::upload().

template<class T>
template<class A >
void pcl::gpu::DeviceArray< T >::upload ( const std::vector< T, A > &  data)
inline

Uploads data to internal buffer in GPU memory.

It calls create() inside to ensure that intenal buffer size is enough.

Parameters
datahost vector to upload from

Definition at line 71 of file device_array.hpp.

References pcl::gpu::DeviceArray< T >::upload().


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