[svn-r8588] Purpose:

Add C++ wrappers - incrementally check-in

Description
    Added wrapper for these C APIs:
        H5Rcreate
        H5Rget_obj_type
        H5Rget_region

    This is an incremental check-in to preserve the code, corresponding
    tests will follow in a few weeks.

Platforms:
    Linux 2.4 (eirene)
    I'm checking the code out and test on arabica too.

Misc. update:
This commit is contained in:
Binh-Minh Ribler
2004-05-27 02:54:58 -05:00
parent 23de8877a3
commit 315ca49e4a
10 changed files with 433 additions and 70 deletions

View File

@@ -155,6 +155,80 @@ IdComponent::~IdComponent() {
*/
}
//
// Implementation for HDF5 Reference Interface
//
//--------------------------------------------------------------------------
// Function: IdComponent::p_reference (protected)
// Purpose Creates a reference to an HDF5 object or a dataset region.
// Parameters
// name - IN: Name of the object to be referenced
// dataspace - IN: Dataspace with selection
// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION
// Return A reference
// Exception H5::IdComponentException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void* IdComponent::p_reference(const char* name, hid_t space_id, H5R_type_t ref_type) const
{
void *ref;
herr_t ret_value = H5Rcreate(ref, id, name, ref_type, space_id);
if (ret_value < 0)
{
throw IdComponentException("IdComponent::p_reference",
"H5Rcreate failed");
}
return(ref);
}
//--------------------------------------------------------------------------
// Function: IdComponent::p_get_obj_type (protected)
// Purpose Retrieves the type of object that an object reference points to.
// Parameters
// ref - IN: Reference to query
// ref_type - IN: Type of reference to query
// Return An object type, which can be one of the following:
// H5G_LINK Object is a symbolic link.
// H5G_GROUP Object is a group.
// H5G_DATASET Object is a dataset.
// H5G_TYPE Object is a named datatype
// Exception H5::IdComponentException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
H5G_obj_t IdComponent::p_get_obj_type(void *ref, H5R_type_t ref_type) const
{
H5G_obj_t obj_type = H5Rget_obj_type(id, ref_type, ref);
if (obj_type == H5G_UNKNOWN)
{
throw IdComponentException("IdComponent::p_get_obj_type",
"H5R_get_obj_type failed");
}
return(obj_type);
}
//--------------------------------------------------------------------------
// Function: IdComponent::p_get_region (protected)
// Purpose Retrieves a dataspace with the region pointed to selected.
// Parameters
// ref_type - IN: Type of reference to get region of - default
// to H5R_DATASET_REGION
// ref - IN: Reference to get region of
// Return Dataspace id
// Exception H5::IdComponentException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
hid_t IdComponent::p_get_region(void *ref, H5R_type_t ref_type) const
{
hid_t space_id = H5Rget_region(id, ref_type, ref);
if (space_id < 0)
{
throw IdComponentException("IdComponent::p_get_region",
"H5Rget_region failed");
}
return(space_id);
}
#ifndef H5_NO_NAMESPACE
}
#endif