summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-30 21:57:50 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-30 21:57:50 (GMT)
commitc136b81140106231e471b334bc5248611cec04e6 (patch)
tree0037e64ba84267eac89e0fcd4db0bd5cf6161ff5 /src
parentf85474466864d1a8b675387b623bebd89bbdc57e (diff)
downloadhdf5-c136b81140106231e471b334bc5248611cec04e6.zip
hdf5-c136b81140106231e471b334bc5248611cec04e6.tar.gz
hdf5-c136b81140106231e471b334bc5248611cec04e6.tar.bz2
[svn-r14223] Description:
Change existing H5Gget_info -> H5Gget_info_by_name and add new version of H5Gget_info, with simpler parameters, to better match new API routines. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'src')
-rw-r--r--src/H5G.c50
-rw-r--r--src/H5Gpublic.h5
2 files changed, 50 insertions, 5 deletions
diff --git a/src/H5G.c b/src/H5G.c
index 872d145..1b74695 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -483,7 +483,51 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Gget_info(hid_t loc_id, const char *name, H5G_info_t *grp_info, hid_t lapl_id)
+H5Gget_info(hid_t grp_id, H5G_info_t *grp_info)
+{
+ H5I_type_t id_type; /* Type of ID */
+ H5G_loc_t loc; /* Location of group */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Gget_info, FAIL)
+ H5TRACE2("e", "i*x", grp_id, grp_info);
+
+ /* Check args */
+ id_type = H5I_get_type(grp_id);
+ if(!(H5I_GROUP == id_type || H5I_FILE == id_type))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
+ if(!grp_info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+
+ /* Get group location */
+ if(H5G_loc(grp_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ /* Retrieve the group's information */
+ if(H5G_obj_info(loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Gget_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Gget_info_by_name
+ *
+ * Purpose: Retrieve information about a group.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * November 27 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info,
+ hid_t lapl_id)
{
H5G_loc_t loc; /* Location of group */
H5G_loc_t grp_loc; /* Location used to open group */
@@ -492,7 +536,7 @@ H5Gget_info(hid_t loc_id, const char *name, H5G_info_t *grp_info, hid_t lapl_id)
hbool_t loc_found = FALSE; /* Location at 'name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Gget_info, FAIL)
+ FUNC_ENTER_API(H5Gget_info_by_name, FAIL)
H5TRACE4("e", "i*s*xi", loc_id, name, grp_info, lapl_id);
/* Check args */
@@ -527,7 +571,7 @@ done:
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
FUNC_LEAVE_API(ret_value)
-} /* end H5Gget_info() */
+} /* end H5Gget_info_by_name() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 6162be3..e818e72 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -56,7 +56,7 @@ typedef enum H5G_storage_type_t {
H5G_STORAGE_TYPE_DENSE /* Links are stored in fractal heap & indexed with v2 B-tree */
} H5G_storage_type_t;
-/* Information struct for group (for H5Gget_info/H5Gget_info_by_idx) */
+/* Information struct for group (for H5Gget_info/H5Gget_info_by_name/H5Gget_info_by_idx) */
typedef struct H5G_info_t {
H5G_storage_type_t storage_type; /* Type of storage for links in group */
hsize_t nlinks; /* Number of links in group */
@@ -76,7 +76,8 @@ H5_DLL hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id,
H5_DLL hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id);
H5_DLL hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id);
H5_DLL hid_t H5Gget_create_plist(hid_t group_id);
-H5_DLL herr_t H5Gget_info(hid_t loc_id, const char *name, H5G_info_t *ginfo,
+H5_DLL herr_t H5Gget_info(hid_t loc_id, H5G_info_t *ginfo);
+H5_DLL herr_t H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *ginfo,
hid_t lapl_id);
H5_DLL herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *ginfo,