context.h File Reference

Sorted storage for all the dba_msg_datum present on one level. More...

#include <dballe/msg/msg.h>
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  _dba_msg_context
 Store an array of physical data all on the same level. More...

Functions

dba_err dba_msg_context_create (int ltype1, int l1, int ltype2, int l2, int pind, int p1, int p2, dba_msg_context *l)
 Create a new dba_msg_context.
dba_err dba_msg_context_copy (dba_msg_context src, dba_msg_context *dst)
 Copy an existing level.
void dba_msg_context_delete (dba_msg_context l)
 Delete a dba_msg_context.
int dba_msg_context_compare (const dba_msg_context l1, const dba_msg_context l2)
 Compare two dba_msg_context strutures, for use in sorting.
int dba_msg_context_compare2 (const dba_msg_context l, int ltype1, int l1, int ltype2, int l2, int pind, int p1, int p2)
 Compare a dba_msg_context struture with some level information, for use in sorting.
dba_err dba_msg_context_set_nocopy (dba_msg_context l, dba_var var)
 Add a dba_var to the level, taking over its memory management.
dba_var dba_msg_context_find (dba_msg_context l, dba_varcode code)
 Find a datum given its description.
dba_var dba_msg_context_find_by_id (dba_msg_context l, int id)
 Find a datum given its shortcut ID.
dba_var dba_msg_context_find_vsig (dba_msg_context l)
 If this context is the right context for a vertical sounding significance and contains a vertical sounding significance variable, return it.
void dba_msg_context_print (dba_msg_context l, FILE *out)
 Dump all the contents of the level to the given stream.
void dba_msg_context_diff (dba_msg_context l1, dba_msg_context l2, int *diffs, FILE *out)
 Print the differences between two dba_msg_context to a stream.
dba_err dba_msg_context_lua_push (dba_msg_context var, struct lua_State *L)
 Push the variable as an object in the lua stack.
dba_msg_context dba_msg_context_lua_check (struct lua_State *L, int idx)
 Check that the element at idx is a dba_msg_context.

Detailed Description

Sorted storage for all the dba_msg_datum present on one level.


Function Documentation

int dba_msg_context_compare ( const dba_msg_context  l1,
const dba_msg_context  l2 
)

Compare two dba_msg_context strutures, for use in sorting.

Parameters:
l1 First dba_msg_context to compare
l2 Second dba_msg_context to compare
Returns:
-1 if l1 < l2, 0 if l1 == l2, 1 if l1 > l2

References _dba_msg_context::l1, _dba_msg_context::l2, _dba_msg_context::ltype1, _dba_msg_context::ltype2, _dba_msg_context::p1, _dba_msg_context::p2, and _dba_msg_context::pind.

int dba_msg_context_compare2 ( const dba_msg_context  l,
int  ltype1,
int  l1,
int  ltype2,
int  l2,
int  pind,
int  p1,
int  p2 
)

Compare a dba_msg_context struture with some level information, for use in sorting.

Parameters:
l First dba_msg_context to compare
ltype Type of the level. See Level type values.
l1 L1 value of the level. See Level type values.
l2 L2 value of the level. See Level type values.
pind Time range type indicator. See Time range values.
p1 Time range P1 indicator. See Time range values.
p2 Time range P2 indicator. See Time range values.
Returns:
-1 if l < ltype,l1,l2; 0 if l == ltype,l1,l2; 1 if l > ltype,l1,l2

References _dba_msg_context::l1, _dba_msg_context::l2, _dba_msg_context::ltype1, _dba_msg_context::ltype2, _dba_msg_context::p1, _dba_msg_context::p2, and _dba_msg_context::pind.

dba_err dba_msg_context_copy ( dba_msg_context  src,
dba_msg_context dst 
)

Copy an existing level.

Parameters:
src The level to copy.
Return values:
dst The newly created duplicate.
Returns:
The error indicator for the function (See error.h)

References _dba_msg_context::data, _dba_msg_context::data_count, DBA_RUN_OR_GOTO, DBA_RUN_OR_RETURN, _dba_msg_context::l1, _dba_msg_context::l2, _dba_msg_context::ltype1, _dba_msg_context::ltype2, _dba_msg_context::p1, _dba_msg_context::p2, and _dba_msg_context::pind.

dba_err dba_msg_context_create ( int  ltype1,
int  l1,
int  ltype2,
int  l2,
int  pind,
int  p1,
int  p2,
dba_msg_context l 
)

Create a new dba_msg_context.

Return values:
l The newly created level.
Returns:
The error indicator for the function (See error.h)

References _dba_msg_context::data, _dba_msg_context::data_alloc, _dba_msg_context::data_count, _dba_msg_context::l1, _dba_msg_context::l2, _dba_msg_context::ltype1, _dba_msg_context::ltype2, _dba_msg_context::p1, _dba_msg_context::p2, and _dba_msg_context::pind.

void dba_msg_context_delete ( dba_msg_context  l  ) 

Delete a dba_msg_context.

Parameters:
l The level to delete.

References _dba_msg_context::data, _dba_msg_context::data_alloc, and _dba_msg_context::data_count.

void dba_msg_context_diff ( dba_msg_context  l1,
dba_msg_context  l2,
int *  diffs,
FILE *  out 
)

Print the differences between two dba_msg_context to a stream.

Parameters:
l1 First level to compare
l2 Second level to compare
Return values:
diffs Integer variable that will be incremented by the number of differences found.
Parameters:
out The stream to dump a description of the differences to.

References _dba_msg_context::data, _dba_msg_context::data_count, _dba_msg_context::l1, _dba_msg_context::l2, _dba_msg_context::ltype1, _dba_msg_context::ltype2, _dba_msg_context::p1, _dba_msg_context::p2, and _dba_msg_context::pind.

dba_var dba_msg_context_find ( dba_msg_context  l,
dba_varcode  code 
)

Find a datum given its description.

Parameters:
l The level to query
code The dba_varcode of the variable to query. See vartable.h
Returns:
The variable found, or NULL if it was not found.

References _dba_msg_context::data.

dba_var dba_msg_context_find_by_id ( dba_msg_context  l,
int  id 
)

Find a datum given its shortcut ID.

Parameters:
l The level to query
id Shortcut ID of the value to set (see vars.h)
Returns:
The variable found, or NULL if it was not found.
dba_var dba_msg_context_find_vsig ( dba_msg_context  l  ) 

If this context is the right context for a vertical sounding significance and contains a vertical sounding significance variable, return it.

Else, return NULL.

References DBA_VAR, _dba_msg_context::ltype1, _dba_msg_context::p1, _dba_msg_context::p2, and _dba_msg_context::pind.

dba_msg_context dba_msg_context_lua_check ( struct lua_State *  L,
int  idx 
)

Check that the element at idx is a dba_msg_context.

Returns:
the dba_msg_context element, or NULL if the check failed

References dba_error_unimplemented, and dba_msg_context_lua_check().

Referenced by dba_msg_context_lua_check().

void dba_msg_context_print ( dba_msg_context  l,
FILE *  out 
)

Dump all the contents of the level to the given stream.

Parameters:
l The level to dump
out The stream to dump the contents of the level to.

References _dba_msg_context::data, _dba_msg_context::data_count, _dba_msg_context::l1, _dba_msg_context::l2, _dba_msg_context::ltype1, _dba_msg_context::ltype2, _dba_msg_context::p1, _dba_msg_context::p2, and _dba_msg_context::pind.

dba_err dba_msg_context_set_nocopy ( dba_msg_context  l,
dba_var  var 
)

Add a dba_var to the level, taking over its memory management.

Parameters:
l The level to add the variable to.
var The variable to add.
Returns:
The error indicator for the function (See error.h)

References _dba_msg_context::data, _dba_msg_context::data_alloc, _dba_msg_context::data_count, and DBA_RUN_OR_RETURN.

Generated on Sun Jun 13 22:26:29 2010 for libdballe by  doxygen 1.6.3