GPUMLib  0.2.2
GPU Machine Learning Library
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
HostArray< Type > Class Template Reference

Create an array of any type, on the host, that automatically manages the memory used to hold its elements. More...

#include <HostArray.h>

Inheritance diagram for HostArray< Type >:
BaseArray< Type >

Public Member Functions

void Dispose ()
 Disposes the array.
 
 HostArray ()
 Constructs an array with no elements.
 
 HostArray (int size)
 
 HostArray (const DeviceArray< Type > &originalArray)
 
 HostArray (const HostArray< Type > &originalArray)
 
 HostArray (HostArray< Type > &&temporaryArray)
 
 ~HostArray ()
 Destructor.
 
HostArray< Type > & operator= (const DeviceArray< Type > &originalArray)
 
HostArray< Type > & operator= (const HostArray< Type > &originalArray)
 
HostArray< Type > & operator= (const HostArray< Type > &&temporaryArray)
 
void TransferOwnerShipFrom (HostArray< Type > &other)
 
Type & operator[] (int element)
 
Type operator[] (int element) const
 
int Length () const
 
Type * Pointer () const
 
int ResizeWithoutPreservingData (int size)
 

Protected Member Functions

void Init ()
 
void MoveFrom (BaseArray< Type > &other)
 

Protected Attributes

Type * arrayData
 
int size
 

Detailed Description

template<class Type>
class GPUMLib::HostArray< Type >

Create an array of any type, on the host, that automatically manages the memory used to hold its elements.

Examples:
BP.cpp, DBNapp.cpp, and MBP.cpp.

Definition at line 40 of file HostArray.h.

Constructor & Destructor Documentation

HostArray ( int  size)
inlineexplicit

Constructs an array with size elements

Parameters
sizenumber of elements of the array

Definition at line 64 of file HostArray.h.

HostArray ( const DeviceArray< Type > &  originalArray)
inline

Constructs an array with the same elements as another array

Parameters
originalArrayoriginal device array from where to copy the elements

Definition at line 70 of file HostArray.h.

HostArray ( const HostArray< Type > &  originalArray)
inline

Constructs an array with the same elements as another array

Parameters
originalArrayoriginal array from where to copy the elements

Definition at line 77 of file HostArray.h.

HostArray ( HostArray< Type > &&  temporaryArray)
inline

Constructs an array using the elements of a temporary array (rvalue)

Parameters
temporaryArraytemporary array containing the elements

Definition at line 84 of file HostArray.h.

Member Function Documentation

int Length ( ) const
inlineinherited

Gets the length of the array. You can use this function to check if the array was effectively allocated.

Returns
the number of elements of the array

Definition at line 63 of file BaseArray.h.

HostArray<Type>& operator= ( const DeviceArray< Type > &  originalArray)
inline

Transforms this array into an array identical to another array

Parameters
originalArrayoriginal device array from where to copy the elements
Returns
a reference to this array

Definition at line 96 of file HostArray.h.

HostArray<Type>& operator= ( const HostArray< Type > &  originalArray)
inline

Transforms this array into an array identical to another array

Parameters
originalArrayoriginal array from where to copy the elements
Returns
a reference to this array

Definition at line 108 of file HostArray.h.

HostArray<Type>& operator= ( const HostArray< Type > &&  temporaryArray)
inline

Replaces the elements of this array by the elements of a temporary array (rvalue)

Parameters
temporaryArraytemporary array containing the elements
Returns
a reference to this array

Definition at line 120 of file HostArray.h.

Type& operator[] ( int  element)
inline

Gets a reference to an element of the array

Parameters
elementposition of the desired element
Returns
a reference to an element desired

Definition at line 145 of file HostArray.h.

Type operator[] ( int  element) const
inline

Gets an element of the array

Parameters
elementposition of the desired element
Returns
the element desired

Definition at line 153 of file HostArray.h.

Type* Pointer ( ) const
inlineinherited

Gets a pointer to the array data

Attention
Use with caution
Returns
a pointer to the array data

Definition at line 70 of file BaseArray.h.

int ResizeWithoutPreservingData ( int  size)
inlineinherited

Resizes the array without preserving its data

Parameters
sizenew size of the array
Returns
the number of elements of the array after being resized.

Definition at line 77 of file BaseArray.h.

void TransferOwnerShipFrom ( HostArray< Type > &  other)
inline

Releases its own resources (elements) and obtains ownership of another array resources. The other array will no longer have any elements. In other words, it moves the elements from one device array to another.

Parameters
otherarray containing the elements to be moved.

Definition at line 133 of file HostArray.h.


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