Exemplo n.º 1
0
/*-------------------------------------------------------------------------
 * Function:  H5Tget_cset
 *
 * Purpose:  HDF5 is able to distinguish between character sets of
 *    different nationalities and to convert between them to the
 *    extent possible.
 *
 * Return:  Success:  The character set of a string type.
 *
 *    Failure:  H5T_CSET_ERROR (Negative)
 *
 * Programmer:  Robb Matzke
 *    Friday, January   9, 1998
 *
 * Modifications:
 *   Robb Matzke, 22 Dec 1998
 *  Also works for derived data types.
 *
 *-------------------------------------------------------------------------
 */
H5T_cset_t
H5Tget_cset(hid_t type_id)
{
    H5T_t  *dt = NULL;
    H5T_cset_t  ret_value;

    FUNC_ENTER_API(H5Tget_cset, H5T_CSET_ERROR)
    H5TRACE1("Tc","i",type_id);

    /* Check args */
    if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
  HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_CSET_ERROR, "not a data type")
    while (dt->shared->parent && !H5T_IS_STRING(dt->shared))
        dt = dt->shared->parent;  /*defer to parent*/
    if (!H5T_IS_STRING(dt->shared))
  HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_CSET_ERROR, "operation not defined for data type class")

    /* result */
    if(H5T_IS_FIXED_STRING(dt->shared))
        ret_value = dt->shared->u.atomic.u.s.cset;
    else
        ret_value = dt->shared->u.vlen.cset;

done:
    FUNC_LEAVE_API(ret_value)
}
Exemplo n.º 2
0
/*-------------------------------------------------------------------------
 * Function:  H5Iget_file_id
 *
 * Purpose:  The public version of H5I_get_file_id(), obtains the file
 *              ID given an object ID.  User has to close this ID.
 *
 * Return:  Success:  file ID
 *
 *    Failure:  a negative value
 *
 * Programmer:  Raymond Lu
 *              Oct 27, 2003
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
hid_t
H5Iget_file_id(hid_t obj_id)
{
    hid_t    ret_value;

    FUNC_ENTER_API(H5Iget_file_id, FAIL);
    H5TRACE1("i","i",obj_id);

    if((ret_value = H5I_get_file_id(obj_id))<0)
        HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID");

done:
    FUNC_LEAVE_API(ret_value);
}
Exemplo n.º 3
0
/*-------------------------------------------------------------------------
 * Function:  H5Iget_type
 *
 * Purpose:  The public version of H5I_get_type(), obtains a group number
 *    (type) when given an ID.  The ID need not be the ID of an
 *    object which currently exists because the group number is
 *    encoded as part of the ID.
 *
 * Return:  Success:  Group number (type)
 *
 *    Failure:  H5I_BADID, a negative value
 *
 * Programmer:
 *
 * Modifications:
 *    Robb Matzke, 1999-08-23
 *    Also fails if the ID has a valid group but no longer exists
 *    in the ID tables.
 *-------------------------------------------------------------------------
 */
H5I_type_t
H5Iget_type(hid_t id)
{
    H5I_type_t    ret_value = H5I_BADID;

    FUNC_ENTER_API(H5Iget_type, H5I_BADID);
    H5TRACE1("It","i",id);

    ret_value = H5I_get_type(id);

    if (ret_value <= H5I_BADID || ret_value >= H5I_NGROUPS || NULL==H5I_object(id))
  HGOTO_DONE(H5I_BADID);

done:
    FUNC_LEAVE_API(ret_value);
}
Exemplo n.º 4
0
/*-------------------------------------------------------------------------
 * Function:    H5Pset_fapl_windows
 *
 * Purpose: Modify the file access property list to use the H5FD_WINDOWS
 *          driver defined in this source file.  There are no driver
 *          specific properties.
 *
 * NOTE: The Windows VFD was merely a merge of the SEC2 and STDIO drivers
 *       so it has been retired.  Selecting the Windows VFD will actually
 *       set the SEC2 VFD (though for backwards compatibility, we'll keep
 *       the H5FD_WINDOWS symbol).
 *
 *
 * Return:  Non-negative on success/Negative on failure
 *
 * Programmer:  Dana Robinson
 *              October 10, 2011
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5Pset_fapl_windows(hid_t fapl_id)
{
    H5P_genplist_t *plist;      /* Property list pointer */
    herr_t ret_value;

    FUNC_ENTER_API(FAIL)
    H5TRACE1("e", "i", fapl_id);

    if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")

    ret_value = H5P_set_driver(plist, H5FD_WINDOWS, NULL);

done:
    FUNC_LEAVE_API(ret_value)
} /* end H5Pset_fapl_windows() */
Exemplo n.º 5
0
/*-------------------------------------------------------------------------
 * Function:	H5Tget_sign
 *
 * Purpose:	Retrieves the sign type for an integer type.
 *
 * Return:	Success:	The sign type.
 *
 *		Failure:	H5T_SGN_ERROR (Negative)
 *
 * Programmer:	Robb Matzke
 *		Wednesday, January  7, 1998
 *
 * Modifications:
 *	Robb Matzke, 22 Dec 1998
 *	Also works with derived datatypes.
 *-------------------------------------------------------------------------
 */
H5T_sign_t
H5Tget_sign(hid_t type_id)
{
    H5T_t		*dt = NULL;
    H5T_sign_t		ret_value;

    FUNC_ENTER_API(H5T_SGN_ERROR)
    H5TRACE1("Ts", "i", type_id);

    /* Check args */
    if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE)))
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_SGN_ERROR, "not an integer datatype")

    ret_value = H5T_get_sign(dt);

done:
    FUNC_LEAVE_API(ret_value)
}
Exemplo n.º 6
0
/*-------------------------------------------------------------------------
 * Function:  H5Iinc_ref
 *
 * Purpose:  Increments the number of references outstanding for an ID.
 *
 * Return:  Success:  New reference count
 *    Failure:  Negative
 *
 * Programmer:  Quincey Koziol
 *              Dec  7, 2003
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
int
H5Iinc_ref(hid_t id)
{
    int ret_value;                      /* Return value */

    FUNC_ENTER_API(H5Iinc_ref, FAIL);
    H5TRACE1("Is","i",id);

    /* Check arguments */
    if (id<0)
  HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID");

    /* Do actual increment operation */
    if((ret_value = H5I_inc_ref(id))<0)
        HGOTO_ERROR (H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count");

done:
    FUNC_LEAVE_API(ret_value);
} /* end H5Iinc_ref() */
Exemplo n.º 7
0
/*-------------------------------------------------------------------------
 * Function:	H5Ddebug
 *
 * Purpose:	Prints various information about a dataset.  This function is
 *		not to be documented in the API at this time.
 *
 * Return:	Success:	Non-negative
 *
 *		Failure:	Negative
 *
 * Programmer:	Robb Matzke
 *              Wednesday, April 28, 1999
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5Ddebug(hid_t dset_id)
{
    H5D_t	*dset;                  /* Dataset to debug */
    herr_t      ret_value = SUCCEED;    /* Return value */

    FUNC_ENTER_API(FAIL)
    H5TRACE1("e", "i", dset_id);

    /* Check args */
    if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")

    /* Print B-tree information */
    if(H5D_CHUNKED == dset->shared->layout.type)
	(void)H5D__chunk_dump_index(dset, stdout);
    else if(H5D_CONTIGUOUS == dset->shared->layout.type)
	HDfprintf(stdout, "    %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr);

done:
    FUNC_LEAVE_API(ret_value)
} /* end H5Ddebug() */
Exemplo n.º 8
0
/*-------------------------------------------------------------------------
 * Function:	H5Tget_inpad
 *
 * Purpose:	If any internal bits of a floating point type are unused
 *		(that is, those significant bits which are not part of the
 *		sign, exponent, or mantissa) then they will be filled
 *		according to the value of this property.
 *
 * Return:	Success:	The internal padding type.
 *
 *		Failure:	H5T_PAD_ERROR (Negative)
 *
 * Programmer:	Robb Matzke
 *		Friday, January	 9, 1998
 *
 *-------------------------------------------------------------------------
 */
H5T_pad_t
H5Tget_inpad(hid_t type_id)
{
    H5T_t	*dt;            /* Datatype */
    H5T_pad_t	ret_value;      /* Return value */

    FUNC_ENTER_API(H5T_PAD_ERROR)
    H5TRACE1("Tp", "i", type_id);

    /* Check args */
    if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_PAD_ERROR, "not a datatype")
    while(dt->shared->parent)
        dt = dt->shared->parent; /*defer to parent*/
    if(H5T_FLOAT != dt->shared->type)
	HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_PAD_ERROR, "operation not defined for datatype class")

    /* pad */
    ret_value = dt->shared->u.atomic.u.f.pad;

done:
    FUNC_LEAVE_API(ret_value)
} /* end H5Tget_inpad() */
Exemplo n.º 9
0
/*-------------------------------------------------------------------------
 * Function:	H5Tget_ebias
 *
 * Purpose:	Retrieves the exponent bias of a floating-point type.
 *
 * Return:	Success:	The bias
 *
 *		Failure:	0
 *
 * Programmer:	Robb Matzke
 *		Wednesday, January  7, 1998
 *
 *-------------------------------------------------------------------------
 */
size_t
H5Tget_ebias(hid_t type_id)
{
    H5T_t	*dt;                    /* Datatype */
    size_t	ret_value;              /* Return value */

    FUNC_ENTER_API(0)
    H5TRACE1("z", "i", type_id);

    /* Check args */
    if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
    while(dt->shared->parent)
        dt = dt->shared->parent; /*defer to parent*/
    if(H5T_FLOAT != dt->shared->type)
	HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, 0, "operation not defined for datatype class")

    /* bias */
    H5_CHECKED_ASSIGN(ret_value, size_t, dt->shared->u.atomic.u.f.ebias, uint64_t);

done:
    FUNC_LEAVE_API(ret_value)
} /* end H5Tget_ebias() */
Exemplo n.º 10
0
/*-------------------------------------------------------------------------
 * Function:  H5Tget_norm
 *
 * Purpose:  Returns the mantisssa normalization of a floating-point data
 *    type.
 *
 * Return:  Success:  Normalization ID
 *
 *    Failure:  H5T_NORM_ERROR (Negative)
 *
 * Programmer:  Robb Matzke
 *    Wednesday, January  7, 1998
 *
 * Modifications:
 *   Robb Matzke, 22 Dec 1998
 *  Also works with derived datatypes.
 *
 *-------------------------------------------------------------------------
 */
H5T_norm_t
H5Tget_norm(hid_t type_id)
{
    H5T_t  *dt = NULL;
    H5T_norm_t  ret_value;

    FUNC_ENTER_API(H5Tget_norm, H5T_NORM_ERROR)
    H5TRACE1("Tn","i",type_id);

    /* Check args */
    if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
  HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NORM_ERROR, "not a datatype")
    while (dt->shared->parent)
        dt = dt->shared->parent; /*defer to parent*/
    if (H5T_FLOAT != dt->shared->type)
  HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_NORM_ERROR, "operation not defined for datatype class")

    /* norm */
    ret_value = dt->shared->u.atomic.u.f.norm;

done:
    FUNC_LEAVE_API(ret_value)
}
Exemplo n.º 11
0
/*-------------------------------------------------------------------------
 * Function:  H5Tget_ebias
 *
 * Purpose:  Retrieves the exponent bias of a floating-point type.
 *
 * Return:  Success:  The bias
 *
 *    Failure:  0
 *
 * Programmer:  Robb Matzke
 *    Wednesday, January  7, 1998
 *
 * Modifications:
 *  Robb Matzke, 22 Dec 1998
 *  Also works with derived datatypes.
 *-------------------------------------------------------------------------
 */
size_t
H5Tget_ebias(hid_t type_id)
{
    H5T_t  *dt = NULL;
    size_t  ret_value;

    FUNC_ENTER_API(H5Tget_ebias, 0)
    H5TRACE1("z","i",type_id);

    /* Check args */
    if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
  HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
    while (dt->shared->parent)
        dt = dt->shared->parent; /*defer to parent*/
    if (H5T_FLOAT != dt->shared->type)
  HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for datatype class")

    /* bias */
    H5_ASSIGN_OVERFLOW(ret_value,dt->shared->u.atomic.u.f.ebias,uint64_t,size_t);

done:
    FUNC_LEAVE_API(ret_value)
}
Exemplo n.º 12
0
/*-------------------------------------------------------------------------
 * Function:	H5Pget_edc_check
 *
 * Purpose:     Enable or disable error-detecting for a dataset reading
 *              process.  This error-detecting algorithm is whichever
 *              user chooses earlier.  This function cannot control
 *              writing process.
 *
 * Return:	Non-negative on success/Negative on failure
 *
 * Programmer:	Raymond Lu
 *              Jan 3, 2003
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
H5Z_EDC_t
H5Pget_edc_check(hid_t plist_id)
{
    H5P_genplist_t *plist;      /* Property list pointer */
    H5Z_EDC_t      ret_value;   /* return value */

    FUNC_ENTER_API(H5Pget_edc_check, H5Z_ERROR_EDC);
    H5TRACE1("Ze","i",plist_id);

    /* Get the plist structure */
    if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
        HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_ERROR_EDC, "can't find object for ID");

    /* Update property list */
    if (H5P_get(plist,H5D_XFER_EDC_NAME,&ret_value)<0)
        HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5Z_ERROR_EDC, "unable to set value");

    /* check valid value */
    if (ret_value != H5Z_ENABLE_EDC && ret_value != H5Z_DISABLE_EDC)
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_ERROR_EDC, "not a valid value");

done:
    FUNC_LEAVE_API(ret_value);
}
Exemplo n.º 13
0
/*-------------------------------------------------------------------------
 * Function:	H5Pget_preserve
 *
 * Purpose:	The inverse of H5Pset_preserve()
 *
 * Return:	Success:	TRUE or FALSE
 *
 *		Failure:	Negative
 *
 * Programmer:	Robb Matzke
 *              Tuesday, March 17, 1998
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
int
H5Pget_preserve(hid_t plist_id)
{
    H5T_bkg_t need_bkg;         /* Background value */
    H5P_genplist_t *plist;      /* Property list pointer */
    int ret_value;              /* return value */

    FUNC_ENTER_API(H5Pget_preserve, FAIL);
    H5TRACE1("Is","i",plist_id);

    /* Get the plist structure */
    if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
        HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");

    /* Get value */
    if (H5P_get(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0)
        HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");

    /* Set return value */
    ret_value= need_bkg ? TRUE : FALSE;

done:
    FUNC_LEAVE_API(ret_value);
}