![]() |
HDF5
1.13.0
|
Functions | |
hid_t | H5Tcreate (H5T_class_t class, size_t size) |
Creates a new datatype. More... | |
hid_t | H5Tcopy (hid_t obj_id) |
Copies an existing datatype. More... | |
size_t | H5Tget_size (hid_t type_id) |
Returns the size of a datatype. More... | |
herr_t | H5Tset_size (hid_t type_id, size_t size) |
Sets size for a datatype. More... | |
Copies an existing datatype.
H5Tcopy returns H5I_INVALID_HID on fail; we will need to modify return macro to include H5I_INVALID_HID instead of "negative value".
Create an example for H5Tcopy.
[in] | obj_id | identifier; can be a datatype identifier, a predefined datatype, or a dataset identifier. |
H5Tcopy copies an existing datatype. The returned type is always transient and unlocked.
The obj_id
argument can be either a datatype identifier, a predefined datatype (defined in H5Tpublic.h), or a dataset identifier. If obj_id
is a dataset identifier,this function returns a transient, modifiable datatype which is a copy of the dataset's datatype.
The datatype identifier should be released with H5Tclose() or resource leak will occur.
hid_t H5Tcreate | ( | H5T_class_t | class, |
size_t | size | ||
) |
Creates a new datatype.
Original has a reference to “Creating variable-length string datatypes”.
Create an example for H5Tcreate.
[in] | class | Class of datatype to create |
[in] | size | Size, in bytes, of the datatype being created |
H5Tcreate creates a new datatype of the specified class with the specified number of bytes. This function is used only with the following datatype classes:
Other datatypes, including integer and floating-point datatypes, are typically created by using H5Tcopy to copy and modify a predefined datatype.
When creating a variable-length string datatype, size
must be H5T_VARIABLE.
When creating a fixed-length string datatype, size
will be the length of the string in bytes. The length of the string in characters will depend on i the encoding used; see H5Pset_char_encoding().
ENUMs created with this function have a signed native integer base datatype. Use H5Tenum_create if a different integer base datatype is required.
The datatype identifier returned from this function should be released with H5Tclose or resource leaks will result.
size_t H5Tget_size | ( | hid_t | type_id | ) |
Returns the size of a datatype.
Original has a reference to “Creating variable-length string datatypes”.
Create an example for H5Tget_size.
[in] | type_id | Datatype identifier |
H5Tget_size returns the size of a datatype in bytes.
For atomic datatypes, array datatypes, compound datatypes, and other datatypes of a constant size, the returned value is the size of the actual datatype in bytes.
For variable-length string datatypes the returned value is the size of the pointer to the actual string, or sizeof
(char
*
). This function does not return the size of actual variable-length string data.
For variable-length sequence datatypes (see H5Tvlen_create), the returned value is the size of the hvl_t
struct, or sizeof
(hvl_t
). The hvl_t
struct contains a pointer to the actual data and a size value. This function does not return the size of actual variable-length sequence data.
Sets size for a datatype.
Create an example for H5Tset_size().
Original has a reference to “Creating variable-length string datatypes”.
[in] | type_id | Datatype identifier for which the size is being set |
[in] | size | New datatype size is bytes or H5T_VARIABLE |
H5Tset_size() sets the total size in bytes, size
, for a datatype.
The parameter size
must have a positive value, unless it is passed as H5T_VARIABLE and the datatype is a string datatype.
Numeric datatypes: If the datatype is atomic and the size is decreased so that significant bits of the datatype extend beyond the edge of the new size, then the offset property of the datatype is decreased toward zero. If the offset becomes zero and the significant bits of the datatype still hang over the edge of the new size, then the number of significant bits is decreased.
String or character datatypes: The size set for a string datatype should include space for the null-terminator character, otherwise it will not be stored on (or retrieved from) disk. Adjusting the size of a string automatically sets the precision to 8*size
.
Variable-length string datatypes: If dtype_id
is a variable-length string, size must normally be set to H5T_VARIABLE.
Compound datatypes: This function may be used to increase or decrease the size of a compound datatype, but the function will fail if the new size is too small to accommodate all member fields.
Ineligible datatypes: This function cannot be used with enumerated datatypes (H5T_ENUM), array datatypes (H5T_ARRAY), variable-length array datatypes (H5T_VLEN), or reference datatypes (H5T_REFERENCE).