mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-31 17:10:47 +08:00
[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)
This commit is contained in:
parent
2ce142b6ee
commit
66c44914cc
38
src/H5T.c
38
src/H5T.c
@ -3311,6 +3311,44 @@ H5Tget_member_offset(hid_t type_id, int membno)
|
||||
FUNC_LEAVE(offset);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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
|
||||
|
@ -458,11 +458,6 @@ __DLL__ htri_t H5Tcommitted(hid_t type_id);
|
||||
/* Operations defined on compound data types */
|
||||
__DLL__ herr_t H5Tinsert(hid_t parent_id, const char *name, size_t offset,
|
||||
hid_t member_id);
|
||||
#ifdef QAK
|
||||
__DLL__ herr_t H5Tinsert_array(hid_t parent_id, const char *name,
|
||||
size_t offset, int ndims, const size_t dim[],
|
||||
const int *perm, hid_t member_id);
|
||||
#endif /* QAK */
|
||||
__DLL__ herr_t H5Tpack(hid_t type_id);
|
||||
|
||||
/* Operations defined on enumeration data types */
|
||||
@ -506,10 +501,7 @@ __DLL__ H5T_str_t H5Tget_strpad(hid_t type_id);
|
||||
__DLL__ int H5Tget_nmembers(hid_t type_id);
|
||||
__DLL__ char *H5Tget_member_name(hid_t type_id, int membno);
|
||||
__DLL__ size_t H5Tget_member_offset(hid_t type_id, int membno);
|
||||
#ifdef QAK
|
||||
__DLL__ int H5Tget_member_dims(hid_t type_id, int membno, size_t dims[]/*out*/,
|
||||
int perm[]/*out*/);
|
||||
#endif /* QAK */
|
||||
__DLL__ H5T_class_t H5Tget_member_class(hid_t type_id, int membno);
|
||||
__DLL__ hid_t H5Tget_member_type(hid_t type_id, int membno);
|
||||
__DLL__ herr_t H5Tget_member_value(hid_t type_id, int membno,
|
||||
void *value/*out*/);
|
||||
|
Loading…
x
Reference in New Issue
Block a user