subset.h File Reference


Detailed Description

Handling of a BUFR/CREX data subset as a list of decoded variables.

#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_subsetbufrex_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.


Typedef Documentation

typedef struct _bufrex_subset* bufrex_subset

Represent a BUFR/CREX data subset as a list of decoded variables.


Function Documentation

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.

Parameters:
subset The message to operate on
attr The attribute to copy in the last variable
Returns:
The error indicator for the function. See error.h

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.

Parameters:
subset The message to operate on
var The variable with the attributes to copy
Returns:
The error indicator for the function. See error.h

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.

Parameters:
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
Returns:
The error indicator for the function. See error.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.

Parameters:
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
Returns:
The error indicator for the function. See error.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.

Parameters:
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
Returns:
The error indicator for the function. See error.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.

Parameters:
subset The message to operate on
size The size of the bitmap
Returns:
The error indicator for the function. See error.h

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.

Parameters:
subset The message to operate on
Returns:
The error indicator for the function. See error.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_create ( dba_vartable  btable,
bufrex_subset subset 
)

Create a new BUFR/CREX subset.

Parameters:
btable Reference to the B table to use to create variables.
Return values:
subset The newly created bufrex_subset.
Returns:
The error indicator for the function. See dba_err.

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.

Parameters:
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.
Returns:
The error indicator for the function. See error.h

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.

Parameters:
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
Returns:
The error indicator for the function. See error.h

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.

Parameters:
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
Returns:
The error indicator for the function. See error.h

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.

Parameters:
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
Returns:
The error indicator for the function. See error.h

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.

Parameters:
subset The message that will hold the variable
code The dba_varcode of the variable to add. See vartable.h
Returns:
The error indicator for the function. See error.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.

Parameters:
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.
Returns:
The error indicator for the function. See error.h

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.


Generated on Fri Aug 1 15:22:54 2008 for libdballe by  doxygen 1.5.6