5.2Functions
A function is a group of instructions that together perform a specific task, requiring a return to the caller upon completion of the task. Any given function might be called at any point during a program's execution, including by other functions or itself. It provides better modularity of a program and a high degree of code reuse. The following table summarizes all existing HDFql functions in C.
| HDFql Function in C | Description |
|---|---|
| hdfql_execute | Execute a script (composed of one or more operations) |
| hdfql_execute_get_status | Get the status of the last executed operation |
| hdfql_error_get_line | Get the error line of the last executed operation |
| hdfql_error_get_position | Get the error position of the last executed operation |
| hdfql_error_get_message | Get the error message of the last executed operation |
| hdfql_cursor_initialize | Initialize a cursor for subsequent use |
| hdfql_cursor_use | Set the cursor to be used for storing the results of operations |
| hdfql_cursor_use_default | Set the HDFql default cursor as the one to be used for storing the results of operations |
| hdfql_cursor_clear | Clear (i.e. empty) the cursor in use |
| hdfql_cursor_clone | Clone (i.e. duplicate) a cursor into another one |
| hdfql_cursor_get_data_type | Get the data type of the cursor in use |
| hdfql_cursor_get_count | Get the number of elements (i.e. result set size) stored in the cursor in use |
| hdfql_subcursor_get_count | Get the number of elements (i.e. result subset size) stored in the subcursor in use |
| hdfql_cursor_get_dimension_count | Get the number of dimensions of the result set stored in the cursor in use |
| hdfql_cursor_get_dimension | Get the size of a certain dimension of the result set stored in the cursor in use |
| hdfql_cursor_get_position | Get the current position of the cursor in use within the result set |
| hdfql_subcursor_get_position | Get the current position of the subcursor in use within the result subset |
| hdfql_cursor_first | Move the cursor in use to the first position within the result set |
| hdfql_subcursor_first | Move the subcursor in use to the first position within the result subset |
| hdfql_cursor_last | Move the cursor in use to the last position within the result set |
| hdfql_subcursor_last | Move the subcursor in use to the last position within the result subset |
| hdfql_cursor_next | Move the cursor in use one position forward from its current position |
| hdfql_subcursor_next | Move the subcursor in use one position forward from its current position |
| hdfql_cursor_previous | Move the cursor in use one position backward from its current position |
| hdfql_subcursor_previous | Move the subcursor in use one position backward from its current position |
| hdfql_cursor_absolute | Move the cursor in use to an absolute position within the result set |
| hdfql_subcursor_absolute | Move the subcursor in use to an absolute position within the result subset |
| hdfql_cursor_relative | Move the cursor in use to a relative position within the result set |
| hdfql_subcursor_relative | Move the subcursor in use to a relative position within the result subset |
| hdfql_cursor_get_tinyint | Get the current element of the cursor in use as a TINYINT |
| hdfql_subcursor_get_tinyint | Get the current element of the subcursor in use as a TINYINT |
| hdfql_cursor_get_unsigned_tinyint | Get the current element of the cursor in use as an UNSIGNED TINYINT |
| hdfql_subcursor_get_unsigned_tinyint | Get the current element of the subcursor in use as an UNSIGNED TINYINT |
| hdfql_cursor_get_smallint | Get the current element of the cursor in use as a SMALLINT |
| hdfql_subcursor_get_smallint | Get the current element of the subcursor in use as a SMALLINT |
| hdfql_cursor_get_unsigned_smallint | Get the current element of the cursor in use as an UNSIGNED SMALLINT |
| hdfql_subcursor_get_unsigned_smallint | Get the current element of the subcursor in use as an UNSIGNED SMALLINT |
| hdfql_cursor_get_int | Get the current element of the cursor in use as an INT |
| hdfql_subcursor_get_int | Get the current element of the subcursor in use as an INT |
| hdfql_cursor_get_unsigned_int | Get the current element of the cursor in use as an UNSIGNED INT |
| hdfql_subcursor_get_unsigned_int | Get the current element of the subcursor in use as an UNSIGNED INT |
| hdfql_cursor_get_bigint | Get the current element of the cursor in use as a BIGINT |
| hdfql_subcursor_get_bigint | Get the current element of the subcursor in use as a BIGINT |
| hdfql_cursor_get_unsigned_bigint | Get the current element of the cursor in use as an UNSIGNED BIGINT |
| hdfql_subcursor_get_unsigned_bigint | Get the current element of the subcursor in use as an UNSIGNED BIGINT |
| hdfql_cursor_get_float | Get the current element of the cursor in use as a FLOAT |
| hdfql_subcursor_get_float | Get the current element of the subcursor in use as a FLOAT |
| hdfql_cursor_get_double | Get the current element of the cursor in use as a DOUBLE |
| hdfql_subcursor_get_double | Get the current element of the subcursor in use as a DOUBLE |
| hdfql_cursor_get_char | Get the current element of the cursor in use as a VARCHAR |
| hdfql_variable_register | Register a variable for subsequent use |
| hdfql_variable_transient_register | Register a variable in a transient way for subsequent use |
| hdfql_variable_unregister | Unregister a variable |
| hdfql_variable_unregister_all | Unregister all variables |
| hdfql_variable_get_number | Get the registration number associated with a variable |
| hdfql_variable_get_data_type | Get the data type of a variable |
| hdfql_variable_get_count | Get the number of elements of the result set stored in a variable |
| hdfql_variable_get_dimension_count | Get the number of dimensions of the result set stored in a variable |
| hdfql_variable_get_dimension | Get the size of a certain dimension of the result set stored in a variable |
| hdfql_mpi_use_communicator | Set the MPI communicator to be used when performing operations in parallel |
| hdfql_mpi_use_default_communicator | Set the MPI default communicator (MPI_COMM_WORLD) as the one to be used when performing operations in parallel |
| hdfql_mpi_get_size | Get the number (i.e. size) of processes associated with the MPI communicator |
| hdfql_mpi_get_rank | Get the rank of the calling process associated with the MPI communicator |
| hdfql_mpi_get_root | Get the rank of the MPI process specified as the root (for gathering processed (HDF5) data by other MPI processes) |
Table 5.9 – HDFql functions 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 functions are defined in these programming languages.
In C++, the prefix “hdfql_” of the names of functions (defined in C) is replaced by the namespace “HDFql”, and its underscores (_) are discarded. The remainder of the names of functions follows the lower camel-case convention. The following table lists a subset of HDFql functions as defined in C and details how these are defined/can be used in C++.
| HDFql Function in C | Corresponding Definition in C++ |
|---|---|
| hdfql_execute | HDFql::execute |
| hdfql_cursor_next | HDFql::cursorNext |
| hdfql_cursor_get_tinyint | HDFql::cursorGetTinyint |
| hdfql_cursor_get_unsigned_int | HDFql::cursorGetUnsignedInt |
| hdfql_subcursor_get_bigint | HDFql::subcursorGetBigint |
| hdfql_variable_get_number | HDFql::variableGetNumber |
Table 5.10 – HDFql functions in C and their corresponding definitions in C++
In Java, the prefix “hdfql_” of the names of functions (defined in C) is replaced by the class “HDFql”, and its underscores (_) are discarded. The remainder of the names of functions follows the lower camel-case convention. The following table lists a subset of HDFql functions as defined in C and details how these are defined/can be used in Java.
| HDFql Function in C | Corresponding Definition in Java |
|---|---|
| hdfql_execute | HDFql.execute |
| hdfql_cursor_next | HDFql.cursorNext |
| hdfql_cursor_get_tinyint | HDFql.cursorGetTinyint |
| hdfql_cursor_get_unsigned_int | HDFql.cursorGetUnsignedInt |
| hdfql_subcursor_get_bigint | HDFql.subcursorGetBigint |
| hdfql_variable_get_number | HDFql.variableGetNumber |
Table 5.11 – HDFql functions in C and their corresponding definitions in Java
In Python, the prefix “hdfql_” of the names of functions (defined in C) is replaced by the class “HDFql”. The remainder of the names of functions remains exactly the same. The following table lists a subset of HDFql functions as defined in C and details how these are defined/can be used in Python.
| HDFql Function in C | Corresponding Definition in Python |
|---|---|
| hdfql_execute | HDFql.execute |
| hdfql_cursor_next | HDFql.cursor_next |
| hdfql_cursor_get_tinyint | HDFql.cursor_get_tinyint |
| hdfql_cursor_get_unsigned_int | HDFql.cursor_get_unsigned_int |
| hdfql_subcursor_get_bigint | HDFql.subcursor_get_bigint |
| hdfql_variable_get_number | HDFql.variable_get_number |
Table 5.12 – HDFql functions in C and their corresponding definitions in Python
In C#, the prefix “hdfql_” of the names of functions (defined in C) is replaced by the class “HDFql”, and its underscores (_) are discarded. The remainder of the names of functions follows the upper camel-case convention. The following table lists a subset of HDFql functions as defined in C and details how these are defined/can be used in C#.
| HDFql Function in C | Corresponding Definition in C# |
|---|---|
| hdfql_execute | HDFql.Execute |
| hdfql_cursor_next | HDFql.CursorNext |
| hdfql_cursor_get_tinyint | HDFql.CursorGetTinyint |
| hdfql_cursor_get_unsigned_int | HDFql.CursorGetUnsignedInt |
| hdfql_subcursor_get_bigint | HDFql.SubcursorGetBigint |
| hdfql_variable_get_number | HDFql.VariableGetNumber |
Table 5.13 – HDFql functions in C and their corresponding definitions in C#
In Fortran, the names of functions are the same as in C and can be written using any case. The following table lists a subset of HDFql functions as defined in C and details how these are defined/can be used in Fortran.
| HDFql Function in C | Corresponding Definition in Fortran |
|---|---|
| hdfql_execute | hdfql_execute |
| hdfql_cursor_next | hdfql_cursor_next |
| hdfql_cursor_get_tinyint | hdfql_cursor_get_tinyint |
| hdfql_cursor_get_unsigned_int | hdfql_cursor_get_unsigned_int |
| hdfql_subcursor_get_bigint | hdfql_subcursor_get_bigint |
| hdfql_variable_get_number | hdfql_variable_get_number |
Table 5.14 – HDFql functions in C and their corresponding definitions in Fortran
In R, the names of functions are the same as in C. The following table lists a subset of HDFql functions as defined in C and details how these are defined/can be used in R.
| HDFql Function in C | Corresponding Definition in R |
|---|---|
| hdfql_execute | hdfql_execute |
| hdfql_cursor_next | hdfql_cursor_next |
| hdfql_cursor_get_tinyint | hdfql_cursor_get_tinyint |
| hdfql_cursor_get_unsigned_int | hdfql_cursor_get_unsigned_int |
| hdfql_subcursor_get_bigint | hdfql_subcursor_get_bigint |
| hdfql_variable_get_number | hdfql_variable_get_number |
Table 5.15 – HDFql functions in C and their corresponding definitions in R
In MATLAB, the prefix “hdfql_” of the names of functions (defined in C) is replaced by the class “HDFql”, and its underscores (_) are discarded. The remainder of the names of functions follows the lower camel-case convention. The following table lists a subset of HDFql functions as defined in C and details how these are defined/can be used in MATLAB.
| HDFql Function in C | Corresponding Definition in MATLAB |
|---|---|
| hdfql_execute | HDFql.execute |
| hdfql_cursor_next | HDFql.cursorNext |
| hdfql_cursor_get_tinyint | HDFql.cursorGetTinyint |
| hdfql_cursor_get_unsigned_int | HDFql.cursorGetUnsignedInt |
| hdfql_subcursor_get_bigint | HDFql.subcursorGetBigint |
| hdfql_variable_get_number | HDFql.variableGetNumber |
Table 5.16 – HDFql functions in C and their corresponding definitions in MATLAB
In this section
- 5.2.1hdfql_execute
- 5.2.2hdfql_execute_get_status
- 5.2.3hdfql_error_get_line
- 5.2.4hdfql_error_get_position
- 5.2.5hdfql_error_get_message
- 5.2.6hdfql_cursor_initialize
- 5.2.7hdfql_cursor_use
- 5.2.8hdfql_cursor_use_default
- 5.2.9hdfql_cursor_clear
- 5.2.10hdfql_cursor_clone
- 5.2.11hdfql_cursor_get_data_type
- 5.2.12hdfql_cursor_get_count
- 5.2.13hdfql_subcursor_get_count
- 5.2.14hdfql_cursor_get_dimension_count
- 5.2.15hdfql_cursor_get_dimension
- 5.2.16hdfql_cursor_get_position
- 5.2.17hdfql_subcursor_get_position
- 5.2.18hdfql_cursor_first
- 5.2.19hdfql_subcursor_first
- 5.2.20hdfql_cursor_last
- 5.2.21hdfql_subcursor_last
- 5.2.22hdfql_cursor_next
- 5.2.23hdfql_subcursor_next
- 5.2.24hdfql_cursor_previous
- 5.2.25hdfql_subcursor_previous
- 5.2.26hdfql_cursor_absolute
- 5.2.27hdfql_subcursor_absolute
- 5.2.28hdfql_cursor_relative
- 5.2.29hdfql_subcursor_relative
- 5.2.30hdfql_cursor_get_tinyint
- 5.2.31hdfql_subcursor_get_tinyint
- 5.2.32hdfql_cursor_get_unsigned_tinyint
- 5.2.33hdfql_subcursor_get_unsigned_tinyint
- 5.2.34hdfql_cursor_get_smallint
- 5.2.35hdfql_subcursor_get_smallint
- 5.2.36hdfql_cursor_get_unsigned_smallint
- 5.2.37hdfql_subcursor_get_unsigned_smallint
- 5.2.38hdfql_cursor_get_int
- 5.2.39hdfql_subcursor_get_int
- 5.2.40hdfql_cursor_get_unsigned_int
- 5.2.41hdfql_subcursor_get_unsigned_int
- 5.2.42hdfql_cursor_get_bigint
- 5.2.43hdfql_subcursor_get_bigint
- 5.2.44hdfql_cursor_get_unsigned_bigint
- 5.2.45hdfql_subcursor_get_unsigned_bigint
- 5.2.46hdfql_cursor_get_float
- 5.2.47hdfql_subcursor_get_float
- 5.2.48hdfql_cursor_get_double
- 5.2.49hdfql_subcursor_get_double
- 5.2.50hdfql_cursor_get_char
- 5.2.51hdfql_variable_register
- 5.2.52hdfql_variable_transient_register
- 5.2.53hdfql_variable_unregister
- 5.2.54hdfql_variable_unregister_all
- 5.2.55hdfql_variable_get_number
- 5.2.56hdfql_variable_get_data_type
- 5.2.57hdfql_variable_get_count
- 5.2.58hdfql_variable_get_dimension_count
- 5.2.59hdfql_variable_get_dimension
- 5.2.60hdfql_mpi_use_communicator
- 5.2.61hdfql_mpi_use_default_communicator
- 5.2.62hdfql_mpi_get_size
- 5.2.63hdfql_mpi_get_rank
- 5.2.64hdfql_mpi_get_root