MXAArrayTemplate< T > Class Template Reference

Template class for wrapping raw arrays of data. More...

Inherits IMXAArray.

Inherited by MXA2DArray< T >.

Inheritance diagram for MXAArrayTemplate< T >:

Inheritance graph
[legend]
Collaboration diagram for MXAArrayTemplate< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~MXAArrayTemplate ()
 Destructor.
virtual void takeOwnership ()
 Makes this class responsible for freeing the memory.
virtual void releaseOwnership ()
 This class will NOT free the memory associated with the internal pointer. This can be useful if the user wishes to keep the data around after this class goes out of scope.
virtual void initialize ()
 Initializes this class to zero bytes freeing any data that it currently owns.
virtual void initializeWithZeros ()
 Sets all the values to zero.
virtual int32 resize (uint64 size)
 Reseizes the internal array.
virtual void * getVoidPointer (uint64 i)
 Returns a void pointer pointing to the index of the array. NULL pointers are entirely possible. No checks are performed to make sure the index is with in the range of the internal data array.
virtual T getValue (uint64 i)
 Returns the value for a given index.
virtual uint64 getNumberOfElements ()
 Returns the number of elements in the internal array.
virtual void getDimensions (uint64 *dims)
 Copies the values of the dimensions into the supplied pointer.
virtual int32 getNumberOfDimensions ()
void setValue (uint64 i, T value)
 Sets a specific value in the array.
virtual int32 getDataType ()
 Returns an enumerated type that can be used to find out the type of primitive stored in the internal array. Currently the HDF5 type is returned in order to use this class effectively with HDF5.
virtual size_t getTypeSize ()
 Returns the number of bytes that make up the data type. 1 = char 2 = 16 bit integer 4 = 32 bit integer/Float 8 = 64 bit integer/Double.
virtual void byteSwapElements ()
 Byte swaps the Elements in the array. Needed if you want to convert the endianess of the data.
virtual T * getPointer (uint64 i)
 Returns the pointer to a specific index into the array. No checks are made as to the correctness of the index being passed in. If you ask for an index off then end of the array they you will likely cause your program to abort.
virtual int32 exportToFile (DataExportProperties::Pointer expProps)
 Saves the array to an external file on the system.
int32 _binaryExport (DataExportProperties::Pointer expProps)
int32 _asciiExport (DataExportProperties::Pointer expProps)
virtual void printSelf (std::ostream &os, int32 indent)
 Prints information about the class to ostream.
virtual std::string valueToString (char delimiter= ' ')
 Converts the data array into a string delimited by the supplied delimiter.

Static Public Member Functions

static IMXAArray::Pointer CreateArray (uint64 numElements)
 Static constructor.
static IMXAArray::Pointer CreateMultiDimensionalArray (size_t nDims, const uint64 *dims)
 Creates an IMXAArray::Pointer object for the supplied arguments.
static IMXAArray::Pointer CreateSingleValueArray (T value)
 Creates an Attribute from a single value.
static MXAArrayTemplate< T > * New (uint64 numElements)
 Static construction of MXAArrayTemplate objects. YOU are responsible for cleaning up the memory that this method creates.
static MXAArrayTemplate< T > * New (size_t nDims, const uint64 *dims)
 Creates a MultiDimensional Array allocating the memory immediately.

Protected Member Functions

 MXAArrayTemplate (int32 numElements, bool ownsData=true)
 Protected Constructor.
 MXAArrayTemplate (size_t numDims, const uint64 *dims, bool ownsData=true)
 Constructor used to create an MXAArrayTemplate class that has multiple dimensions.
int32 _allocate ()
 Allocates the memory needed for this class.
virtual T * _resizeAndExtend (uint64 size)
 resizes the internal array to be 'size' elements in length

Private Member Functions

 MXAArrayTemplate (const MXAArrayTemplate &)
void operator= (const MXAArrayTemplate &)

Private Attributes

T * _data
uint64 _nElements
bool _ownsData
std::vector< uint64 > _dims

Detailed Description

template<typename T>
class MXAArrayTemplate< T >

Template class for wrapping raw arrays of data.

Author:
mjackson
Date:
July 3, 2008
Version:
Revision
1.2


Constructor & Destructor Documentation

template<typename T>
virtual MXAArrayTemplate< T >::~MXAArrayTemplate (  )  [inline, virtual]

Destructor.

template<typename T>
MXAArrayTemplate< T >::MXAArrayTemplate ( int32  numElements,
bool  ownsData = true 
) [inline, protected]

Protected Constructor.

Parameters:
numElements The number of elements in the internal array.
takeOwnership Will the class clean up the memory. Default=true

template<typename T>
MXAArrayTemplate< T >::MXAArrayTemplate ( size_t  numDims,
const uint64 *  dims,
bool  ownsData = true 
) [inline, protected]

Constructor used to create an MXAArrayTemplate class that has multiple dimensions.

Parameters:
numDims The number of dimensions to the data set.
dims The actual values of the dimensions.
takeOwnership Will the class clean up the memory. Default=true

template<typename T>
MXAArrayTemplate< T >::MXAArrayTemplate ( const MXAArrayTemplate< T > &   )  [private]


Member Function Documentation

template<typename T>
static IMXAArray::Pointer MXAArrayTemplate< T >::CreateArray ( uint64  numElements  )  [inline, static]

Static constructor.

Parameters:
numElements The number of elements in the internal array.
Returns:
Boost::Shared_Ptr wrapping an instance of MXAArrayTemplateTemplate<T>

template<typename T>
static IMXAArray::Pointer MXAArrayTemplate< T >::CreateMultiDimensionalArray ( size_t  nDims,
const uint64 *  dims 
) [inline, static]

Creates an IMXAArray::Pointer object for the supplied arguments.

Parameters:
nDims Number of dimensions
dims Size of each dimension
Returns:
Boost::Shared_Ptr wrapping an instance of MXAArrayTemplateTemplate<T>

template<typename T>
static IMXAArray::Pointer MXAArrayTemplate< T >::CreateSingleValueArray ( value  )  [inline, static]

Creates an Attribute from a single value.

Parameters:
value The value to store in the attribute
Returns:
Boost::Shared_Ptr wrapping an instance of MXAArrayTemplateTemplate<T>

template<typename T>
static MXAArrayTemplate<T>* MXAArrayTemplate< T >::New ( uint64  numElements  )  [inline, static]

Static construction of MXAArrayTemplate objects. YOU are responsible for cleaning up the memory that this method creates.

Parameters:
numElements The number of elements in the internal array.
Returns:

template<typename T>
static MXAArrayTemplate<T>* MXAArrayTemplate< T >::New ( size_t  nDims,
const uint64 *  dims 
) [inline, static]

Creates a MultiDimensional Array allocating the memory immediately.

Parameters:
nDims The number of dimensions
dims The size of each dimension
Returns:
Pointer to Object or NULL if there was an error creating the object.

template<typename T>
virtual void MXAArrayTemplate< T >::takeOwnership (  )  [inline, virtual]

Makes this class responsible for freeing the memory.

Implements IMXAArray.

template<typename T>
virtual void MXAArrayTemplate< T >::releaseOwnership (  )  [inline, virtual]

This class will NOT free the memory associated with the internal pointer. This can be useful if the user wishes to keep the data around after this class goes out of scope.

Implements IMXAArray.

template<typename T>
virtual void MXAArrayTemplate< T >::initialize (  )  [inline, virtual]

Initializes this class to zero bytes freeing any data that it currently owns.

Reimplemented in MXA2DArray< T >.

template<typename T>
virtual void MXAArrayTemplate< T >::initializeWithZeros (  )  [inline, virtual]

Sets all the values to zero.

Implements IMXAArray.

template<typename T>
virtual int32 MXAArrayTemplate< T >::resize ( uint64  size  )  [inline, virtual]

Reseizes the internal array.

Parameters:
size The new size of the internal array
Returns:
1 on success, 0 on failure

Reimplemented in MXA2DArray< T >, and MXARGBImage.

template<typename T>
virtual void* MXAArrayTemplate< T >::getVoidPointer ( uint64  i  )  [inline, virtual]

Returns a void pointer pointing to the index of the array. NULL pointers are entirely possible. No checks are performed to make sure the index is with in the range of the internal data array.

Parameters:
i The index to have the returned pointer pointing to.
Returns:
Void Pointer. Possibly NULL.

Implements IMXAArray.

template<typename T>
virtual T MXAArrayTemplate< T >::getValue ( uint64  i  )  [inline, virtual]

Returns the value for a given index.

Parameters:
i The index to return the value at
Returns:
The value at index i

template<typename T>
virtual uint64 MXAArrayTemplate< T >::getNumberOfElements (  )  [inline, virtual]

Returns the number of elements in the internal array.

Implements IMXAArray.

template<typename T>
virtual void MXAArrayTemplate< T >::getDimensions ( uint64 *  dims  )  [inline, virtual]

Copies the values of the dimensions into the supplied pointer.

Parameters:
dims Pointer to store the dimension values into

Implements IMXAArray.

Reimplemented in MXA2DArray< T >, and MXARGBImage.

template<typename T>
virtual int32 MXAArrayTemplate< T >::getNumberOfDimensions (  )  [inline, virtual]

Returns the number of dimensions the data has.

Implements IMXAArray.

Reimplemented in MXA2DArray< T >, and MXARGBImage.

template<typename T>
void MXAArrayTemplate< T >::setValue ( uint64  i,
value 
) [inline]

Sets a specific value in the array.

Parameters:
i The index of the value to set
value The new value to be set at the specified index

template<typename T>
virtual int32 MXAArrayTemplate< T >::getDataType (  )  [inline, virtual]

Returns an enumerated type that can be used to find out the type of primitive stored in the internal array. Currently the HDF5 type is returned in order to use this class effectively with HDF5.

Implements IMXAArray.

Reimplemented in MXAAsciiStringData.

template<typename T>
virtual size_t MXAArrayTemplate< T >::getTypeSize (  )  [inline, virtual]

Returns the number of bytes that make up the data type. 1 = char 2 = 16 bit integer 4 = 32 bit integer/Float 8 = 64 bit integer/Double.

Implements IMXAArray.

template<typename T>
virtual void MXAArrayTemplate< T >::byteSwapElements (  )  [inline, virtual]

Byte swaps the Elements in the array. Needed if you want to convert the endianess of the data.

Implements IMXAArray.

template<typename T>
virtual T* MXAArrayTemplate< T >::getPointer ( uint64  i  )  [inline, virtual]

Returns the pointer to a specific index into the array. No checks are made as to the correctness of the index being passed in. If you ask for an index off then end of the array they you will likely cause your program to abort.

Parameters:
i The index to return the pointer to.
Returns:
The pointer to the index

template<typename T>
virtual int32 MXAArrayTemplate< T >::exportToFile ( DataExportProperties::Pointer  expProps  )  [inline, virtual]

Saves the array to an external file on the system.

Parameters:
expProps The properties to use when saving the array
Returns:
Error code.

Implements IMXAArray.

template<typename T>
int32 MXAArrayTemplate< T >::_binaryExport ( DataExportProperties::Pointer  expProps  )  [inline]

template<typename T>
int32 MXAArrayTemplate< T >::_asciiExport ( DataExportProperties::Pointer  expProps  )  [inline]

template<typename T>
virtual void MXAArrayTemplate< T >::printSelf ( std::ostream &  os,
int32  indent 
) [inline, virtual]

Prints information about the class to ostream.

Parameters:
os 
indent 

Implements IMXAArray.

template<typename T>
virtual std::string MXAArrayTemplate< T >::valueToString ( char  delimiter = ' '  )  [inline, virtual]

Converts the data array into a string delimited by the supplied delimiter.

Parameters:
delimiter The delimiter to use between each value. Default is a single space
Returns:
The generated string

Implements IMXAArray.

Reimplemented in MXA2DArray< T >, MXAAsciiStringData, and MXARGBImage.

template<typename T>
int32 MXAArrayTemplate< T >::_allocate (  )  [inline, protected]

Allocates the memory needed for this class.

Returns:
1 on success, -1 on failure

template<typename T>
virtual T* MXAArrayTemplate< T >::_resizeAndExtend ( uint64  size  )  [inline, protected, virtual]

resizes the internal array to be 'size' elements in length

Parameters:
size 
Returns:
Pointer to the internal array

template<typename T>
void MXAArrayTemplate< T >::operator= ( const MXAArrayTemplate< T > &   )  [private]


Member Data Documentation

template<typename T>
T* MXAArrayTemplate< T >::_data [private]

template<typename T>
uint64 MXAArrayTemplate< T >::_nElements [private]

template<typename T>
bool MXAArrayTemplate< T >::_ownsData [private]

template<typename T>
std::vector<uint64> MXAArrayTemplate< T >::_dims [private]


The documentation for this class was generated from the following file:
Generated on Tue Nov 17 18:43:14 2009 for MXADataModel by  doxygen 1.5.2