summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/H5R.c32
-rw-r--r--src/H5Rdeprec.c53
-rw-r--r--src/H5Rpkg.h2
-rw-r--r--src/H5Rpublic.h3
-rw-r--r--src/H5vers.txt1
-rw-r--r--src/H5version.h19
6 files changed, 94 insertions, 16 deletions
diff --git a/src/H5R.c b/src/H5R.c
index 2d2766d..e2d6bf3 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -38,8 +38,6 @@
/* Static functions */
static herr_t H5R_create(void *ref, H5G_loc_t *loc, const char *name,
H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id);
-static hid_t H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
- const void *_ref, hbool_t app_ref);
static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref);
static ssize_t H5R_get_name(H5F_t *file, hid_t lapl_id, hid_t dxpl_id, hid_t id,
H5R_type_t ref_type, const void *_ref, char *name, size_t size);
@@ -361,9 +359,13 @@ done:
Currently only set up to work with references to datasets
EXAMPLES
REVISION LOG
+ Raymond Lu
+ 13 July 2011
+ I added the OAPL_ID parameter for the object being referenced. It only
+ supports dataset access property list currently.
--------------------------------------------------------------------------*/
-static hid_t
-H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, hbool_t app_ref)
+hid_t
+H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, hbool_t app_ref)
{
H5O_loc_t oloc; /* Object location */
H5G_name_t path; /* Path of object */
@@ -462,11 +464,10 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re
case H5O_TYPE_DATASET:
{
- hid_t dapl_id = H5P_DATASET_ACCESS_DEFAULT; /* dapl to use to open dataset */
H5D_t *dset; /* Pointer to dataset to open */
/* Open the dataset */
- if(NULL == (dset = H5D_open(&loc, dapl_id, dxpl_id)))
+ if(NULL == (dset = H5D_open(&loc, oapl_id, dxpl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found")
/* Create an atom for the dataset */
@@ -488,11 +489,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5Rdereference
+ H5Rdereference2
PURPOSE
Opens the HDF5 object referenced.
USAGE
- hid_t H5Rdereference(ref)
+ hid_t H5Rdereference2(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
@@ -507,19 +508,22 @@ done:
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
+ Raymond Lu
+ 13 July 2011
+ I added the OAPL_ID parameter for the object being referenced. It only
+ supports dataset access property list currently.
--------------------------------------------------------------------------*/
hid_t
-H5Rdereference(hid_t id, H5R_type_t ref_type, const void *_ref)
+H5Rdereference2(hid_t obj_id, hid_t oapl_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(H5Rdereference, FAIL)
- H5TRACE3("i", "iRt*x", id, ref_type, _ref);
+ FUNC_ENTER_API(H5Rdereference2, FAIL)
/* Check args */
- if(H5G_loc(id, &loc) < 0)
+ 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")
@@ -530,12 +534,12 @@ H5Rdereference(hid_t id, H5R_type_t ref_type, const void *_ref)
file = loc.oloc->file;
/* Create reference */
- if((ret_value = H5R_dereference(file, H5AC_dxpl_id, ref_type, _ref, TRUE)) < 0)
+ if((ret_value = H5R_dereference(file, oapl_id, 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 H5Rdereference() */
+} /* end H5Rdereference2() */
/*--------------------------------------------------------------------------
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 */
diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h
index 82382fb..8c66a90 100644
--- a/src/H5Rpkg.h
+++ b/src/H5Rpkg.h
@@ -57,6 +57,8 @@
H5_DLL herr_t H5R_init(void);
H5_DLL herr_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
const void *_ref, H5O_type_t *obj_type);
+H5_DLL hid_t H5R_dereference(H5F_t *file, hid_t dapl_id, hid_t dxpl_id, H5R_type_t ref_type,
+ const void *_ref, hbool_t app_ref);
#endif /* _H5Rpkg_H */
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index 04d319b..997309f 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -60,7 +60,7 @@ extern "C" {
/* Functions in H5R.c */
H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name,
H5R_type_t ref_type, hid_t space_id);
-H5_DLL hid_t H5Rdereference(hid_t dataset, H5R_type_t ref_type, const void *ref);
+H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref);
H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *_ref,
H5O_type_t *obj_type);
@@ -81,6 +81,7 @@ H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref,
/* Function prototypes */
H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *_ref);
+H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5vers.txt b/src/H5vers.txt
index 89f7bc6..07d2c4b 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -62,6 +62,7 @@ FUNCTION: H5Pget_filter; ; v10, v18
FUNCTION: H5Pget_filter_by_id; ; v16, v18
FUNCTION: H5Pinsert; ; v14, v18
FUNCTION: H5Pregister; ; v14, v18
+FUNCTION: H5Rdereference; ; v10, v110
FUNCTION: H5Rget_obj_type; ; v16, v18
FUNCTION: H5Tarray_create; ; v14, v18
FUNCTION: H5Tcommit; ; v10, v18
diff --git a/src/H5version.h b/src/H5version.h
index a885b0f..14d6c30 100644
--- a/src/H5version.h
+++ b/src/H5version.h
@@ -111,6 +111,10 @@
#define H5Pregister_vers 1
#endif /* !defined(H5Pregister_vers) */
+#if !defined(H5Rdereference_vers)
+#define H5Rdereference_vers 1
+#endif /* !defined(H5Rdereference_vers) */
+
#if !defined(H5Rget_obj_type_vers)
#define H5Rget_obj_type_vers 1
#endif /* !defined(H5Rget_obj_type_vers) */
@@ -219,6 +223,10 @@
#define H5Pregister_vers 2
#endif /* !defined(H5Pregister_vers) */
+#if !defined(H5Rdereference_vers)
+#define H5Rdereference_vers 1
+#endif /* !defined(H5Rdereference_vers) */
+
#if !defined(H5Rget_obj_type_vers)
#define H5Rget_obj_type_vers 2
#endif /* !defined(H5Rget_obj_type_vers) */
@@ -459,6 +467,17 @@
#error "H5Pregister_vers set to invalid value"
#endif /* H5Pregister_vers */
+#if !defined(H5Rdereference_vers) || H5Rdereference_vers == 2
+#ifndef H5Rdereference_vers
+#define H5Rdereference_vers 2
+#endif /* H5Rdereference_vers */
+#define H5Rdereference H5Rdereference2
+#elif H5Rdereference_vers == 1
+#define H5Rdereference H5Rdereference1
+#else /* H5Rdereference_vers */
+#error "H5Rdereference_vers set to invalid value"
+#endif /* H5Rdereference_vers */
+
#if !defined(H5Rget_obj_type_vers) || H5Rget_obj_type_vers == 2
#ifndef H5Rget_obj_type_vers
#define H5Rget_obj_type_vers 2