H5Utilities Class Reference

General Utilities for working with the HDF5 data files and API. More...

List of all members.

Public Types

enum  CustomHDFDataTypes {
  MXA_GROUP = 1, MXA_DATASET = 2, MXA_TYPE = 4, MXA_LINK = 8,
  MXA_ANY = 15
}

Public Member Functions

virtual ~H5Utilities ()

Static Public Member Functions

static MXA_EXPORT hid_t openFile (const std::string &filename, bool readOnly=false)
static MXA_EXPORT hid_t createFile (const std::string &filename)
static MXA_EXPORT herr_t closeFile (hid_t &fileId)
static MXA_EXPORT std::string getObjectPath (hid_t objId, bool trim=false)
 Retuirns the path to an object.
static MXA_EXPORT herr_t getObjectType (hid_t objId, const std::string &objName, int32 *objType)
 Returns the hdf object type.
static MXA_EXPORT herr_t objectNameAtIndex (hid_t fileId, int32 idx, std::string &name)
 Retrieves the object name for a given index.
static MXA_EXPORT bool isGroup (hid_t objId, const std::string &objName)
 Returns if a given hdf5 object is a group.
static MXA_EXPORT hid_t openHDF5Object (hid_t locId, const std::string &objectPath)
 Opens an HDF5 object for hdf5 operations.
static MXA_EXPORT herr_t closeHDF5Object (hid_t locId)
 Closes the object id.
static MXA_EXPORT std::string HDFClassTypeAsStr (hid_t class_type)
static MXA_EXPORT void printHDFClassType (H5T_class_t classT)
 prints the class type of the given class
static MXA_EXPORT herr_t getGroupObjects (hid_t loc_id, int32 typeFilter, std::list< std::string > &names)
 Returns a list of child hdf5 objects for a given object id.
static MXA_EXPORT hid_t createGroup (hid_t loc_id, const std::string &group)
 Creates a HDF Group by checking if the group already exists. If the group already exists then that group is returned otherwise a new group is created.
static MXA_EXPORT herr_t createGroupsFromPath (const std::string &pathToCheck, hid_t parent)
 Given a path relative to the Parent ID, this method will create all the intermediate groups if necessary.
static MXA_EXPORT herr_t createGroupsForDataset (const std::string &datasetPath, hid_t parent)
 Given a path relative to the Parent ID, this method will create all the intermediate groups if necessary.
static MXA_EXPORT std::string extractObjectName (const std::string &path)
 Extracts the object name from a given path.
static MXA_EXPORT bool probeForAttribute (hid_t loc_id, const std::string &obj_name, const std::string &attr_name)
 Looks for an attribute with a given name.
static MXA_EXPORT herr_t getAllAttributeNames (hid_t objId, std::list< std::string > &names)
 Returns a list of all the attribute names.
static MXA_EXPORT herr_t getAllAttributeNames (hid_t objId, const std::string &obj_name, std::list< std::string > &names)
 Returns a list of all the attribute names.
static MXA_EXPORT herr_t readAllAttributes (hid_t fileId, const std::string &datasetPath, MXAAbstractAttributes &attributes)
 Returns a vector of IAttributes, one for each attribute of a given hdf5 object.
template<typename T>
static IMXAArray::Pointer readH5Data (hid_t locId, const std::string &datasetPath, const std::vector< uint64 > &dims)
 Reads data into an IMXAArray::Pointer.
template<typename T>
static IMXAArray::Pointer readH5Attribute (hid_t locId, const std::string &datasetPath, const std::string &key, const std::vector< uint64 > &dims)
 Reads data from an Attribute into an IAttributePtr.

Protected Member Functions

 H5Utilities ()

Private Member Functions

 H5Utilities (const H5Utilities &)
void operator= (const H5Utilities &)


Detailed Description

General Utilities for working with the HDF5 data files and API.

Author:
Mike Jackson/Shawn Nicholson
Date:
March 2007
Version:
Revision
1.2


Member Enumeration Documentation

enum H5Utilities::CustomHDFDataTypes

Enumerator:
MXA_GROUP 
MXA_DATASET 
MXA_TYPE 
MXA_LINK 
MXA_ANY 


Constructor & Destructor Documentation

virtual H5Utilities::~H5Utilities (  )  [virtual]

H5Utilities::H5Utilities (  )  [inline, protected]

H5Utilities::H5Utilities ( const H5Utilities  )  [private]


Member Function Documentation

hid_t H5Utilities::openFile ( const std::string &  filename,
bool  readOnly = false 
) [static]

hid_t H5Utilities::createFile ( const std::string &  filename  )  [static]

herr_t H5Utilities::closeFile ( hid_t &  fileId  )  [static]

std::string H5Utilities::getObjectPath ( hid_t  objId,
bool  trim = false 
) [static]

Retuirns the path to an object.

Parameters:
objId The HDF5 id of the object
trim set to False to trim the path
Returns:
The path to the object relative to the objId

herr_t H5Utilities::getObjectType ( hid_t  objId,
const std::string &  objName,
int32 *  objType 
) [static]

Returns the hdf object type.

Parameters:
objId The hdf5 object id
objName The path to the data set
objType The type of the object
Returns:
Negative value on error

herr_t H5Utilities::objectNameAtIndex ( hid_t  fileId,
int32  idx,
std::string &  name 
) [static]

Retrieves the object name for a given index.

Parameters:
fileId The hdf5 object id
idx The index to retrieve the name for
name The variable to store the name
Returns:
Negative value is error

bool H5Utilities::isGroup ( hid_t  objId,
const std::string &  objName 
) [static]

Returns if a given hdf5 object is a group.

Parameters:
objId The hdf5 object that contains an object with name objName
objName The name of the object to check
Returns:
True if the given hdf5 object id is a group

hid_t H5Utilities::openHDF5Object ( hid_t  locId,
const std::string &  objectPath 
) [static]

Opens an HDF5 object for hdf5 operations.

Parameters:
locId the Object id of the parent
objectPath The path of the object to open
Returns:
The hdf5 id of the opened object. Negative value is error.

herr_t H5Utilities::closeHDF5Object ( hid_t  locId  )  [static]

Closes the object id.

Parameters:
locId The object id to close
Returns:
Negative value is error.

std::string H5Utilities::HDFClassTypeAsStr ( hid_t  class_type  )  [static]

void H5Utilities::printHDFClassType ( H5T_class_t  classT  )  [static]

prints the class type of the given class

Parameters:
classT The Class Type to print

herr_t H5Utilities::getGroupObjects ( hid_t  loc_id,
int32  typeFilter,
std::list< std::string > &  names 
) [static]

Returns a list of child hdf5 objects for a given object id.

Parameters:
loc_id The parent hdf5 id
typeFilter A filter to apply to the list
names Variable to store the list
Returns:

hid_t H5Utilities::createGroup ( hid_t  loc_id,
const std::string &  group 
) [static]

Creates a HDF Group by checking if the group already exists. If the group already exists then that group is returned otherwise a new group is created.

Parameters:
loc_id The HDF unique id given to files or groups
group The name of the group to create. Note that this group name should not be any sort of 'path'. It should be a single group.

int32 H5Utilities::createGroupsFromPath ( const std::string &  pathToCheck,
hid_t  parent 
) [static]

Given a path relative to the Parent ID, this method will create all the intermediate groups if necessary.

Parameters:
pathToCheck The path to either create or ensure exists.
parent The HDF unique id for the parent
Returns:
Error Condition: Negative is error. Positive is success.

int32 H5Utilities::createGroupsForDataset ( const std::string &  datasetPath,
hid_t  parent 
) [static]

Given a path relative to the Parent ID, this method will create all the intermediate groups if necessary.

Parameters:
datasetPath The path to the dataset that you want to make all the intermediate groups for
parent The HDF unique id for the parent
Returns:
Error Condition: Negative is error. Positive is success.

std::string H5Utilities::extractObjectName ( const std::string &  path  )  [static]

Extracts the object name from a given path.

Parameters:
path The path which to extract the object name
Returns:
The name of the object

bool H5Utilities::probeForAttribute ( hid_t  loc_id,
const std::string &  obj_name,
const std::string &  attr_name 
) [static]

Looks for an attribute with a given name.

Parameters:
loc_id The objects Parent id
obj_name The name of the object
attr_name The attribute to look for (by name)
Returns:
True if the attribute exists.

herr_t H5Utilities::getAllAttributeNames ( hid_t  objId,
std::list< std::string > &  names 
) [static]

Returns a list of all the attribute names.

Parameters:
objId The parent object
names Variable to hold the list of attribute names
Returns:
Negate value is error

herr_t H5Utilities::getAllAttributeNames ( hid_t  objId,
const std::string &  obj_name,
std::list< std::string > &  names 
) [static]

Returns a list of all the attribute names.

Parameters:
objId The parent object
obj_name The name of the object whose attribute names you want a list
names Variable to hold the list of attribute names
Returns:
Negative value is error

herr_t H5Utilities::readAllAttributes ( hid_t  fileId,
const std::string &  datasetPath,
MXAAbstractAttributes attributes 
) [static]

Returns a vector of IAttributes, one for each attribute of a given hdf5 object.

Parameters:
fileId The parent hdf5 id
datasetPath The path to the hdf5 object whose attributes you want
attributes Variable to store the attributes
Returns:
Negative value on error

template<typename T>
static IMXAArray::Pointer H5Utilities::readH5Data ( hid_t  locId,
const std::string &  datasetPath,
const std::vector< uint64 > &  dims 
) [inline, static]

Reads data into an IMXAArray::Pointer.

Parameters:
locId The hdf5 object id of the parent
datasetPath The path to the data set containing the attributes you want
dims The dimensions of the attribute
Returns:
Boost shared pointer to the data

template<typename T>
static IMXAArray::Pointer H5Utilities::readH5Attribute ( hid_t  locId,
const std::string &  datasetPath,
const std::string &  key,
const std::vector< uint64 > &  dims 
) [inline, static]

Reads data from an Attribute into an IAttributePtr.

Parameters:
locId The hdf5 object id of the parent
datasetPath The path to the data set containing the attributes you want
key The name of the attribute to read
dims The dimensions of the attribute
Returns:
Boost shared pointer to the attribute

void H5Utilities::operator= ( const H5Utilities  )  [private]


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