/usr/include/gadap.h is in libgadap-dev 2.0-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | /* Copyright (C) 2003-2008 by the
* Institute of Global Environment and Society (IGES)
* See the file COPYRIGHT for more information.
*
*
* gadap.h : GrADS Client Interface for accessing OPeNDAP in-situ data.
*
* Original Author: Joe Wielgosz
* with modifications by James Gallagher, Arlindo daSilva, and Jennifer Adams
*
* Maintained by Jennifer Adams <jma@cola.iges.org>
*
*/
#ifndef _gadap_h_
#define _gadap_h_
/* Error codes */
#include "gadap_err.h"
#include "gadap_types.h"
#if defined(__cplusplus)
extern "C" {
#endif
/*****************************************************************
* Naming conventions:
*
* All defined types and macros are in all upper-case, and begin with
* "GADAP_". All functions are in all lower-case and begin with "gadap_".
* Many functions begin with "gadap_x_" where x is an abbreviation
* for the type of structure the function acts on. A handle or pointer
* to that structure will generally be the first argument of such a function.
*
* For instance,
* int gadap_d_numvars(GADAP_DATASET d_handle)
* is a function that acts on a dataset ("d") whereas
* int gadap_r_numvars(GADAP_RPTCOL r_handle)
* acts on a report collection ("r").
*
* Indices:
*
* All indices are zero-based.
*
* Memory management:
*
* Only memory allocated directly by the user (i.e. with a call to
* malloc) should be freed directly by the user. All memory allocated
* by the library will be freed when the various gadap_x_free
* functions are called.
*
*
* Error handling:
*
* Functions with return type GADAP_STATUS:
* Success is indicated by returning GADAP_SUCCESS (zero).
* An error is indicated by a negative return value. A complete list of
* these values is in "gadap_err.h".
*
* Functions with return type int:
* An error is indicated by a negative return value. A complete list of
* these values is in "gadap_err.h".
*
* Functions with pointer return type:
* An error will be indicated by a NULL return value. No specific error
* information is available for these functions.
*
* Functions with return type void:
* These functions should not need error-checking.
*/
/*****************************************************************
* Opening and closing datasets
*/
/* Opens dataset using the URL given. The handle to the opened dataset
* is placed in the handle argument. If the open attempt fails,
* the handle will be set to a negative (invalid) value. */
GADAP_STATUS
gadap_open(const char *url, GADAP_DATASET *d_handle);
/* Returns the number of open datasets */
int
gadap_numopen();
/* Returns a handle for the nth open dataset */
GADAP_STATUS
gadap_handle(GADAP_DATASET *d_handle, int d_index);
/* Closes the specified dataset, releasing all resources.
* If the free_rptcols argument is non-zero, all existing report collections
* associated with this dataset will be freed. */
void
gadap_close(GADAP_DATASET d_handle, int free_rptcols);
/*****************************************************************
* Identifying variables
*/
/* Returns the index of the variable with the specified name,
* in the specified dataset. Returns a negative error code if the
* variable is not present. */
int
gadap_d_varindex(GADAP_DATASET d_handle, const char *varname);
/* Returns the name of the nth variable in the specified dataset. */
const char *
gadap_d_varname(GADAP_DATASET d_handle, int var_index);
/* Returns the data type of the nth variable in the specified dataset -
* text, or numeric (see enum GADAP_VAR_TYPE) */
GADAP_VAR_TYPE
gadap_d_vartype(GADAP_DATASET d_handle, int var_index);
/* Returns the array size of the nth variable in the specified
* dataset. Non-array variables are equivalent to arrays of length
* 1. */
int
gadap_d_varlen(GADAP_DATASET d_handle, int var_index);
/* Returns the total number of variables in the specified dataset. */
int
gadap_d_numvars(GADAP_DATASET d_handle);
/* Returns the total number of level-independent variables in the specified
* dataset. Level-independent variables come first in the variable list.
* Thus, variables with indexes 0 through (numlivars - 1) are
* level-independent, while those with indexes >= numlivars have multiple
* vertical levels. */
int
gadap_d_numlivars(GADAP_DATASET d_handle);
/*****************************************************************
* Obtaining metadata
*/
/* Returns the short name of the specified dataset */
const char *
gadap_d_name(GADAP_DATASET d_handle);
/* Returns the full name of the specified dataset */
const char *
gadap_d_fullname(GADAP_DATASET d_handle);
/* Returns the URL used to open the specified dataset */
const char *
gadap_d_url(GADAP_DATASET d_handle);
/* Returns the number of metadata attributes associated with the
* specified dataset */
int
gadap_d_numattrs(GADAP_DATASET d_handle, int var_index);
/* Returns the name of the nth attribute of the specified dataset */
const char *
gadap_d_attrname(GADAP_DATASET d_handle, int var_index, int attr_index);
/* Returns the index of the attribute with the specified name in the
specified dataset. Returns a negative error code if the attribute is
not present. */
int
gadap_d_attrindex(GADAP_DATASET d_handle, int var_index, const char *attrname);
/* Returns the value of the nth attribute of the specified dataset,
* as a string. */
const char *
gadap_d_attrstr(GADAP_DATASET d_handle, int var_index, int attr_index);
/* Places the numeric value of the nth attribute of the specified
* dataset in the value argument. If the attribute cannnot be converted
* to a numerical representation, value is not set, and an error is
* indicated in the return value */
GADAP_STATUS
gadap_d_attrdbl(GADAP_DATASET d_handle, int var_index, int attr_index,
double *value);
/*****************************************************************
* Metadata convenience functions
*/
/* Returns the title of the specified dataset (the global attribute
* "title")
*/
const char *
gadap_d_title(GADAP_DATASET d_handle);
/* Places the missing data value for the nth variable of the specified dataset
* in the value argument (the attribute with name "missing_value" or else "_FillValue").
* If the variable specified has no fill value, value is not set, and
* an error is indicated in the return value */
GADAP_STATUS
gadap_d_fill(GADAP_DATASET d_handle, int var_index, double *value);
/* Returns the long name for the nth variable of the specified dataset
* (the attribute with name "long_name").
*/
const char *
gadap_d_longname(GADAP_DATASET d_handle, int var_index);
/*****************************************************************
* Sending a query
*/
/* Allocates memory for a station data query, and also allocates the query's
* varflags array with the correct number of elements for the specified
* dataset. All float and int values are initialized to zero, and strings to
* NULL.
*/
GADAP_STN_QUERY *
gadap_sq_new(GADAP_DATASET d_handle);
/* Populates the constraint and url fields of the query structure with the
* based on the current query settings. This can be used to print or examine
* the request URL before the request is actually sent.
*/
const char *
gadap_sq_url(GADAP_STN_QUERY *query);
/* Makes the specified query on the specified dataset. If successful, a
* handle to the resulting report collection is placed in the r_handle
* argument. The report collection makes its own copy of the query structure;
* the caller is responsible for disposing of the query
* passed in once it has been used, by calling gadap_sq_free(). */
GADAP_STATUS
gadap_sq_send(GADAP_STN_QUERY *query,
GADAP_RPTCOL *r_handle);
/* Frees memory for a station data query, including the varflag array.
* The caller is responsible for freeing memory used by the query's string
* fields (mintime, maxtime, stid, and extra) if they have been allocated. */
void
gadap_sq_free(GADAP_STN_QUERY *query);
/*****************************************************************
* Managing report collections
*/
/* Puts in the d_handle argument a handle to the dataset associated with the
* specified report collection (if the associated dataset is still open).*/
GADAP_STATUS
gadap_r_dataset(GADAP_RPTCOL r_handle, GADAP_DATASET *d_handle);
/* Returns the URL that was used to generate this report.
*/
const char *
gadap_r_url(GADAP_RPTCOL r_handle);
/* Returns the query that was used to generate this report.
* The caller should NOT free the memory for this query.
*/
GADAP_STN_QUERY *
gadap_r_query(GADAP_RPTCOL r_handle);
/* Returns the total number of variables in the specified report collection */
int
gadap_r_numvars(GADAP_RPTCOL r_handle);
/* Returns the total number of level-independent variables in the specified
* report collection. Level-independent variables come first in the variable
* list. Thus, variables with indexes 0 through (numlivars - 1) are
* level-independent, while those with indexes >= numlivars have multiple
* vertical levels. */
int
gadap_r_numlivars(GADAP_RPTCOL r_handle);
/* Returns the name of the nth variable in the specified report collection */
const char *
gadap_r_varname(GADAP_RPTCOL r_handle, int var_index);
/* Returns the index of the variable with the specified name,
* in the specified dataset. Returns a negative error code if the
* variable is not present. */
int
gadap_r_varindex(GADAP_RPTCOL r_handle, const char *varname);
/* Returns the total number of reports in the specified report collection */
int
gadap_r_numrpts(GADAP_RPTCOL r_handle);
/* Returns the total number of vertical levels in the specified report of the
* specified report collection */
int
gadap_r_numlev(GADAP_RPTCOL r_handle, int rpt_index);
/* Frees all resources used by the specified report collection. */
void
gadap_r_free(GADAP_RPTCOL r_handle);
/*****************************************************************
* Retrieving data from report collections
*/
/* Returns the value of the nth variable of the specified report
* collection, at the specified level of the specified report, in
* double-precision floating point form. If the variable is
* level-independent, the value of lev_index is ignored. The
* array_index specifies which element to retrieve if the variable is
* an array, otherwise it is ignored. If the variable is a string
* variable, value is not set, and an error code is returned.
*/
GADAP_STATUS
gadap_r_valdbl(GADAP_RPTCOL r_handle,
int rpt_index, int lev_index, int var_index, int array_index,
double * value);
/* Returns the value of the nth variable of the specified report
* collection, at the specified level of the specified report, in
* string form. If the variable is level-independent, the value of
* lev_index is ignored. The array_index specifies which element to
* retrieve if the variable is an array, otherwise it is ignored. If
* the variable is not a string variable, a null pointer is
* returned. */
const char *
gadap_r_valstr(GADAP_RPTCOL r_handle,
int rpt_index, int lev_index, int var_index, int array_index);
#if defined(__cplusplus)
}
#endif
#endif /* _gadap_h_ */
|