The grib_handle


Typedefs

typedef struct grib_handle grib_handle

Functions

int grib_count_messages (grib_context *c, FILE *f, int *n)
 Counts the messages contained in a file resource.
grib_handlegrib_handle_new_from_file (grib_context *c, FILE *f, int *error)
 Create a handle from a file resource.
grib_handlegrib_handle_new_from_message (grib_context *c, void *data, size_t data_len)
 Create a handle from a user message.
grib_handlegrib_handle_new_from_message_copy (grib_context *c, const void *data, size_t data_len)
 Create a handle from a user message.
grib_handlegrib_handle_new_from_template (grib_context *c, const char *res_name)
 Create a handle from a read_only template resource.
grib_handlegrib_handle_clone (grib_handle *h)
 Clone an existing handle using the context of the original handle, The message is copied and reparsed.
int grib_handle_delete (grib_handle *h)
 Frees a handle, also frees the message if it is not a user message.

Detailed Description

The grib_handle is the structure giving access to parsed grib values by keys.

Typedef Documentation

typedef struct grib_handle grib_handle

Grib handle, structure giving access to parsed grib values by keys

Examples:
get.c, iterator.c, keys_iterator.c, multi.c, nearest.c, precision.c, print_data.c, and set.c.


Function Documentation

int grib_count_messages ( grib_context c,
FILE *  f,
int *  n 
)

Counts the messages contained in a file resource.

Parameters:
c : the context from wich the handle will be created (NULL for default context)
f : the file resource
n : the number of messages in the file
Returns:
0 if OK, integer value on error

grib_handle* grib_handle_clone ( grib_handle h  ) 

Clone an existing handle using the context of the original handle, The message is copied and reparsed.

Parameters:
h : The handle to be cloned
Returns:
the new handle, NULL if the message is invalid or a problem is encountered

int grib_handle_delete ( grib_handle h  ) 

Frees a handle, also frees the message if it is not a user message.

See also:
grib_handle_new_from_message
Parameters:
h : The handle to be deleted
Returns:
0 if OK, integer value on error
Examples:
get.c, iterator.c, multi.c, nearest.c, precision.c, print_data.c, and set.c.

grib_handle* grib_handle_new_from_file ( grib_context c,
FILE *  f,
int *  error 
)

Create a handle from a file resource.

The file is read until a message is found. The message is then copied. Remember always to delete the handle when it is not needed any more to avoid memory leaks.

Parameters:
c : the context from wich the handle will be created (NULL for default context)
f : the file resource
error : error code set if the returned handle is NULL and the end of file is not reached
Returns:
the new handle, NULL if the resource is invalid or a problem is encountered
Examples:
get.c, iterator.c, keys_iterator.c, multi.c, precision.c, print_data.c, and set.c.

grib_handle* grib_handle_new_from_message ( grib_context c,
void *  data,
size_t  data_len 
)

Create a handle from a user message.

The message will not be freed at the end. The message will be copied as soon as a modification is needed.

Parameters:
c : the context from which the handle will be created (NULL for default context)
data : the actual message
data_len : the length of the message in number of bytes
Returns:
the new handle, NULL if the message is invalid or a problem is encountered

grib_handle* grib_handle_new_from_message_copy ( grib_context c,
const void *  data,
size_t  data_len 
)

Create a handle from a user message.

The message is copied and will be freed with the handle

Parameters:
c : the context from wich the handle will be created (NULL for default context)
data : the actual message
data_len : the length of the message in number of bytes
Returns:
the new handle, NULL if the message is invalid or a problem is encountered

grib_handle* grib_handle_new_from_template ( grib_context c,
const char *  res_name 
)

Create a handle from a read_only template resource.

The message is copied at the creation of the handle

Parameters:
c : the context from wich the handle will be created (NULL for default context)
res_name : the resource name
Returns:
the new handle, NULL if the resource is invalid or a problem is encountered


Generated on Tue Jul 8 10:17:28 2008 for grib_api by  doxygen 1.5.4