HDFql Reference Manual v2.6.0

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_executeExecute a script (composed of one or more operations)
hdfql_execute_get_statusGet the status of the last executed operation
hdfql_error_get_lineGet the error line of the last executed operation
hdfql_error_get_positionGet the error position of the last executed operation
hdfql_error_get_messageGet the error message of the last executed operation
hdfql_cursor_initializeInitialize a cursor for subsequent use
hdfql_cursor_useSet the cursor to be used for storing the results of operations
hdfql_cursor_use_defaultSet the HDFql default cursor as the one to be used for storing the results of operations
hdfql_cursor_clearClear (i.e. empty) the cursor in use
hdfql_cursor_cloneClone (i.e. duplicate) a cursor into another one
hdfql_cursor_get_data_typeGet the data type of the cursor in use
hdfql_cursor_get_countGet the number of elements (i.e. result set size) stored in the cursor in use
hdfql_subcursor_get_countGet the number of elements (i.e. result subset size) stored in the subcursor in use
hdfql_cursor_get_dimension_countGet the number of dimensions of the result set stored in the cursor in use
hdfql_cursor_get_dimensionGet the size of a certain dimension of the result set stored in the cursor in use
hdfql_cursor_get_positionGet the current position of the cursor in use within the result set
hdfql_subcursor_get_positionGet the current position of the subcursor in use within the result subset
hdfql_cursor_firstMove the cursor in use to the first position within the result set
hdfql_subcursor_firstMove the subcursor in use to the first position within the result subset
hdfql_cursor_lastMove the cursor in use to the last position within the result set
hdfql_subcursor_lastMove the subcursor in use to the last position within the result subset
hdfql_cursor_nextMove the cursor in use one position forward from its current position
hdfql_subcursor_nextMove the subcursor in use one position forward from its current position
hdfql_cursor_previousMove the cursor in use one position backward from its current position
hdfql_subcursor_previousMove the subcursor in use one position backward from its current position
hdfql_cursor_absoluteMove the cursor in use to an absolute position within the result set
hdfql_subcursor_absoluteMove the subcursor in use to an absolute position within the result subset
hdfql_cursor_relativeMove the cursor in use to a relative position within the result set
hdfql_subcursor_relativeMove the subcursor in use to a relative position within the result subset
hdfql_cursor_get_tinyintGet the current element of the cursor in use as a TINYINT
hdfql_subcursor_get_tinyintGet the current element of the subcursor in use as a TINYINT
hdfql_cursor_get_unsigned_tinyintGet the current element of the cursor in use as an UNSIGNED TINYINT
hdfql_subcursor_get_unsigned_tinyintGet the current element of the subcursor in use as an UNSIGNED TINYINT
hdfql_cursor_get_smallintGet the current element of the cursor in use as a SMALLINT
hdfql_subcursor_get_smallintGet the current element of the subcursor in use as a SMALLINT
hdfql_cursor_get_unsigned_smallintGet the current element of the cursor in use as an UNSIGNED SMALLINT
hdfql_subcursor_get_unsigned_smallintGet the current element of the subcursor in use as an UNSIGNED SMALLINT
hdfql_cursor_get_intGet the current element of the cursor in use as an INT
hdfql_subcursor_get_intGet the current element of the subcursor in use as an INT
hdfql_cursor_get_unsigned_intGet the current element of the cursor in use as an UNSIGNED INT
hdfql_subcursor_get_unsigned_intGet the current element of the subcursor in use as an UNSIGNED INT
hdfql_cursor_get_bigintGet the current element of the cursor in use as a BIGINT
hdfql_subcursor_get_bigintGet the current element of the subcursor in use as a BIGINT
hdfql_cursor_get_unsigned_bigintGet the current element of the cursor in use as an UNSIGNED BIGINT
hdfql_subcursor_get_unsigned_bigintGet the current element of the subcursor in use as an UNSIGNED BIGINT
hdfql_cursor_get_floatGet the current element of the cursor in use as a FLOAT
hdfql_subcursor_get_floatGet the current element of the subcursor in use as a FLOAT
hdfql_cursor_get_doubleGet the current element of the cursor in use as a DOUBLE
hdfql_subcursor_get_doubleGet the current element of the subcursor in use as a DOUBLE
hdfql_cursor_get_charGet the current element of the cursor in use as a VARCHAR
hdfql_variable_registerRegister a variable for subsequent use
hdfql_variable_transient_registerRegister a variable in a transient way for subsequent use
hdfql_variable_unregisterUnregister a variable
hdfql_variable_unregister_allUnregister all variables
hdfql_variable_get_numberGet the registration number associated with a variable
hdfql_variable_get_data_typeGet the data type of a variable
hdfql_variable_get_countGet the number of elements of the result set stored in a variable
hdfql_variable_get_dimension_countGet the number of dimensions of the result set stored in a variable
hdfql_variable_get_dimensionGet the size of a certain dimension of the result set stored in a variable
hdfql_mpi_use_communicatorSet the MPI communicator to be used when performing operations in parallel
hdfql_mpi_use_default_communicatorSet the MPI default communicator (MPI_COMM_WORLD) as the one to be used when performing operations in parallel
hdfql_mpi_get_sizeGet the number (i.e. size) of processes associated with the MPI communicator
hdfql_mpi_get_rankGet the rank of the calling process associated with the MPI communicator
hdfql_mpi_get_rootGet 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_executeHDFql::execute
hdfql_cursor_nextHDFql::cursorNext
hdfql_cursor_get_tinyintHDFql::cursorGetTinyint
hdfql_cursor_get_unsigned_intHDFql::cursorGetUnsignedInt
hdfql_subcursor_get_bigintHDFql::subcursorGetBigint
hdfql_variable_get_numberHDFql::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_executeHDFql.execute
hdfql_cursor_nextHDFql.cursorNext
hdfql_cursor_get_tinyintHDFql.cursorGetTinyint
hdfql_cursor_get_unsigned_intHDFql.cursorGetUnsignedInt
hdfql_subcursor_get_bigintHDFql.subcursorGetBigint
hdfql_variable_get_numberHDFql.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_executeHDFql.execute
hdfql_cursor_nextHDFql.cursor_next
hdfql_cursor_get_tinyintHDFql.cursor_get_tinyint
hdfql_cursor_get_unsigned_intHDFql.cursor_get_unsigned_int
hdfql_subcursor_get_bigintHDFql.subcursor_get_bigint
hdfql_variable_get_numberHDFql.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_executeHDFql.Execute
hdfql_cursor_nextHDFql.CursorNext
hdfql_cursor_get_tinyintHDFql.CursorGetTinyint
hdfql_cursor_get_unsigned_intHDFql.CursorGetUnsignedInt
hdfql_subcursor_get_bigintHDFql.SubcursorGetBigint
hdfql_variable_get_numberHDFql.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_executehdfql_execute
hdfql_cursor_nexthdfql_cursor_next
hdfql_cursor_get_tinyinthdfql_cursor_get_tinyint
hdfql_cursor_get_unsigned_inthdfql_cursor_get_unsigned_int
hdfql_subcursor_get_biginthdfql_subcursor_get_bigint
hdfql_variable_get_numberhdfql_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_executehdfql_execute
hdfql_cursor_nexthdfql_cursor_next
hdfql_cursor_get_tinyinthdfql_cursor_get_tinyint
hdfql_cursor_get_unsigned_inthdfql_cursor_get_unsigned_int
hdfql_subcursor_get_biginthdfql_subcursor_get_bigint
hdfql_variable_get_numberhdfql_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_executeHDFql.execute
hdfql_cursor_nextHDFql.cursorNext
hdfql_cursor_get_tinyintHDFql.cursorGetTinyint
hdfql_cursor_get_unsigned_intHDFql.cursorGetUnsignedInt
hdfql_subcursor_get_bigintHDFql.subcursorGetBigint
hdfql_variable_get_numberHDFql.variableGetNumber

Table 5.16 – HDFql functions in C and their corresponding definitions in MATLAB

In this section