hl opt">->shared->type != H5T_ARRAY)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype")
/* Retrieve the sizes of the dimensions */
if((ret_value = H5T_get_array_dims(dt, dims)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get dimension sizes")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Tget_array_dims2() */
/*-------------------------------------------------------------------------
* Function: H5T_get_array_dims
*
* Purpose: Private function for H5T_get_array_dims. Query the sizes
* of dimensions for an array datatype.
*
* Return: Success: Number of dimensions of the array type
* Failure: Negative
*
* Programmer: Raymond Lu
* October 10, 2002
*
*-------------------------------------------------------------------------
*/
int
H5T_get_array_dims(const H5T_t *dt, hsize_t dims[])
{
unsigned u; /* Local index variable */
int ret_value; /* return value */
FUNC_ENTER_NOAPI(H5T_get_array_dims, FAIL)
HDassert(dt);
HDassert(dt->shared->type == H5T_ARRAY);
/* Retrieve the sizes of the dimensions */
if(dims)
for(u = 0; u < dt->shared->u.array.ndims; u++)
dims[u] = dt->shared->u.array.dim[u];
/* Pass along the array rank as the return value */
ret_value = dt->shared->u.array.ndims;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_get_array_dims */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
* Function: H5Tarray_create1
*
* Purpose: Create a new array datatype based on the specified BASE_TYPE.
* The type is an array with NDIMS dimensionality and the size of the
* array is DIMS. The total member size should be relatively small.
* Array datatypes are currently limited to H5S_MAX_RANK number of
* dimensions and must have the number of dimensions set greater than
* 0. (i.e. 0 > ndims <= H5S_MAX_RANK) All dimensions sizes must be greater
* than 0 also.
*
* Return: Success: ID of new array datatype
* Failure: Negative
*
* Programmer: Quincey Koziol
* Thursday, Oct 26, 2000
*
*-------------------------------------------------------------------------
*/
hid_t
H5Tarray_create1(hid_t base_id, int ndims, const hsize_t dim[/* ndims */],
const int UNUSED perm[/* ndims */])
{
H5T_t *base; /* base datatype */
H5T_t *dt = NULL; /* new array datatype */
unsigned u; /* local index variable */
hid_t ret_value; /* return value */
FUNC_ENTER_API(H5Tarray_create1, FAIL)
H5TRACE4("i", "iIs*h*Is", base_id, ndims, dim, perm);
/* Check args */
if(ndims < 1 || ndims > H5S_MAX_RANK)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dimensionality")
if(!dim)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified")
for(u = 0; u < (unsigned)ndims; u++)
if(!(dim[u] > 0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero-sized dimension specified")
if(NULL == (base = (H5T_t *)H5I_object_verify(base_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
/* Create the array datatype */
if(NULL == (dt = H5T_array_create(base, (unsigned)ndims, dim)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to create datatype")
/* Atomize the type */
if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype")
done:
if(ret_value < 0) {
if(dt && H5T_close(dt) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "can't release datatype")
} /* end if */
FUNC_LEAVE_API(ret_value)
} /* end H5Tarray_create1() */
/*-------------------------------------------------------------------------
* Function: H5Tget_array_dims1
*
* Purpose: Query the sizes of dimensions for an array datatype.
*
* Return: Success: Number of dimensions of the array type
* Failure: Negative
*
* Programmer: Quincey Koziol
* Monday, November 6, 2000
*
*-------------------------------------------------------------------------
*/
int
H5Tget_array_dims1(hid_t type_id, hsize_t dims[], int UNUSED perm[])
{
H5T_t *dt; /* Array datatype to query */
int ret_value; /* return value */
FUNC_ENTER_API(H5Tget_array_dims1, FAIL)
H5TRACE3("Is", "i*h*Is", type_id, dims, perm);
/* Check args */
if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object")
if(dt->shared->type != H5T_ARRAY)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype")
/* Retrieve the sizes of the dimensions */
if((ret_value = H5T_get_array_dims(dt, dims)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get dimension sizes")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Tget_array_dims1() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|