38 #ifndef PCL_GPU_CONTAINER_DEVICE_ARRAY_IMPL_HPP_
39 #define PCL_GPU_CONTAINER_DEVICE_ARRAY_IMPL_HPP_
78 template<
class T>
template<
class A>
inline void DeviceArray<T>::upload(
const std::vector<T, A>& data) { upload(&data[0], data.size()); }
79 template<
class T>
template<
class A>
inline void DeviceArray<T>::download(std::vector<T, A>& data)
const { data.resize(size());
if (!data.empty()) download(&data[0]); }
103 { upload(&data[0], cols * elem_size, data.size()/cols, cols); }
106 { elem_step = cols(); data.resize(cols() * rows());
if (!data.empty()) download(&data[0], colsBytes()); }
std::size_t elem_step() const
Returns step in elements.
int rows() const
Returns number of rows.
DeviceArray2D & operator=(const DeviceArray2D &other)
Assignment operator.
void swap(DeviceArray2D &other_arg)
Performs swap of data pointed with another device array.
void release()
Decrements reference counter and releases internal buffer if needed.
void upload(const void *host_ptr, std::size_t host_step, int rows, int cols)
Uploads data to internal buffer in GPU memory.
int cols() const
Returns number of elements in each row.
void create(int rows, int cols)
Allocates internal buffer in GPU memory.
T * ptr(int y=0)
Returns pointer to given row in internal buffer.
void download(void *host_ptr, std::size_t host_step) const
Downloads data from internal buffer to CPU memory.
DeviceArray2D()
Empty constructor.
void copyTo(DeviceArray2D &other) const
Performs data copying.
DeviceArray()
Empty constructor.
void upload(const T *host_ptr, std::size_t size)
Uploads data to internal buffer in GPU memory.
std::size_t size() const
Returns size in elements.
void copyTo(DeviceArray &other) const
Performs data copying.
void download(T *host_ptr) const
Downloads data from internal buffer to CPU memory.
DeviceArray & operator=(const DeviceArray &other)
Assignment operator.
void swap(DeviceArray &other_arg)
Performs swap of data pointed with another device array.
void release()
Decrements reference counter and releases internal buffer if needed.
void create(std::size_t size)
Allocates internal buffer in GPU memory.
T * ptr()
Returns pointer for internal buffer in GPU memory.
void swap(DeviceMemory2D &other_arg)
Performs swap of data pointed with another device memory.
std::size_t step() const
Returns stride between two consecutive rows in bytes for internal buffer.
void download(void *host_ptr_arg, std::size_t host_step_arg) const
Downloads data from internal buffer to CPU memory.
void create(int rows_arg, int colsBytes_arg)
Allocates internal buffer in GPU memory.
int colsBytes() const
Returns number of bytes in each row.
int rows() const
Returns number of rows.
void upload(const void *host_ptr_arg, std::size_t host_step_arg, int rows_arg, int colsBytes_arg)
Uploads data to internal buffer in GPU memory.
DeviceMemory2D & operator=(const DeviceMemory2D &other_arg)
Assignment operator.
void release()
Decrements reference counter and releases internal buffer if needed.
void copyTo(DeviceMemory2D &other) const
Performs data copying.
void swap(DeviceMemory &other_arg)
Performs swap of data pointed with another device memory.
DeviceMemory & operator=(const DeviceMemory &other_arg)
Assignment operator.
void copyTo(DeviceMemory &other) const
Performs data copying.
void release()
Decrements reference counter and releases internal buffer if needed.
void download(void *host_ptr_arg) const
Downloads data from internal buffer to CPU memory.
void upload(const void *host_ptr_arg, std::size_t sizeBytes_arg)
Uploads data to internal buffer in GPU memory.
void create(std::size_t sizeBytes_arg)
Allocates internal buffer in GPU memory.