Intermediate representation of parsed values, ordered according to a BUFR or CREX message template. More...
#include <dballe/core/var.h>
#include <dballe/core/rawmsg.h>
#include <dballe/bufrex/dtable.h>
#include <dballe/bufrex/subset.h>
Go to the source code of this file.
Data Structures | |
struct | _bufrex_bufr_info |
BUFR-specific encoding options. More... | |
struct | _bufrex_crex_info |
CREX-specific encoding options. More... | |
struct | _bufrex_msg |
Storage for the decoded data of a BUFR or CREX message. More... | |
Typedefs | |
typedef enum _bufrex_type | bufrex_type |
typedef struct _bufrex_msg * | bufrex_msg |
Enumerations | |
enum | _bufrex_type { BUFREX_BUFR, BUFREX_CREX } |
Encoding type (BUFR or CREX) More... | |
Functions | |
dba_err | bufrex_msg_create (bufrex_type type, bufrex_msg *msg) |
Create a bufrex_msg. | |
void | bufrex_msg_delete (bufrex_msg msg) |
Delete a bufrex_msg. | |
void | bufrex_msg_reset (bufrex_msg msg) |
Delete all the contents of a bufrex_msg. | |
dba_err | bufrex_msg_get_subset (bufrex_msg msg, int subsection, bufrex_subset *vars) |
Get a dba_subset item from the message. | |
dba_err | bufrex_msg_get_table_id (bufrex_msg msg, const char **id) |
Get the ID of the table used by this bufrex_msg. | |
dba_err | bufrex_msg_load_tables (bufrex_msg msg) |
Load a new set of tables to use for encoding this message. | |
dba_err | bufrex_msg_query_btable (bufrex_msg msg, dba_varcode code, dba_varinfo *info) |
Query the WMO B table used for this BUFR/CREX data. | |
dba_err | bufrex_msg_query_dtable (bufrex_msg msg, dba_varcode code, struct _bufrex_opcode **res) |
Query the WMO D table used for this BUFR/CREX data. | |
void | bufrex_msg_reset_datadesc (bufrex_msg msg) |
Reset the data descriptor section for the message. | |
void | bufrex_msg_reset_sections (bufrex_msg msg) |
Remove all sections from the message. | |
dba_err | bufrex_msg_get_datadesc (bufrex_msg msg, struct _bufrex_opcode **res) |
Get the data descriptor section of this bufrex_msg. | |
dba_err | bufrex_msg_append_datadesc (bufrex_msg msg, dba_varcode varcode) |
Append one dba_varcode to the data descriptor section of the message. | |
dba_err | bufrex_msg_generate_datadesc (bufrex_msg msg) |
Try to generate a data description section by scanning the variable codes of the variables in the first data subset. | |
dba_err | bufrex_msg_decode_header (bufrex_msg msg, dba_rawmsg raw) |
Parse only the header of an encoded message into a bufrex_msg. | |
dba_err | bufrex_msg_decode (bufrex_msg msg, dba_rawmsg raw) |
Parse an encoded message into a bufrex_msg. | |
dba_err | bufrex_msg_encode (bufrex_msg msg, dba_rawmsg *raw) |
Encode the contents of the bufrex_msg. | |
dba_err | bufr_encoder_encode (bufrex_msg in, dba_rawmsg out) |
Encode a BUFR message. | |
dba_err | bufr_decoder_decode_header (dba_rawmsg in, bufrex_msg out) |
Decode only the header of a BUFR message. | |
dba_err | bufr_decoder_decode (dba_rawmsg in, bufrex_msg out) |
Decode a BUFR message. | |
dba_err | crex_encoder_encode (bufrex_msg in, dba_rawmsg out) |
Encode a CREX message. | |
dba_err | crex_decoder_decode (dba_rawmsg in, bufrex_msg out) |
Decode a CREX message. | |
dba_err | crex_decoder_decode_header (dba_rawmsg in, bufrex_msg out) |
Decode only the header of a CREX message. | |
void | bufrex_msg_print (bufrex_msg msg, FILE *out) |
Dump the contents of this bufrex_msg. | |
void | bufrex_msg_diff (bufrex_msg msg1, bufrex_msg msg2, int *diffs, FILE *out) |
Compute the differences between two bufrex_msg. | |
dba_err | bufrex_msg_parse_template (const char *str, int *cat, int *subcat, int *localsubcat) |
Parse a string containing a bufr/crex template selector. |
Intermediate representation of parsed values, ordered according to a BUFR or CREX message template.
typedef struct _bufrex_msg* bufrex_msg |
Storage for the decoded data of a BUFR or CREX message.
typedef enum _bufrex_type bufrex_type |
Encoding type (BUFR or CREX)
enum _bufrex_type |
dba_err bufr_decoder_decode | ( | dba_rawmsg | in, |
bufrex_msg | out | ||
) |
Decode a BUFR message.
in | The dba_msgraw with the data to decode |
out | The bufrex_msg that will hold the decoded data |
References DBA_RUN_OR_GOTO, and TRACE.
dba_err bufr_decoder_decode_header | ( | dba_rawmsg | in, |
bufrex_msg | out | ||
) |
Decode only the header of a BUFR message.
in | The dba_msgraw with the data to decode |
out | The bufrex_msg that will hold the decoded header data |
References DBA_RUN_OR_GOTO, and TRACE.
dba_err bufr_encoder_encode | ( | bufrex_msg | in, |
dba_rawmsg | out | ||
) |
Encode a BUFR message.
in | The bufrex_msg with the data to encode |
out | The dba_rawmsg that will hold the encoded data |
References bufrex_msg_get_datadesc(), dba_error_consistency, DBA_RUN_OR_GOTO, DBA_RUN_OR_RETURN, _bufrex_opcode::next, TRACE, _bufrex_opcode::val, _bufrex_subset::vars, and _bufrex_subset::vars_count.
dba_err bufrex_msg_append_datadesc | ( | bufrex_msg | msg, |
dba_varcode | varcode | ||
) |
Append one dba_varcode to the data descriptor section of the message.
msg | The message to act on |
varcode | The dba_varcode to append. See vartable.h |
References _bufrex_msg::datadesc_last, and DBA_RUN_OR_RETURN.
dba_err bufrex_msg_create | ( | bufrex_type | type, |
bufrex_msg * | msg | ||
) |
Create a bufrex_msg.
type | Message type (BUFR or CREX) |
msg | Newly created bufrex_msg |
void bufrex_msg_delete | ( | bufrex_msg | msg ) |
Delete a bufrex_msg.
msg | The bufrex_msg to delete |
References _bufrex_msg::subsets, and _bufrex_msg::subsets_alloclen.
dba_err bufrex_msg_generate_datadesc | ( | bufrex_msg | msg ) |
Try to generate a data description section by scanning the variable codes of the variables in the first data subset.
msg | The message to act on |
References dba_error_consistency, dba_error_unimplemented, DBA_RUN_OR_RETURN, DBA_VAR_X, _bufrex_msg::subsets, _bufrex_msg::subsets_count, _bufrex_subset::vars, and _bufrex_subset::vars_count.
dba_err bufrex_msg_get_datadesc | ( | bufrex_msg | msg, |
struct _bufrex_opcode ** | res | ||
) |
Get the data descriptor section of this bufrex_msg.
msg | The message to act on |
res | A copy of the internal list of data descriptors for the data descriptor section. It must be deallocated by the caller using bufrex_opcode_delete() |
Referenced by bufr_encoder_encode(), and crex_encoder_encode().
dba_err bufrex_msg_get_subset | ( | bufrex_msg | msg, |
int | subsection, | ||
bufrex_subset * | vars | ||
) |
Get a dba_subset item from the message.
The subset will be created if it does not exist.
msg | The bufrex_msg to query |
subsection | The subsection index (starting from 0) |
vars | The subsection requested. It can be newly created if the message did not contain such a subsection before, but memory management is handled by the bufrex_msg structure. |
References _bufrex_msg::btable, DBA_RUN_OR_RETURN, _bufrex_msg::subsets, _bufrex_msg::subsets_alloclen, and _bufrex_msg::subsets_count.
dba_err bufrex_msg_get_table_id | ( | bufrex_msg | msg, |
const char ** | id | ||
) |
Get the ID of the table used by this bufrex_msg.
id | The table id, as a pointer to an internal string. It must not be deallocated by the caller. It is set to NULL when no table has been set. |
References _bufrex_msg::btable.
dba_err bufrex_msg_parse_template | ( | const char * | str, |
int * | cat, | ||
int * | subcat, | ||
int * | localsubcat | ||
) |
Parse a string containing a bufr/crex template selector.
The string can be 3 numbers separated by dots (type.subtype.localsubtype) or an alias among those listed in template-aliases.txt
str | The string to parse |
cat | The parsed message category |
subcat | The parsed message subcategory |
localsubcat | The parsed local category |
References bufrex_msg_parse_template(), and dba_error_consistency.
Referenced by bufrex_msg_parse_template().
dba_err bufrex_msg_query_btable | ( | bufrex_msg | msg, |
dba_varcode | code, | ||
dba_varinfo * | info | ||
) |
Query the WMO B table used for this BUFR/CREX data.
msg | bufrex_msg to query |
code | code of the variable to query. See vartable.h |
info | the dba_varinfo structure with the results of the query. The returned dba_varinfo needs to be deallocated using dba_varinfo_delete() |
References _bufrex_msg::btable.
dba_err bufrex_msg_query_dtable | ( | bufrex_msg | msg, |
dba_varcode | code, | ||
struct _bufrex_opcode ** | res | ||
) |
Query the WMO D table used for this BUFR/CREX data.
msg | bufrex_msg to query |
code | code of the entry to query. See vartable.h |
res | the bufrex_opcode chain that contains the expansion elements (must be deallocated by the caller using bufrex_opcode_delete) |
References _bufrex_msg::dtable.
void bufrex_msg_reset | ( | bufrex_msg | msg ) |
Delete all the contents of a bufrex_msg.
This can be used to reuse the structure to encode/decode more than one message.
msg | The bufrex_msg to reset |
References BUFREX_BUFR, _bufrex_msg::encoding_type, _bufrex_bufr_info::optional_section, _bufrex_msg::subtype, and _bufrex_msg::type.
void bufrex_msg_reset_datadesc | ( | bufrex_msg | msg ) |
Reset the data descriptor section for the message.
msg | The message to act on |
References _bufrex_msg::datadesc, and _bufrex_msg::datadesc_last.
void bufrex_msg_reset_sections | ( | bufrex_msg | msg ) |
Remove all sections from the message.
This can be used to start a new message keeping the previous data section
msg | The message to act on |
References _bufrex_msg::subsets, and _bufrex_msg::subsets_count.
dba_err crex_decoder_decode | ( | dba_rawmsg | in, |
bufrex_msg | out | ||
) |
Decode a CREX message.
in | The dba_msgraw with the data to decode |
out | The bufrex_msg that will hold the decoded data |
References _dba_rawmsg::buf, DBA_RUN_OR_GOTO, and TRACE.
dba_err crex_decoder_decode_header | ( | dba_rawmsg | in, |
bufrex_msg | out | ||
) |
Decode only the header of a CREX message.
in | The dba_msgraw with the data to decode |
out | The bufrex_msg that will hold the decoded data |
References _dba_rawmsg::buf, DBA_RUN_OR_GOTO, and TRACE.
dba_err crex_encoder_encode | ( | bufrex_msg | in, |
dba_rawmsg | out | ||
) |
Encode a CREX message.
in | The bufrex_msg with the data to encode |
out | The dba_rawmsg that will hold the encoded data |
References bufrex_msg_get_datadesc(), dba_error_consistency, DBA_RUN_OR_GOTO, DBA_RUN_OR_RETURN, DBA_VAR_F, DBA_VAR_X, DBA_VAR_Y, _bufrex_opcode::next, _bufrex_msg::subsets_count, TRACE, and _bufrex_opcode::val.