The grib_index


Typedefs

typedef struct grib_index grib_index

Functions

grib_indexgrib_index_new_from_file (grib_context *c, char *filename, const char *keys, int *err)
 Create a new index form a file.
int grib_index_get_size (grib_index *index, const char *key, size_t *size)
 Get the number of distinct values of the key in argument contained in the index.
int grib_index_get_long (grib_index *index, const char *key, long *values, size_t *size)
 Get the distinct values of the key in argument contained in the index.
int grib_index_get_double (grib_index *index, const char *key, double *values, size_t *size)
 Get the distinct values of the key in argument contained in the index.
int grib_index_get_string (grib_index *index, const char *key, char **values, size_t *size)
 Get the distinct values of the key in argument contained in the index.
int grib_index_select_long (grib_index *index, const char *key, long value)
 Select the message subset with key==value.
int grib_index_select_double (grib_index *index, const char *key, double value)
 Select the message subset with key==value.
int grib_index_select_string (grib_index *index, const char *key, char *value)
 Select the message subset with key==value.
grib_handlegrib_handle_new_from_index (grib_index *index, int *err)
 Create a new handle from an index after having selected the key values.
void grib_index_delete (grib_index *index)
 Delete the index.

Detailed Description

The grib_index is the structure giving indexed access to messages in a file.

Typedef Documentation

typedef struct grib_index grib_index

index structure to access messages in a file.


Function Documentation

grib_handle* grib_handle_new_from_index ( grib_index index,
int *  err 
)

Create a new handle from an index after having selected the key values.

All the keys belonging to the index must be selected before calling this function. Successive calls to this function will return all the handles compatible with the constraints defined selecting the values of the index keys. When no more handles are available from the index a NULL pointer is returned and the err variable is set to GRIB_END_OF_INDEX.

Parameters:
index : an index created from a file.
err : 0 if OK, integer value on error. GRIB_END_OF_INDEX when no more handles are contained in the index.
Returns:
grib handle.

void grib_index_delete ( grib_index index  ) 

Delete the index.

Parameters:
index : index to be deleted.

int grib_index_get_double ( grib_index index,
const char *  key,
double *  values,
size_t *  size 
)

Get the distinct values of the key in argument contained in the index.

The key must belong to the index. This function is used when the type of the key was explicitly defined as double or when the native type of the key is double.

Parameters:
index : an index created from a file. The index must have been created with the key in argument.
key : key for wich the values are returned
values : array of values. The array must be allocated before entering this function and its size must be enough to contain all the values.
size : size of the values array
Returns:
0 if OK, integer value on error

int grib_index_get_long ( grib_index index,
const char *  key,
long *  values,
size_t *  size 
)

Get the distinct values of the key in argument contained in the index.

The key must belong to the index. This function is used when the type of the key was explicitly defined as long or when the native type of the key is long.

Parameters:
index : an index created from a file. The index must have been created with the key in argument.
key : key for wich the values are returned
values : array of values. The array must be allocated before entering this function and its size must be enough to contain all the values.
size : size of the values array
Returns:
0 if OK, integer value on error

int grib_index_get_size ( grib_index index,
const char *  key,
size_t *  size 
)

Get the number of distinct values of the key in argument contained in the index.

The key must belong to the index.

Parameters:
index : an index created from a file. The index must have been created with the key in argument.
key : key for which the number of values is computed
size : number of distinct values of the key in the index
Returns:
0 if OK, integer value on error
Examples:
index.f90.

int grib_index_get_string ( grib_index index,
const char *  key,
char **  values,
size_t *  size 
)

Get the distinct values of the key in argument contained in the index.

The key must belong to the index. This function is used when the type of the key was explicitly defined as string or when the native type of the key is string.

Parameters:
index : an index created from a file. The index must have been created with the key in argument.
key : key for wich the values are returned
values : array of values. The array must be allocated before entering this function and its size must be enough to contain all the values.
size : size of the values array
Returns:
0 if OK, integer value on error

grib_index* grib_index_new_from_file ( grib_context c,
char *  filename,
const char *  keys,
int *  err 
)

Create a new index form a file.

The file is indexed with the keys in argument.

Parameters:
c : context (NULL for default context)
filename : name of the file of messages to be indexed
keys : comma separated list of keys for the index. The type of the key can be explicitly declared appending :l for long, :d for double, :s for string to the key name. If the type is not declared explicitly, the native type is assumed.
err : 0 if OK, integer value on error
Returns:
the newly created index

int grib_index_select_double ( grib_index index,
const char *  key,
double  value 
)

Select the message subset with key==value.

The value is a double. The key must have been created with double type or have double as native type if the type was not explicitly defined in the index creation.

Parameters:
index : an index created from a file. The index must have been created with the key in argument.
key : key to be selected
value : value of the key to select
Returns:
0 if OK, integer value on error

int grib_index_select_long ( grib_index index,
const char *  key,
long  value 
)

Select the message subset with key==value.

The value is a long. The key must have been created with long type or have long as native type if the type was not explicitly defined in the index creation.

Parameters:
index : an index created from a file. The index must have been created with the key in argument.
key : key to be selected
value : value of the key to select
Returns:
0 if OK, integer value on error

int grib_index_select_string ( grib_index index,
const char *  key,
char *  value 
)

Select the message subset with key==value.

The value is a string. The key must have been created with string type or have string as native type if the type was not explicitly defined in the index creation.

Parameters:
index : an index created from a file. The index must have been created with the key in argument.
key : key to be selected
value : value of the key to select
Returns:
0 if OK, integer value on error


Generated on Tue Sep 22 15:18:22 2009 for grib_api by  doxygen 1.5.3