summaryrefslogtreecommitdiffstats
path: root/src/H5Rdeprec.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2011-07-18 21:23:02 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2011-07-18 21:23:02 (GMT)
commit304f19d73093427faa319dc04926461d850032a0 (patch)
tree0ebc5fc91522e25fcd9057c2bd931aab3452a6ab /src/H5Rdeprec.c
parentcc0486926f52a25a252f560d35fba7d4cf73f521 (diff)
downloadhdf5-304f19d73093427faa319dc04926461d850032a0.zip
hdf5-304f19d73093427faa319dc04926461d850032a0.tar.gz
hdf5-304f19d73093427faa319dc04926461d850032a0.tar.bz2
[svn-r21117] Issue 2763 - I added a new parameter of object access property list to the function H5Rdereference. It's called H5Rdereference2 now. H5Rdereference function has been deprecated to H5Rdereference1. I also added some test cases in trefer.c.
Tested on jam, heiwa, and koala.
Diffstat (limited to 'src/H5Rdeprec.c')
-rw-r--r--src/H5Rdeprec.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index 0e2acc8..3217062 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -46,7 +46,7 @@
#include "H5Gprivate.h" /* Groups */
#include "H5Oprivate.h" /* Object headers */
#include "H5Rpkg.h" /* References */
-
+#include "H5Ppublic.h" /* for using H5P_DATASET_ACCESS_DEFAULT */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/****************/
@@ -158,5 +158,56 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Rget_obj_type1() */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Rdereference1
+ PURPOSE
+ Opens the HDF5 object referenced.
+ USAGE
+ hid_t H5Rdereference1(ref)
+ hid_t id; IN: Dataset reference object is in or location ID of
+ object that the dataset is located within.
+ H5R_type_t ref_type; IN: Type of reference to create
+ void *ref; IN: Reference to open.
+
+ RETURNS
+ Valid ID on success, Negative on failure
+ DESCRIPTION
+ Given a reference to some object, open that object and return an ID for
+ that object.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+hid_t
+H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref)
+{
+ H5G_loc_t loc; /* Group location */
+ H5F_t *file = NULL; /* File object */
+ hid_t ret_value;
+
+ FUNC_ENTER_API(H5Rdereference1, FAIL)
+
+ /* Check args */
+ if(H5G_loc(obj_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
+ if(_ref == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
+
+ /* Get the file pointer from the entry */
+ file = loc.oloc->file;
+
+ /* Create reference */
+ if((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id, ref_type, _ref, TRUE)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rdereference1() */
+
#endif /* H5_NO_DEPRECATED_SYMBOLS */