6.7.11SHOW ENDIANNESS
Syntax
SHOW ENDIANNESS [DATASET | ATTRIBUTE] [file_name] object_name [BY NAME]
[post_processing_option]
[output_redirecting_option]
Description
Show (i.e. get) the endianness of an HDF5 dataset or attribute or of its members named object_name. In case a dataset and an attribute with identical names (object_name) are stored in the same location (i.e. group) and neither the keyword DATASET nor ATTRIBUTE is specified, the endianness returned belongs to the dataset. To explicitly get the endianness of object_name according to its type, the keyword DATASET or ATTRIBUTE must be specified. If object_name ends with “/” and is of data type HDFQL_COMPOUND, the endiannesses of members of object_name are returned instead.
Parameter(s)
file_name – optional string that specifies the name of the HDF5 file storing the dataset or attribute whose endianness is to be obtained. If file_name is specified, the file is opened on the fly, the endianness of the dataset or attribute is obtained, and the file is subsequently closed. If not specified, the file currently in use is used instead.
object_name – mandatory string that specifies the name of the HDF5 dataset or attribute whose endianness is to be obtained, or the endiannesses of its members if the name ends with “/” and the dataset or attribute is of data type HDFQL_COMPOUND.
post_processing_option – optional option that transforms the result set according to the programmer’s needs, such as ordering or truncating (please refer to the section PROCESSING for additional information).
output_redirecting_option – optional option that specifies the cursor in use, an HDF5 object (i.e. dataset or attribute), a (text, binary, or Excel) file, or memory (i.e. user-defined variable) to write the result set into (please refer to the subsection INTO for additional information). If not specified, the cursor in use is populated with the result set instead (please refer to the chapter CURSOR for additional information).
Return
If the keyword BY NAME is not specified, it returns the endianness of an HDF5 dataset or attribute as an HDFQL_INT, which can be HDFQL_LITTLE_ENDIAN, HDFQL_BIG_ENDIAN, HDFQL_MIXED_ENDIAN, or HDFQL_UNDEFINED depending on whether the endianness is little, big, mixed (in case the data type of the dataset or attribute is HDFQL_COMPOUND and the endiannesses of its members are mixed), or undefined (i.e. endianness is not applicable to the dataset or attribute), respectively. Otherwise, if the keyword BY NAME is specified, it returns the endianness of a dataset or attribute as an HDFQL_VARCHAR, which can be “LITTLE_ENDIAN”, “BIG_ENDIAN”, “MIXED_ENDIAN”, or “UNDEFINED”.
Example(s)
# create an HDF5 dataset named "my_dataset0" of data type int using the native endian representation (of the machine)
CREATE DATASET my_dataset0 AS INT
# show (i.e. get) endianness of dataset "my_dataset0" (should return 1 or 2 (i.e. HDFQL_LITTLE_ENDIAN or HDFQL_BIG_ENDIAN depending on whether the dataset was created in a little or big endian machine, respectively))
SHOW ENDIANNESS my_dataset0
# create an HDF5 dataset named "my_dataset1" of data type long long using the little endian representation
CREATE DATASET my_dataset1 AS LITTLE ENDIAN BIGINT
# show (i.e. get) endianness of dataset "my_dataset1" (should return 1 (i.e. HDFQL_LITTLE_ENDIAN))
SHOW ENDIANNESS my_dataset1
# create an HDF5 attribute named "my_attribute0" of data type compound composed of three members named "m0" (of data type char), "m1" (of data type int using the little endian representation), and "m2" (of data type float using the big endian representation)
CREATE ATTRIBUTE my_attribute0 AS COMPOUND(m0 AS CHAR, m1 AS LITTLE ENDIAN INT, m2 AS BIG ENDIAN FLOAT)
# show (i.e. get) endianness of attribute "my_attribute0" (should return 4 (i.e. HDFQL_MIXED_ENDIAN))
SHOW ENDIANNESS my_attribute0
# show (i.e. get) endianness of members of attribute "my_attribute0" (should return -1 (i.e. HDFQL_UNDEFINED), 1 (i.e. HDFQL_LITTLE_ENDIAN), 2 (i.e. HDFQL_BIG_ENDIAN))
SHOW ENDIANNESS my_attribute0/
# create an HDF5 dataset named "my_common" of data type short using the big endian representation
CREATE DATASET my_common AS BIG ENDIAN SMALLINT
# create an HDF5 attribute named "my_common" of data type int using the little endian representation
CREATE ATTRIBUTE my_common AS LITTLE ENDIAN INT
# show (i.e. get) endianness of dataset "my_common" (should return 2 (i.e. HDFQL_BIG_ENDIAN))
SHOW ENDIANNESS my_common
# show (i.e. get) endianness of dataset "my_common" (should return 2 (i.e. HDFQL_BIG_ENDIAN))
SHOW ENDIANNESS DATASET my_common
# show (i.e. get) endianness of attribute "my_common" (should return 1 (i.e. HDFQL_LITTLE_ENDIAN))
SHOW ENDIANNESS ATTRIBUTE my_common