gd_get_constant
retrieve a scalar constant from a dirfile database
- Provided by: libgetdata-dev (Version: 0.7.3-6ubuntu1)
- Source: libgetdata
- Report a bug
retrieve a scalar constant from a dirfile database
#include <getdata.h>
int gd_get_constant(DIRFILE *dirfile, const char *field_code, gd_type_t return_type, void *data_out);
The gd_get_constant() function queries a dirfile(5) database specified by dirfile for the CONST scalar field_code, which may contain a representation suffix. The constant is converted to the data type specified by return_type, and stored in the user-supplied buffer data_out.
The dirfile argument must point to a valid DIRFILE object previously created by a call to gd_open(3). The argument data_out must point to a valid memory location of sufficient size to hold a value of the return type specified.
The return_type argument should be one of the following symbols, which indicates the desired return type of the data:
The return type of the constant need not be the same as the type of the data stored in the database. Type conversion will be performed as necessary to return the requested type. If the field_code does not indicate a representation, but conversion from a complex value to a purely real one is required, only the real portion of the requested vector will be returned.
On success, gd_get_constant() returns zero. On error, it returns -1 and sets the dirfile error to a non-zero value. Possible error values are:
The dirfile error may be retrieved by calling gd_error(3). A descriptive error string for the last error encountered may be obtained from a call to gd_error_string(3).
dirfile(5), gd_open(3), gd_error(3), gd_error_string(3), gd_get_carray(3), gd_constants(3), gd_put_constant(3)