Handling of a BUFR/CREX data subset as a list of decoded variables. More...
#include <dballe/core/var.h>
#include <dballe/bufrex/dtable.h>
Go to the source code of this file.
Data Structures | |
struct | _bufrex_subset |
Represent a BUFR/CREX data subset as a list of decoded variables. More... | |
Typedefs | |
typedef struct _bufrex_subset * | bufrex_subset |
Functions | |
dba_err | bufrex_subset_create (dba_vartable btable, bufrex_subset *subset) |
Create a new BUFR/CREX subset. | |
void | bufrex_subset_delete (bufrex_subset subset) |
Deallocate a bufrex_subset. | |
void | bufrex_subset_reset (bufrex_subset subset) |
Clear the subset, removing all the variables from it. | |
void | bufrex_subset_truncate (bufrex_subset subset, size_t size) |
Truncate the subset at the given position. | |
dba_err | bufrex_subset_store_variable (bufrex_subset subset, dba_var var) |
Store a decoded variable in the message, to be encoded later. | |
dba_err | bufrex_subset_store_variable_var (bufrex_subset subset, dba_varcode code, dba_var var) |
Store a new variable in the message, copying it from an already existing variable. | |
dba_err | bufrex_subset_store_variable_i (bufrex_subset subset, dba_varcode code, int val) |
Store a new variable in the message, providing its value as an int. | |
dba_err | bufrex_subset_store_variable_d (bufrex_subset subset, dba_varcode code, double val) |
Store a new variable in the message, providing its value as a double. | |
dba_err | bufrex_subset_store_variable_c (bufrex_subset subset, dba_varcode code, const char *val) |
Store a new variable in the message, providing its value as a string. | |
dba_err | bufrex_subset_store_variable_undef (bufrex_subset subset, dba_varcode code) |
Store a new, undefined variable in the message. | |
dba_err | bufrex_subset_add_attr (bufrex_subset subset, dba_var attr) |
Add the attribute 'addr' to the last variable that was previously stored. | |
dba_err | bufrex_subset_add_attrs (bufrex_subset subset, dba_var var) |
Copy all the attributes from 'var' into the last variable that was previously stored. | |
dba_err | bufrex_subset_apply_attributes (bufrex_subset subset) |
Copy decoded variables that are attributes as attributes in the decoded variables they refer to. | |
dba_err | bufrex_subset_append_dpb (bufrex_subset subset, int size, dba_varcode attr) |
Compute and append a data present bitmap. | |
dba_err | bufrex_subset_append_fixed_dpb (bufrex_subset subset, int size) |
Append a fixed-size data present bitmap with all zeros. | |
dba_err | bufrex_subset_append_attrs (bufrex_subset subset, int size, dba_varcode attr) |
Scan the first 'size' variables appending the attribute 'attr' when found. | |
dba_err | bufrex_subset_append_fixed_attrs (bufrex_subset subset, int size, dba_varcode attr) |
Scan the first 'size' variables appending the attribute 'attr' in any case. | |
void | bufrex_subset_diff (bufrex_subset s1, bufrex_subset s2, int *diffs, FILE *out) |
Compute the differences between two bufrex_subsets. |
Handling of a BUFR/CREX data subset as a list of decoded variables.
typedef struct _bufrex_subset* bufrex_subset |
Represent a BUFR/CREX data subset as a list of decoded variables.
dba_err bufrex_subset_add_attr | ( | bufrex_subset | subset, |
dba_var | attr | ||
) |
Add the attribute 'addr' to the last variable that was previously stored.
The attribute is copied into the variable, so memory management of it will still belong to the caller.
subset | The message to operate on |
attr | The attribute to copy in the last variable |
References dba_error_consistency, _bufrex_subset::vars, and _bufrex_subset::vars_count.
dba_err bufrex_subset_add_attrs | ( | bufrex_subset | subset, |
dba_var | var | ||
) |
Copy all the attributes from 'var' into the last variable that was previously stored.
subset | The message to operate on |
var | The variable with the attributes to copy |
References dba_error_consistency, _bufrex_subset::vars, and _bufrex_subset::vars_count.
dba_err bufrex_subset_append_attrs | ( | bufrex_subset | subset, |
int | size, | ||
dba_varcode | attr | ||
) |
Scan the first 'size' variables appending the attribute 'attr' when found.
The delayed replicator factor with the number of attributes found will also be appended before the attributes.
subset | The message to operate on |
size | The number of variables to scan |
attr | The code of the attribute to look for. See vartable.h |
References DBA_RUN_OR_RETURN, DBA_VAR, DBA_VAR_F, _bufrex_subset::vars, and _bufrex_subset::vars_count.
dba_err bufrex_subset_append_dpb | ( | bufrex_subset | subset, |
int | size, | ||
dba_varcode | attr | ||
) |
Compute and append a data present bitmap.
subset | The message to operate on |
size | The size of the bitmap |
attr | The code of the attribute that the bitmap will represent. See vartable.h |
References DBA_RUN_OR_RETURN, DBA_VAR, DBA_VAR_F, DBA_VAR_X, _bufrex_subset::vars, and _bufrex_subset::vars_count.
dba_err bufrex_subset_append_fixed_attrs | ( | bufrex_subset | subset, |
int | size, | ||
dba_varcode | attr | ||
) |
Scan the first 'size' variables appending the attribute 'attr' in any case.
Exactly 'size' attributes will be appended, possibly with value 'undef' when they are not present. No delayed replicator factor is appended.
subset | The message to operate on |
size | The number of variables to scan |
attr | The code of the attribute to look for. See vartable.h |
References DBA_RUN_OR_RETURN, DBA_VAR_F, _bufrex_subset::vars, and _bufrex_subset::vars_count.
dba_err bufrex_subset_append_fixed_dpb | ( | bufrex_subset | subset, |
int | size | ||
) |
Append a fixed-size data present bitmap with all zeros.
subset | The message to operate on |
size | The size of the bitmap |
References DBA_RUN_OR_RETURN, and DBA_VAR.
dba_err bufrex_subset_apply_attributes | ( | bufrex_subset | subset ) |
Copy decoded variables that are attributes as attributes in the decoded variables they refer to.
subset | The message to operate on |
References DBA_RUN_OR_RETURN, DBA_VAR, DBA_VAR_F, DBA_VAR_X, _bufrex_subset::vars, and _bufrex_subset::vars_count.
dba_err bufrex_subset_create | ( | dba_vartable | btable, |
bufrex_subset * | subset | ||
) |
Create a new BUFR/CREX subset.
btable | Reference to the B table to use to create variables. |
subset | The newly created bufrex_subset. |
dba_err bufrex_subset_store_variable | ( | bufrex_subset | subset, |
dba_var | var | ||
) |
Store a decoded variable in the message, to be encoded later.
The function will take ownership of the dba_var, and when the message is destroyed or reset, dba_var_delete() will be called on it.
subset | The message that will hold the variable |
var | The variable to store in the message. The message will take ownership of memory management for the variable, which will be deallocated when the message is deleted or reset. |
References _bufrex_subset::vars, _bufrex_subset::vars_alloclen, and _bufrex_subset::vars_count.
dba_err bufrex_subset_store_variable_c | ( | bufrex_subset | subset, |
dba_varcode | code, | ||
const char * | val | ||
) |
Store a new variable in the message, providing its value as a string.
subset | The message that will hold the variable |
code | The dba_varcode of the variable to add. See vartable.h |
val | The value for the variable |
References _bufrex_subset::btable, and DBA_RUN_OR_RETURN.
dba_err bufrex_subset_store_variable_d | ( | bufrex_subset | subset, |
dba_varcode | code, | ||
double | val | ||
) |
Store a new variable in the message, providing its value as a double.
subset | The message that will hold the variable |
code | The dba_varcode of the variable to add. See vartable.h |
val | The value for the variable |
References _bufrex_subset::btable, and DBA_RUN_OR_RETURN.
dba_err bufrex_subset_store_variable_i | ( | bufrex_subset | subset, |
dba_varcode | code, | ||
int | val | ||
) |
Store a new variable in the message, providing its value as an int.
subset | The message that will hold the variable |
code | The dba_varcode of the variable to add. See vartable.h |
val | The value for the variable |
References _bufrex_subset::btable, and DBA_RUN_OR_RETURN.
dba_err bufrex_subset_store_variable_undef | ( | bufrex_subset | subset, |
dba_varcode | code | ||
) |
Store a new, undefined variable in the message.
subset | The message that will hold the variable |
code | The dba_varcode of the variable to add. See vartable.h |
References _bufrex_subset::btable, and DBA_RUN_OR_RETURN.
dba_err bufrex_subset_store_variable_var | ( | bufrex_subset | subset, |
dba_varcode | code, | ||
dba_var | var | ||
) |
Store a new variable in the message, copying it from an already existing variable.
subset | The message that will hold the variable |
code | The dba_varcode of the variable to add. See vartable.h |
var | The variable holding the value for the variable to add. If it is NULL, the call is equivalent to bufrex_subset_store_variable_undef. |
References _bufrex_subset::btable, and DBA_RUN_OR_RETURN.
void bufrex_subset_truncate | ( | bufrex_subset | subset, |
size_t | size | ||
) |
Truncate the subset at the given position.
All variables beyond the given size will be deleted.
References _bufrex_subset::vars, and _bufrex_subset::vars_count.