libdballe  5.18
Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions
dballe::msg::Context Class Reference

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

#include <context.h>

Public Member Functions

 Context (const Level &lev, const Trange &tr)
 Context (const Context &c)
Contextoperator= (const Context &src)
bool is_station () const
int compare (const Context &ctx) const
 Compare two dba_msg_context strutures, for use in sorting.
int compare (const Level &lev, const Trange &tr) const
 Compare a Context struture with level and time range information, for use in sorting.
void set (const wreport::Var &var)
 Add a Var to the level.
void set (std::auto_ptr< wreport::Var > var)
 Add a Var to the level.
const wreport::Var * find (wreport::Varcode code) const
 Find a variable given its varcode.
wreport::Var * edit (wreport::Varcode code)
 Find a variable given its varcode.
bool remove (wreport::Varcode code)
 Remove a variable given its varcode.
const wreport::Var * find_by_id (int id) const
 Find a variable given its shortcut ID.
const wreport::Var * find_vsig () const
 If this context is the right context for a vertical sounding significance and contains a vertical sounding significance variable, return it.
void print (FILE *out) const
 Dump all the contents of the context to the given stream.
unsigned diff (const Context &ctx) const
 Compute the differences between two contexts.
void lua_push (struct lua_State *L)
 Push the variable as an object in the lua stack.

Static Public Member Functions

static Contextlua_check (struct lua_State *L, int idx)
 Check that the element at idx is a dba_msg_context.

Data Fields

Level level
Trange trange
std::vector< wreport::Var * > data
 The variables in this context.

Protected Member Functions

int find_index (wreport::Varcode code) const
 Return the index of the var `code' in l, or -1 if it was not found.

Detailed Description

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


Member Function Documentation

int dballe::msg::Context::compare ( const Context ctx) const

Compare two dba_msg_context strutures, for use in sorting.

Parameters:
ctxFirst context to compare
Returns:
-1 if l1 < l2, 0 if l1 == l2, 1 if l1 > l2
int dballe::msg::Context::compare ( const Level lev,
const Trange tr 
) const

Compare a Context struture with level and time range information, for use in sorting.

Returns:
-1 if l < ltype,l1,l2; 0 if l == ltype,l1,l2; 1 if l > ltype,l1,l2
unsigned dballe::msg::Context::diff ( const Context ctx) const

Compute the differences between two contexts.

Details of the differences found will be formatted using the notes system (

See also:
notes.h).
Parameters:
ctxContext to compare with this one
Returns:
The number of differences found
wreport::Var* dballe::msg::Context::edit ( wreport::Varcode  code)

Find a variable given its varcode.

Parameters:
codeThe wreport::Varcode of the variable to query. See vartable::h
Returns:
The variable found, or NULL if it was not found.
const wreport::Var* dballe::msg::Context::find ( wreport::Varcode  code) const

Find a variable given its varcode.

Parameters:
codeThe wreport::Varcode of the variable to query. See vartable::h
Returns:
The variable found, or NULL if it was not found.
const wreport::Var* dballe::msg::Context::find_by_id ( int  id) const

Find a variable given its shortcut ID.

Parameters:
idShortcut ID of the value to set (see vars.h)
Returns:
The variable found, or NULL if it was not found.
const wreport::Var* dballe::msg::Context::find_vsig ( ) const

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

Else, return NULL.

Returns:
true if this is the station context, else false
static Context* dballe::msg::Context::lua_check ( struct lua_State *  L,
int  idx 
) [static]

Check that the element at idx is a dba_msg_context.

Returns:
the dba_msg_context element, or NULL if the check failed
void dballe::msg::Context::print ( FILE *  out) const

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

Parameters:
outThe stream to dump the contents of the level to.
bool dballe::msg::Context::remove ( wreport::Varcode  code)

Remove a variable given its varcode.

Parameters:
codeThe wreport::Varcode of the variable to query. See vartable::h
Returns:
The variable removed, or NULL if it was not found.
void dballe::msg::Context::set ( const wreport::Var &  var)

Add a Var to the level.

If a variable exists with the same code, it is replaced

Parameters:
varThe variable to add or replace.
void dballe::msg::Context::set ( std::auto_ptr< wreport::Var >  var)

Add a Var to the level.

If a variable exists with the same code, it is replaced

The Context will take ownership of memory management for var

Parameters:
varThe variable to add or replace.

The documentation for this class was generated from the following file: