5.1Constants
A constant is an identifier whose associated value typically cannot be altered by the program during its execution. Using a constant instead of specifying a value multiple times in the program not only simplifies code maintenance but can also supply a meaningful name for it. Constants in the C programming language follow a naming convention of writing all words in uppercase and separating each word with an underscore (_). The following table summarizes all existing HDFql constants in C.
| HDFql Constant in C | Description | Data Type | Value |
|---|---|---|---|
| HDFQL_VERSION | Represents the HDFql version in use | char * | 2.6.0 |
| HDFQL_YES | Represents the concept “Yes” | int | 0 |
| HDFQL_NO | Represents the concept “No” | int | -1 |
| HDFQL_ENABLED | Represents the concept “Enabled” | int | 0 |
| HDFQL_DISABLED | Represents the concept “Disabled” | int | -1 |
| HDFQL_UNLIMITED | Represents the concept “Unlimited” | int | -1 |
| HDFQL_UNDEFINED | Represents the concept “Undefined” | int | -1 |
| HDFQL_GLOBAL | Represents the concept “Global” | int | 1 |
| HDFQL_LOCAL | Represents the concept “Local” | int | 2 |
| HDFQL_TRACKED | Represents the HDF5 tracked creation order strategy | int | 1 |
| HDFQL_INDEXED | Represents the HDF5 indexed creation order strategy | int | 2 |
| HDFQL_CONTIGUOUS | Represents the HDF5 contiguous storage type (layout) | int | 1 |
| HDFQL_COMPACT | Represents the HDF5 compact storage type (layout) | int | 2 |
| HDFQL_CHUNKED | Represents the HDF5 chunked storage type (layout) | int | 4 |
| HDFQL_EARLY | Represents the HDF5 early storage allocation | int | 1 |
| HDFQL_INCREMENTAL | Represents the HDF5 incremental storage allocation | int | 2 |
| HDFQL_LATE | Represents the HDF5 late storage allocation | int | 4 |
| HDFQL_DIRECTORY | Represents a directory | int | 1 |
| HDFQL_FILE | Represents a file | int | 2 |
| HDFQL_GROUP | Represents the HDF5 group object type | int | 4 |
| HDFQL_DATASET | Represents the HDF5 dataset object type | int | 8 |
| HDFQL_ATTRIBUTE | Represents the HDF5 attribute object type | int | 16 |
| HDFQL_SOFT_LINK | Represents the HDF5 soft link object type | int | 32 |
| HDFQL_EXTERNAL_LINK | Represents the HDF5 external link object type | int | 64 |
| HDFQL_TINYINT | Represents the tiny integer data type (TINYINT) | int | 1 |
| HDFQL_UNSIGNED_TINYINT | Represents the unsigned tiny integer data type (UNSIGNED TINYINT) | int | 2 |
| HDFQL_SMALLINT | Represents the small integer data type (SMALLINT) | int | 4 |
| HDFQL_UNSIGNED_SMALLINT | Represents the unsigned small integer data type (UNSIGNED SMALLINT) | int | 8 |
| HDFQL_INT | Represents the integer data type (INT) | int | 16 |
| HDFQL_UNSIGNED_INT | Represents the unsigned integer data type (UNSIGNED INT) | int | 32 |
| HDFQL_BIGINT | Represents the big integer data type (BIGINT) | int | 64 |
| HDFQL_UNSIGNED_BIGINT | Represents the unsigned big integer data type (UNSIGNED BIGINT) | int | 128 |
| HDFQL_FLOAT | Represents the float data type (FLOAT) | int | 256 |
| HDFQL_DOUBLE | Represents the double data type (DOUBLE) | int | 512 |
| HDFQL_CHAR | Represents the char data type (CHAR) | int | 1024 |
| HDFQL_VARTINYINT | Represents the variable-length tiny integer data type (VARTINYINT) | int | 2048 |
| HDFQL_UNSIGNED_VARTINYINT | Represents the unsigned variable-length tiny integer data type (UNSIGNED VARTINYINT) | int | 4096 |
| HDFQL_VARSMALLINT | Represents the variable-length small integer data type (VARSMALLINT) | int | 8192 |
| HDFQL_UNSIGNED_VARSMALLINT | Represents the unsigned variable-length small integer data type (UNSIGNED VARSMALLINT) | int | 16384 |
| HDFQL_VARINT | Represents the variable-length integer data type (VARINT) | int | 32768 |
| HDFQL_UNSIGNED_VARINT | Represents the unsigned variable-length integer data type (UNSIGNED VARINT) | int | 65536 |
| HDFQL_VARBIGINT | Represents the variable-length big integer data type (VARBIGINT) | int | 131072 |
| HDFQL_UNSIGNED_VARBIGINT | Represents the unsigned variable-length big integer data type (UNSIGNED VARBIGINT) | int | 262144 |
| HDFQL_VARFLOAT | Represents the variable-length float data type (VARFLOAT) | int | 524288 |
| HDFQL_VARDOUBLE | Represents the variable-length double data type (VARDOUBLE) | int | 1048576 |
| HDFQL_VARCHAR | Represents the variable-length char data type (VARCHAR) | int | 2097152 |
| HDFQL_OPAQUE | Represents the opaque data type (OPAQUE) | int | 4194304 |
| HDFQL_BITFIELD | Represents the bitfield data type | int | 8388608 |
| HDFQL_ENUMERATION | Represents the enumeration data type (ENUMERATION) | int | 16777216 |
| HDFQL_COMPOUND | Represents the compound data type (COMPOUND) | int | 33554432 |
| HDFQL_REFERENCE | Represents the reference data type | int | 67108864 |
| HDFQL_LITTLE_ENDIAN | Represents the little endian byte ordering | int | 1 |
| HDFQL_BIG_ENDIAN | Represents the big endian byte ordering | int | 2 |
| HDFQL_MIXED_ENDIAN | Represents the compound endian byte ordering (if endiannesses of its members are mixed) | int | 4 |
| HDFQL_ASCII | Represents the ASCII character encoding | int | 1 |
| HDFQL_UTF8 | Represents the UTF-8 character encoding | int | 2 |
| HDFQL_NULLTERM | Represents the null terminated padding | int | 1 |
| HDFQL_NULLPAD | Represents the null padding | int | 2 |
| HDFQL_SPACEPAD | Represents the space padding | int | 4 |
| HDFQL_FILL_DEFAULT | Represents the default fill type | int | 1 |
| HDFQL_FILL_DEFINED | Represents the (user) defined fill type | int | 2 |
| HDFQL_FILL_UNDEFINED | Represents the undefined fill type | int | 4 |
| HDFQL_FILL_NEVER | Represents the never fill type | int | 8 |
| HDFQL_VERSION_EARLIEST | Represents the earliest HDF5 library bound version | int | 1 |
| HDFQL_VERSION_LATEST | Represents the latest HDF5 library bound version | int | 2 |
| HDFQL_VERSION_18 | Represents the HDF5 library bound version 1.8 | int | 4 |
| HDFQL_VERSION_110 | Represents the HDF5 library bound version 1.10 | int | 2 |
| HDFQL_SUCCESS | Represents an operation that succeeded | int | 0 |
| HDFQL_ERROR_PARSE | Represents an operation that failed due to a parsing error | int | -1 |
| HDFQL_ERROR_NOT_SPECIFIED | Represents an operation that failed due to information not being specified (i.e. missing) | int | -2 |
| HDFQL_ERROR_NOT_FOUND | Represents an operation that failed due to an object (e.g. directory, file, group, dataset) not being found | int | -3 |
| HDFQL_ERROR_NO_ACCESS | Represents an operation that failed due to an object (e.g. directory, file, group, dataset) not being accessible | int | -4 |
| HDFQL_ERROR_NOT_OPEN | Represents an operation that failed due to an object (e.g. file) not being opened | int | -5 |
| HDFQL_ERROR_TEMPORARILY_UNAVAILABLE | Represents an operation that failed due to a file being temporarily unavailable (e.g. unable to lock the file) | int | -6 |
| HDFQL_ERROR_INVALID_NAME | Represents an operation that failed due to the name of an object (e.g. directory, file, group, dataset) being invalid | int | -7 |
| HDFQL_ERROR_INVALID_FILE | Represents an operation that failed due to a file being invalid (e.g. not a valid HDF5 file) | int | -8 |
| HDFQL_ERROR_NOT_SUPPORTED | Represents an operation that failed due to not being supported | int | -9 |
| HDFQL_ERROR_NOT_ENOUGH_SPACE | Represents an operation that failed due to the machine not having enough (storage) space | int | -10 |
| HDFQL_ERROR_NOT_ENOUGH_MEMORY | Represents an operation that failed due to the machine not having enough (RAM) memory | int | -11 |
| HDFQL_ERROR_ALREADY_EXISTS | Represents an operation that failed due to an object (e.g. directory, file, group, dataset) already existing | int | -12 |
| HDFQL_ERROR_EMPTY | Represents an operation that failed due to its internal structure being empty | int | -13 |
| HDFQL_ERROR_FULL | Represents an operation that failed due to its internal structure being full | int | -14 |
| HDFQL_ERROR_BEFORE_FIRST | Represents an operation that failed due to trying to position/access an element before the first one | int | -15 |
| HDFQL_ERROR_AFTER_LAST | Represents an operation that failed due to trying to position/access an element after the last one | int | -16 |
| HDFQL_ERROR_OUTSIDE_LIMIT | Represents an operation that failed due to being outside the limit | int | -17 |
| HDFQL_ERROR_NO_ADDRESS | Represents an operation that failed due to a user-defined variable having no address (i.e. being NULL) | int | -18 |
| HDFQL_ERROR_UNEXPECTED_TYPE | Represents an operation that failed due to an object (e.g. group, dataset) being of an unexpected type | int | -19 |
| HDFQL_ERROR_UNEXPECTED_DATA_TYPE | Represents an operation that failed due to a user-defined variable being of an unexpected data type | int | -20 |
| HDFQL_ERROR_UNEXPECTED_STORAGE_TYPE | Represents an operation that failed due to a dataset being of an unexpected storage type (layout) | int | -21 |
| HDFQL_ERROR_DANGLING_LINK | Represents an operation that failed due to an object being a dangling (soft or external) link | int | -22 |
| HDFQL_ERROR_NOT_REGISTERED | Represents an operation that failed due to a user-defined variable not being registered | int | -23 |
| HDFQL_ERROR_INVALID_OPERATION | Represents an operation that failed due to being invalid | int | -24 |
| HDFQL_ERROR_INVALID_REGULAR_EXPRESSION | Represents an operation that failed due to a regular expression being invalid | int | -25 |
| HDFQL_ERROR_INVALID_SELECTION | Represents an operation that failed due to a (hyperslab or point) selection being invalid | int | -26 |
| HDFQL_ERROR_UNKNOWN | Represents an operation that failed due to an unknown/unexpected error | int | -99 |
Table 5.1 – HDFql constants in C
HDFql also supports other programming languages, namely C++, Java, Python, C#, Fortran, R, and MATLAB, through shared libraries and wrappers. The tables below provide examples of how HDFql constants are defined in these programming languages.
In C++, the prefix “HDFQL_” of the names of constants (defined in C) is replaced by the namespace “HDFql”, and its underscores (_) are discarded. The remainder of the names of constants follows the upper camel-case convention. The following table lists a subset of HDFql constants as defined in C and details how these are defined/can be used in C++.
| HDFql Constant in C | Corresponding Definition in C++ |
|---|---|
| HDFQL_VERSION | HDFql::Version |
| HDFQL_SUCCESS | HDFql::Success |
| HDFQL_ERROR_PARSE | HDFql::ErrorParse |
| HDFQL_TINYINT | HDFql::Tinyint |
| HDFQL_UNSIGNED_BIGINT | HDFql::UnsignedBigint |
| HDFQL_UTF8 | HDFql::Utf8 |
Table 5.2 – HDFql constants in C and their corresponding definitions in C++
In Java, the prefix “HDFQL_” of the names of constants (defined in C) is replaced by the class “HDFql”. The remainder of the names of constants remains exactly the same. The following table lists a subset of HDFql constants as defined in C and details how these are defined/can be used in Java.
| HDFql Constant in C | Corresponding Definition in Java |
|---|---|
| HDFQL_VERSION | HDFql.VERSION |
| HDFQL_SUCCESS | HDFql.SUCCESS |
| HDFQL_ERROR_PARSE | HDFql.ERROR_PARSE |
| HDFQL_TINYINT | HDFql.TINYINT |
| HDFQL_UNSIGNED_BIGINT | HDFql.UNSIGNED_BIGINT |
| HDFQL_UTF8 | HDFql.UTF8 |
Table 5.3 – HDFql constants in C and their corresponding definitions in Java
In Python, the prefix “HDFQL_” of the names of constants (defined in C) is replaced by the class “HDFql”. The remainder of the names of constants remains exactly the same. The following table lists a subset of HDFql constants as defined in C and details how these are defined/can be used in Python.
| HDFql Constant in C | Corresponding Definition in Python |
|---|---|
| HDFQL_VERSION | HDFql.VERSION |
| HDFQL_SUCCESS | HDFql.SUCCESS |
| HDFQL_ERROR_PARSE | HDFql.ERROR_PARSE |
| HDFQL_TINYINT | HDFql.TINYINT |
| HDFQL_UNSIGNED_BIGINT | HDFql.UNSIGNED_BIGINT |
| HDFQL_UTF8 | HDFql.UTF8 |
Table 5.4 – HDFql constants in C and their corresponding definitions in Python
In C#, the prefix “HDFQL_” of the names of constants (defined in C) is replaced by the class “HDFql”, and its underscores (_) are discarded. The remainder of the names of constants follows the upper camel-case convention. The following table lists a subset of HDFql constants as defined in C and details how these are defined/can be used in C#.
| HDFql Constant in C | Corresponding Definition in C# |
|---|---|
| HDFQL_VERSION | HDFql.Version |
| HDFQL_SUCCESS | HDFql.Success |
| HDFQL_ERROR_PARSE | HDFql.ErrorParse |
| HDFQL_TINYINT | HDFql.Tinyint |
| HDFQL_UNSIGNED_BIGINT | HDFql.UnsignedBigint |
| HDFQL_UTF8 | HDFql.Utf8 |
Table 5.5 – HDFql constants in C and their corresponding definitions in C#
In Fortran, the names of constants are the same as in C and can be written in any case. The following table lists a subset of HDFql constants as defined in C and details how these are defined/can be used in Fortran.
| HDFql Constant in C | Corresponding Definition in Fortran |
|---|---|
| HDFQL_VERSION | HDFQL_VERSION |
| HDFQL_SUCCESS | HDFQL_SUCCESS |
| HDFQL_ERROR_PARSE | HDFQL_ERROR_PARSE |
| HDFQL_TINYINT | HDFQL_TINYINT |
| HDFQL_UNSIGNED_BIGINT | HDFQL_UNSIGNED_BIGINT |
| HDFQL_UTF8 | HDFQL_UTF8 |
Table 5.6 – HDFql constants in C and their corresponding definitions in Fortran
In R, the names of constants are the same as in C. The following table lists a subset of HDFql constants as defined in C and details how these are defined/can be used in R.
| HDFql Constant in C | Corresponding Definition in R |
|---|---|
| HDFQL_VERSION | HDFQL_VERSION |
| HDFQL_SUCCESS | HDFQL_SUCCESS |
| HDFQL_ERROR_PARSE | HDFQL_ERROR_PARSE |
| HDFQL_TINYINT | HDFQL_TINYINT |
| HDFQL_UNSIGNED_BIGINT | HDFQL_UNSIGNED_BIGINT |
| HDFQL_UTF8 | HDFQL_UTF8 |
Table 5.7 – HDFql constants in C and their corresponding definitions in R
In MATLAB, the prefix “HDFQL_” of the names of constants (defined in C) is replaced by the class “HDFql”. The remainder of the names of constants remains exactly the same. The following table lists a subset of HDFql constants as defined in C and details how these are defined/can be used in MATLAB.
| HDFql Constant in C | Corresponding Definition in MATLAB |
|---|---|
| HDFQL_VERSION | HDFql.VERSION |
| HDFQL_SUCCESS | HDFql.SUCCESS |
| HDFQL_ERROR_PARSE | HDFql.ERROR_PARSE |
| HDFQL_TINYINT | HDFql.TINYINT |
| HDFQL_UNSIGNED_BIGINT | HDFql.UNSIGNED_BIGINT |
| HDFQL_UTF8 | HDFql.UTF8 |
Table 5.8 – HDFql constants in C and their corresponding definitions in MATLAB