Basic functions for decoding from BUFR


Functions

int bufr_read_file (bufr_t *msg, char *file)
 This functions reads the encoded BUFR-message to a binary file.
int bufr_get_sections (char *bm, int len, bufr_t *msg)
 Calculates the section length of a BUFR message and allocates memory for each section.
int bufr_decode_sections01 (sect_1_t *s1, bufr_t *msg)
 This function decodes sections 0 and 1.
int bufr_read_msg (void *datasec, void *ddsec, size_t datasecl, size_t ddescl, dd **descr, int *ndescs, varfl **vals, size_t *nvals)
 Decode BUFR data and descriptor section and write values and descriptors to arrays.

Function Documentation

int bufr_read_file ( bufr_t msg,
char *  file 
)

This function reads the encoded BUFR message from a binary file, calculates the section length and writes each section to a memory block. Memory for the sections is allocated by this function and must be freed by the calling function using bufr_free_data.

Parameters:
[in] msg The complete BUFR message
[in] file The filename of the binary file
Returns:
1 on success, 0 on error
See also:
bufr_write_file

Definition at line 369 of file bufr.c.

int bufr_get_sections ( char *  bm,
int  len,
bufr_t msg 
)

This function calculates the sections length of a BUFR message and allocates memory for each section. The memory has to be freed by the calling function using bufr_free_data.

Parameters:
[in] bm Pointer to the memory where the raw BUFR message is stored
[in] len Length of bm
[in,out] msg The BUFR message containing the single sections and section length
Returns:
Returns the length of the complete BUFR message or 0 on error.
See also:
bufr_free_data, bufr_read_file

Definition at line 437 of file bufr.c.

int bufr_decode_sections01 ( sect_1_t s1,
bufr_t msg 
)

This function decodes sections 0 and 1 of a BUFR message. The BUFR edition is read from section 0 and is written to the global _bufr_edition parameter.

Parameters:
[in,out] s1 sect_1_t structure to contain section 1 data
[in] msg BUFR message where the sections are stored.
Returns:
1 on success, 0 on error.
Examples:
apisample.c.

Definition at line 1495 of file bufr.c.

int bufr_read_msg ( void *  datasec,
void *  ddsec,
size_t  datasecl,
size_t  ddescl,
dd **  descr,
int *  ndescs,
varfl **  vals,
size_t *  nvals 
)

This function decodes the data and descriptor sections of a BUFR message and stored them into arrays descr and vals. Memory for storing descriptor- and data-array is allocated by this function and has to be freed by the calling function.

Parameters:
[in] datasec Is where the data-section is stored.
[in] ddsec Is where the data-descriptor-section is stored.
[in] datasecl Number of bytes of the data-section.
[in] ddescl Number of bytes of the data-descriptor-section.
[out] descr Array where the data-descriptors are stored after reading them from the data-descriptor section. This memory area is allocated by this function and has to be freed by the calling function.
[out] ndescs Number of data-descriptors in descs
[out] vals Array where the data corresponding to the data-descriptors is stored.
[out] nvals Number of values in vals
Returns:
1 if both sections were decoded successfuly, 0 on error
See also:
bufr_create_msg, bufr_data_to_file

Definition at line 1645 of file bufr.c.


Generated on Tue Dec 18 16:52:45 2007 for OPERA BUFR software by  doxygen 1.5.4