HDFql Reference Manual v2.6.0

5.2.58hdfql_variable_get_dimension_count

Syntax

int hdfql_variable_get_dimension_count(const void *variable)

Description

Get the number of dimensions of the result set stored in a variable named variable. The number of dimensions refers to the result of a DATA QUERY LANGUAGE (DQL) or DATA INTROSPECTION LANGUAGE (DIL) operation redirected into memory – and not to the number of dimensions that variable has in the program. If variable has been registered but has never been populated through a redirection operation, the returned number of dimensions is zero.

Parameter(s)

variable – pointer to a variable whose number of dimensions is to be obtained.

Return

int – depending on the success in getting the number of dimensions of the variable, it can be equal to or greater than zero (i.e. the number of dimensions), HDFQL_ERROR_NO_ADDRESS, or HDFQL_ERROR_NOT_REGISTERED.

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 number of dimensions of variable "data" (should be "Number of dimensions in variable is 2")
printf("Number of dimensions in variable is %d\n",
hdfql_variable_get_dimension_count(data));