summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2000-11-09 23:00:19 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2000-11-09 23:00:19 (GMT)
commit66c44914cc582da845571768161302b1b18b26bd (patch)
treeb973e68f44787edf1beb210cb9b5ad304475bc98 /src/H5T.c
parent2ce142b6eeee804f927f3a3e21531c68dbb4309f (diff)
downloadhdf5-66c44914cc582da845571768161302b1b18b26bd.zip
hdf5-66c44914cc582da845571768161302b1b18b26bd.tar.gz
hdf5-66c44914cc582da845571768161302b1b18b26bd.tar.bz2
[svn-r2850] Purpose:
Added new function. Description: It's often convenient to query the class of a compound datatype's member to determine if it's an array and the previous way required you to open the member type to query it's class. Solution: Added new H5Tget_member_class function to directly ask for the member type's class. Platforms tested: FreeBSD 4.1.1 (hawkwind)
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/H5T.c b/src/H5T.c
index 10b0521..2b8d35f 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -3313,6 +3313,44 @@ H5Tget_member_offset(hid_t type_id, int membno)
/*-------------------------------------------------------------------------
+ * Function: H5Tget_member_class
+ *
+ * Purpose: Returns the datatype class of a member of a compound datatype.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: H5T_NO_CLASS
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, November 9, 2000
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+H5T_class_t
+H5Tget_member_class(hid_t type_id, int membno)
+{
+ H5T_t *dt = NULL;
+ H5T_class_t ret_value = H5T_NO_CLASS;
+
+ FUNC_ENTER(H5Tget_member_class, H5T_NO_CLASS);
+
+ /* Check args */
+ if (H5I_DATATYPE != H5I_get_type(type_id) ||
+ NULL == (dt = H5I_object(type_id)) || H5T_COMPOUND != dt->type)
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a compound data type");
+ if (membno < 0 || membno >= dt->u.compnd.nmembs)
+ HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, H5T_NO_CLASS, "invalid member number");
+
+ /* Value */
+ ret_value = dt->u.compnd.memb[membno].type->type;
+
+ FUNC_LEAVE(ret_value);
+} /* end H5Tget_member_class() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Tget_member_type
*
* Purpose: Returns the data type of the specified member. The caller