BUFR utility functions


Functions

int bufr_parse_new (dd *descs, int start, int end, int(*inputfkt)(varfl *val, int ind), int(*outputfkt)(varfl val, int ind), int callback_all_descs)
 Parse data descriptors and call user defined functions for each data element or for each descriptor.
int bufr_parse (dd *descs, int start, int end, varfl *vals, unsigned *vali, int(*userfkt)(varfl val, int ind))
 Parse data descriptors and call user-function for each element.
void bufr_free_data (bufr_t *msg)
 Frees memory allocated for a BUFR message.
int bufr_check_fxy (dd *d, int ff, int xx, int yy)
 Tests equality of descriptor d with (f,x,y).
int bufr_val_to_array (varfl **vals, varfl v, int *nv)
 Store a value to an array of floats.
int bufr_desc_to_array (dd *descs, dd d, int *ndescs)
 Store a descriptor to an array.
void bufr_get_date_time (long *year, long *mon, long *day, long *hour, long *min)
 Recall date/time info of the last BUFR-message created.

Function Documentation

int bufr_parse_new ( dd descs,
int  start,
int  end,
int(*)(varfl *val, int ind)  inputfkt,
int(*)(varfl val, int ind)  outputfkt,
int  callback_all_descs 
)

This function, a more general version of bufr_parse, parses a descriptor or a sequence of descriptors and calls the user defined functions inputfkt and outputfkt for each data-value corresponding to an element descriptor. In case of CCITT (ASCII) data it calls the user-functions for each character of the string.

Data values are read using the user-defined function inputfkt and wrote out using outputfkt.

Optionally the user-defined functions are called for all descriptors, including sequence descriptors and data modification descriptors.

Parameters:
[in] descs Pointer to the data-descriptors.
[in] start First data-descriptor for output.
[in] end Last data-descriptor for output.
[in] inputfkt User defined input function to be called for each data-element or descriptor
[in] outputfkt User defined ouput function to be called for each data-element or descriptor
[in] callback_all_descs Flag that indictes when the user-functions are to be called:
0 for normal behaviour (call user-functions for each element descriptor and each CCITT character)
1 for extended behaviour (call both user-functions also for sequence descriptors and CCITT descriptors,
call outputfkt also for replication descriptors and data modification descriptors.)
Returns:
The function returns 1 on success, 0 on error.
See also:
bufr_parse, bufr_parse_in, bufr_parse_out, Callback functions for encoding to BUFR, Callback functions for decoding from BUFR

Definition at line 735 of file bufr.c.

int bufr_parse ( dd descs,
int  start,
int  end,
varfl vals,
unsigned *  vali,
int(*)(varfl val, int ind)  userfkt 
)

This function parses a descriptor or a sequence of descriptors and calls the user defined function userfkt for each data-value corresponding to an element descriptor. In case of CCITT (ASCII) data it calls userfkt for each character of the string.

Data values are read from an array of floats stored at vals.

Parameters:
[in] descs Pointer to the data-descriptors.
[in] start First data-descriptor for output.
[in] end Last data-descriptor for output.
[in] vals Pointer to an array of values.
[in,out] vali Index for the array vals that identifies the values to be used for output. vali is increased after data-output.
[in] userfkt User-function to be called for each data-element
Returns:
The function returns 1 on success, 0 if there was an error outputing to the bitstreams.

Definition at line 1052 of file bufr.c.

void bufr_free_data ( bufr_t msg  ) 

This function frees all memory allocated for a BUFR message by bufr_data_from_file, bufr_encode_sections0125, bufr_read_file or bufr_get_sections.

Parameters:
[in] msg The encoded BUFR message
Examples:
apisample.c.

Definition at line 1445 of file bufr.c.

int bufr_check_fxy ( dd d,
int  ff,
int  xx,
int  yy 
)

This functions tests wheter a descriptor equals the given values f, x, y

Parameters:
[in] d The descriptor to be tested
[in] ff,xx,yy The values for testing
Return values:
1 If the descriptor equals the given values
0 If the descriptor is different to the given values
Examples:
apisample.c.

Definition at line 1473 of file bufr.c.

int bufr_val_to_array ( varfl **  vals,
varfl  v,
int *  nv 
)

This function stores the value v to an array of floats vals. The memory-block for vals is allocated in this function and has to be freed by the calling function. The number of values is used to calculate the size of the array and reallocate memory if necessary.

Parameters:
[in,out] vals The array containing the values
[in] v The value to be put into the array
[in,out] nv Current number of values in the array
Returns:
1 on success, 0 on error.

Definition at line 1894 of file bufr.c.

int bufr_desc_to_array ( dd descs,
dd  d,
int *  ndescs 
)

This function stores the descriptor d to an array of descriptors descs. The array descs must be large enough to hold ndescs + 1 descriptors.

Parameters:
[in] descs The array containing the descriptors
[in] d The descriptor to be put into the array
[in,out] ndescs Current number of descriptors in the array
Returns:
1 on success, 0 on error.

Definition at line 1943 of file bufr.c.

void bufr_get_date_time ( long *  year,
long *  mon,
long *  day,
long *  hour,
long *  min 
)

This function can be called to recall the data/time-info of the last BUFR-message created, if the appropiate data descriptors have been used.

Parameters:
[out] year 4 digit year if _bufr_edition is set to 4, year of century (2 digit) if _bufr_edition is < 4.
[out] mon Month (1 - 12)
[out] day (1 - 31)
[out] hour 
[out] min 
Examples:
apisample.c.

Definition at line 2000 of file bufr.c.


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