HDFql Reference Manual v2.6.0

6.7.20SHOW OFFSET

Syntax

SHOW OFFSET [DATASET | ATTRIBUTE] [file_name] object_name

[post_processing_option]

[output_redirecting_option]

Description

Show (i.e. get) the member offsets of an HDF5 dataset or attribute named object_name. If object_name is not of data type HDFQL_COMPOUND, an error is raised. 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 member offsets returned belong to the dataset. To explicitly get the member offsets of object_name according to its type, the keyword DATASET or ATTRIBUTE must be specified.

Parameter(s)

file_name – optional string that specifies the name of the HDF5 file storing the dataset or attribute whose member offsets are to be obtained. If file_name is specified, the file is opened on the fly, the member offsets of the dataset or attribute are 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 member offsets are to be obtained.

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

The member offsets of an HDF5 dataset or attribute as an HDFQL_INT.

Example(s)

# create an HDF5 dataset named "my_dataset0" of data type compound composed of three members named "person" (of data type variable-length char with offset 0), "age" (of data type unsigned int with offset 8), and "weight" (of data type float with offset 12)
CREATE DATASET my_dataset0 AS COMPOUND(person AS VARCHAR, age AS UNSIGNED INT, weight AS FLOAT)

# show (i.e. get) member offsets of dataset "my_dataset0" (should return 0, 4, 8 if using an HDFql 32 bit library or 0, 8, 12 if using an HDFql 64 bit library)
SHOW OFFSET my_dataset0

# create an HDF5 dataset named "my_dataset1" of data type compound composed of two members named "readings" (of data type int of one dimension (size 5) with offset 0) and "state" (of data type char with offset 20)
CREATE DATASET my_dataset1 AS COMPOUND(readings AS INT(5), state AS TINYINT)

# show (i.e. get) member offsets of dataset "my_dataset1" (should return 0, 20) 
SHOW OFFSET my_dataset1

# create an HDF5 attribute named "my_attribute0" of data type compound composed of three members named "id" (of data type long long with offset 0), "position" (of data type compound with offset 8 and composed of two members named "x" (of data type short with offset 0) and "y" (of data type short with offset 2)), and "temperature" (of data type enumeration with offset 12 and composed of three members named "cold", "warm", and "hot")
CREATE ATTRIBUTE my_attribute0 AS COMPOUND(id AS BIGINT, position AS COMPOUND(x AS SMALLINT, y AS SMALLINT), temperature AS ENUMERATION(cold, warm, hot))

# show (i.e. get) member offsets of attribute "my_attribute0" (should return 0, 8, 0, 2, 12) 
SHOW OFFSET my_attribute0

# create an HDF5 attribute named "my_attribute1" of data type compound composed of five members named "m0" (of data type int with offset 5), "m1" (of data type compound with offset 20 and composed of two members named "m0" (of data type float with offset 0) and "m1" (of data type short with offset 4)), "m2" (of data type long long with offset 26), "m3" (of data type enumeration with offset 35 and composed of two members named "on" and "off"), and "m4" (of data type double with offset 36)
CREATE ATTRIBUTE my_attribute1 AS COMPOUND(m0 AS INT OFFSET 5, m1 AS COMPOUND(m0 AS FLOAT, m1 AS SMALLINT) OFFSET 20, m2 AS BIGINT, m3 AS ENUMERATION(on, off) OFFSET 35, m4 AS DOUBLE)

# show (i.e. get) member offsets of attribute "my_attribute1" (should return 5, 20, 0, 4, 26, 35, 36)
SHOW OFFSET my_attribute1