5.2.59hdfql_variable_get_dimension
Syntax
long long hdfql_variable_get_dimension(const void *variable, int index)
Description
Get the size of a certain dimension (specified by index) of the result set stored in a variable named variable. The size of a certain dimension refers to the result of a DATA QUERY LANGUAGE (DQL) or DATA INTROSPECTION LANGUAGE (DIL) operation redirected into memory – and not the size of a certain dimension that variable has in the program. The index of the first dimension is zero. If variable has never been registered or populated or has been unregistered, or index is not between 0 and the value returned by hdfql_variable_get_dimension_count - 1, an error is returned.
Parameter(s)
variable – pointer to a variable to get the size of one of its dimensions.
index – integer that specifies the index of the dimension whose size is to be obtained.
Return
long long – depending on the success in getting the size of a certain dimension of the variable, it can be equal to or greater than zero (i.e. the size of the specified dimension), HDFQL_ERROR_NO_ADDRESS, HDFQL_ERROR_NOT_REGISTERED, or HDFQL_ERROR_OUTSIDE_LIMIT.
Example(s)
// declare variables
char script[1024];
int data[5][3];
// create an HDF5 dataset named "my_dataset" of data type int of two dimensions (size 5x3)
hdfql_execute("CREATE DATASET my_dataset AS INT(5, 3)");
// register variable "data" for subsequent use (by HDFql)
hdfql_variable_register(data);
// prepare script to select (i.e. read) data from dataset "my_dataset" and populate variable "data" with it
sprintf(script, "SELECT FROM my_dataset INTO MEMORY %d", hdfql_variable_get_number(data));
// execute script
hdfql_execute(script);
// display size of the first dimension of variable "data" (should be "Size of first dimension of variable is 5")
printf("Size of first dimension of variable is %lld\n", hdfql_variable_get_dimension(data, 0));
// display size of the second dimension of variable "data" (should be "Size of second dimension of variable is 3")
printf("Size of second dimension of variable is %lld\n", hdfql_variable_get_dimension(data, 1));