summaryrefslogtreecommitdiffstats
path: root/c++/src/H5IdComponent.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2004-05-27 07:54:58 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2004-05-27 07:54:58 (GMT)
commit315ca49e4a04ce8874cac02d1cc4a6b7a45bd57c (patch)
tree2bba19f41db044afddcc261bc7bf800eb8790725 /c++/src/H5IdComponent.cpp
parent23de8877a3025bb2f8751b312dfe5751b8b91074 (diff)
downloadhdf5-315ca49e4a04ce8874cac02d1cc4a6b7a45bd57c.zip
hdf5-315ca49e4a04ce8874cac02d1cc4a6b7a45bd57c.tar.gz
hdf5-315ca49e4a04ce8874cac02d1cc4a6b7a45bd57c.tar.bz2
[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:
Diffstat (limited to 'c++/src/H5IdComponent.cpp')
-rw-r--r--c++/src/H5IdComponent.cpp74
1 files changed, 74 insertions, 0 deletions
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index 3140836..4056dc2 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -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