halapi
hierarchichalalignmentformatapi
Public Member Functions | Protected Member Functions | Protected Attributes
hal::HDF5ExternalArray Class Reference

#include <hdf5ExternalArray.h>

List of all members.

Public Member Functions

 HDF5ExternalArray ()
virtual ~HDF5ExternalArray ()
void create (H5::CommonFG *file, const H5std_string &path, const H5::DataType &dataType, hsize_t numElements, const H5::DSetCreatPropList &cparms=H5::DSetCreatPropList::DEFAULT)
void load (H5::CommonFG *file, const H5std_string &path, hsize_t chunksInBuffer=1)
void write ()
const char * get (hsize_t i)
char * getUpdate (hsize_t i)
template<typename T >
getValue (hsize_t index, hsize_t offset) const
template<typename T >
void setValue (hsize_t index, hsize_t offset, T value)
hsize_t getSize () const
const H5::DataType & getDataType () const

Protected Member Functions

void page (hsize_t i)

Protected Attributes

H5::CommonFG * _file
H5std_string _path
H5::DataType _dataType
H5::DataSpace _dataSpace
H5::DataSet _dataSet
hsize_t _size
hsize_t _chunkSize
hsize_t _dataSize
hsize_t _bufStart
hsize_t _bufEnd
hsize_t _bufSize
char * _buf
H5::DataSpace _chunkSpace
bool _dirty

Detailed Description

Wrapper for a 1-dimensional HDF5 array of fixed length. Array objects are defined (and typed) by the input datatype. The array is paged into memory chunk-by-chunk as needed (using the HDF5 cache as a back-end). We can't use compiler tpying of the input objects (and instead just expose the raw void* data) because the elements' sizes are not known at compile time, and we don't want to move it around once its read.


Constructor & Destructor Documentation

HDF5ExternalArray::HDF5ExternalArray ( )

Constructor

HDF5ExternalArray::~HDF5ExternalArray ( ) [virtual]

Destructor


Member Function Documentation

void HDF5ExternalArray::create ( H5::CommonFG *  file,
const H5std_string &  path,
const H5::DataType &  dataType,
hsize_t  numElements,
const H5::DSetCreatPropList &  cparms = H5::DSetCreatPropList::DEFAULT 
)

Create a new dataset in specifed location

Parameters:
filePointer to the HDF5 parent in which to create array
pathPath within the file for the new array
dataTypeHDF5 Datatype describing contents of array
numElementsFixed length of the new array
cparmsHDF5 options (ie chunking and compression etc)
const char * hal::HDF5ExternalArray::get ( hsize_t  i) [inline]

Access the raw data at given index

Parameters:
iindex of element to retrieve for reading
const H5::DataType & hal::HDF5ExternalArray::getDataType ( ) const [inline]

Get the HDF5 Datatype

hsize_t hal::HDF5ExternalArray::getSize ( ) const [inline]

Write typed element in the the raw data index

Parameters:
offsetOFfset of element in struct (number of bytes) Number of elements in array
char * hal::HDF5ExternalArray::getUpdate ( hsize_t  i) [inline]

Write the raw data at given index

Parameters:
iindex of element to retrieve for updating
template<typename T >
T hal::HDF5ExternalArray::getValue ( hsize_t  index,
hsize_t  offset 
) const [inline]

Access typed value within element in a raw data array

Parameters:
indexIndex of element (struct) in the array
offsetOffset of value within struct (number of bytes)
void HDF5ExternalArray::load ( H5::CommonFG *  file,
const H5std_string &  path,
hsize_t  chunksInBuffer = 1 
)

Load an existing dataset into memory

Parameters:
filePointer to the HDF5 file in which to create array
pathPath within the file for the new array
chunksInBufferHDF5 options (ie chunking and compression etc) 0: load entire array into buffer 1: use default chunking (from dataset) N: buffersize will be N chunks.
void HDF5ExternalArray::page ( hsize_t  i) [protected]

Read chunk from file

template<typename T >
void hal::HDF5ExternalArray::setValue ( hsize_t  index,
hsize_t  offset,
value 
) [inline]

Write typed value within element in raw data array

Parameters:
indexIndex of element (struct) in the array
offsetOffset of value within struct (number of bytes)
valueNew value to set
void HDF5ExternalArray::write ( )

Write the memory buffer back to the file


Member Data Documentation

char* hal::HDF5ExternalArray::_buf [protected]

In-memory buffer

hsize_t hal::HDF5ExternalArray::_bufEnd [protected]

Index of last element in memory buffer

hsize_t hal::HDF5ExternalArray::_bufSize [protected]

Number of elements in memory buffer

hsize_t hal::HDF5ExternalArray::_bufStart [protected]

Index of first element in memory buffer

Size of chunk in elements

H5::DataSpace hal::HDF5ExternalArray::_chunkSpace [protected]

Dimensional information for in-memory buffer

H5::DataSet hal::HDF5ExternalArray::_dataSet [protected]

The HDF5 array object

hsize_t hal::HDF5ExternalArray::_dataSize [protected]

Size of datatype in bytes

H5::DataSpace hal::HDF5ExternalArray::_dataSpace [protected]

Dataspace (dimension information) of array

H5::DataType hal::HDF5ExternalArray::_dataType [protected]

Datatype for array

Flag saying we should write to disk on write or page-out calls (set by getUpdate())

H5::CommonFG* hal::HDF5ExternalArray::_file [protected]

Pointer to file that owns this dataset

H5std_string hal::HDF5ExternalArray::_path [protected]

Path of dataset in file

hsize_t hal::HDF5ExternalArray::_size [protected]

Number of elements in the array (fixed length)


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Friends