libdballe 5.10
|
DB-All.E record. More...
#include <record.h>
Public Member Functions | |
Record (const Record &rec) | |
Record & | operator= (const Record &rec) |
bool | operator== (const Record &rec) const |
bool | operator!= (const Record &rec) const |
void | clear () |
Remove all data from the record. | |
void | clear_vars () |
Remove all variables from the record, leaving the keywords intact. | |
void | add (const Record &source) |
Copy all data from the record source into dest. | |
bool | contains (const Record &subset) const |
Return true if all elements of subset are present in this record, with the same value. | |
void | set_to_difference (const Record &source1, const Record &source2) |
Set the record to contain only those fields that change source1 into source2. | |
const wreport::Var * | key_peek (dba_keyword parameter) const throw () |
Look at the value of a parameter. | |
const wreport::Var * | var_peek (wreport::Varcode code) const throw () |
Look at the value of a variable. | |
const wreport::Var * | peek (const char *name) const |
Get the variable for an item. | |
const wreport::Var * | peek (dba_keyword parameter) const throw () |
Shortcut for key_peek. | |
const wreport::Var * | peek (wreport::Varcode code) const throw () |
Shortcut for var_peek. | |
const char * | key_peek_value (dba_keyword parameter) const throw () |
Look at the raw value of a keyword in the record, without raising errors. | |
const char * | var_peek_value (wreport::Varcode code) const throw () |
Look at the raw value of a variable in the record, without raising errors. | |
const char * | peek_value (const char *name) const |
Get the string value for an item. | |
const char * | peek_value (dba_keyword parameter) const throw () |
Shortcut for key_peek_value. | |
const char * | peek_value (wreport::Varcode code) const throw () |
Shortcut for var_peek_value. | |
const wreport::Var & | key (dba_keyword parameter) const |
Return the Var for a key, throwing an error it if it missing. | |
const wreport::Var & | var (wreport::Varcode code) const |
Return the Var for a variable, throwing an error it if it missing. | |
wreport::Var & | key (dba_keyword parameter) |
Return the Var for a key, creating it if it missing. | |
wreport::Var & | var (wreport::Varcode code) |
Return the Var for a variable, creating it if it missing. | |
void | set_ana_context () |
Set the date, level and timerange values to match the anagraphical context. | |
const std::vector < wreport::Var * > & | vars () const |
Return the vector with the variables. | |
void | key_unset (dba_keyword parameter) |
Remove a parameter from the record. | |
void | var_unset (wreport::Varcode code) |
Remove a parameter from the record. | |
void | parse_date_extremes (int *minvalues, int *maxvalues) const |
Parse the date extremes set in Record. | |
void | parse_date (int *values) const |
Parse the date set in the Record. | |
void | set_from_string (const char *str) |
Set a value in the record according to an assignment encoded in a string. | |
void | print (FILE *out) const |
Print the contents of this record to the given file descriptor. | |
const wreport::Var & | get (dba_keyword parameter) const |
Shortcuts. | |
const wreport::Var & | get (wreport::Varcode code) const |
Shortcuts. | |
const wreport::Var & | get (const char *name) const |
Shortcuts. | |
wreport::Var & | get (dba_keyword parameter) |
Shortcuts. | |
wreport::Var & | get (wreport::Varcode code) |
Shortcuts. | |
wreport::Var & | get (const char *name) |
Shortcuts. | |
template<typename K , typename T > | |
T | get (K name, T default_value) const |
Shortcuts. | |
const wreport::Var & | operator[] (dba_keyword parameter) const |
Shortcuts. | |
const wreport::Var & | operator[] (wreport::Varcode code) const |
Shortcuts. | |
const wreport::Var & | operator[] (const char *name) const |
Shortcuts. | |
wreport::Var & | operator[] (dba_keyword parameter) |
Shortcuts. | |
wreport::Var & | operator[] (wreport::Varcode code) |
Shortcuts. | |
wreport::Var & | operator[] (const char *name) |
Shortcuts. | |
template<typename P , typename V > | |
void | set (const P &field, const V &val) |
Shortcuts. | |
void | set (const wreport::Var &var) |
Shortcuts. | |
void | unset (dba_keyword parameter) |
Shortcuts. | |
void | unset (wreport::Varcode code) |
Shortcuts. | |
void | unset (const char *name) |
Shortcuts. | |
Static Public Member Functions | |
static const char * | keyword_name (dba_keyword keyword) |
Return the name of a dba_keyword. | |
static wreport::Varinfo | keyword_info (dba_keyword keyword) |
Return informations about a keyword. | |
static dba_keyword | keyword_byname (const char *tag) |
Get the dba_keyword corresponding to the given name. | |
static dba_keyword | keyword_byname_len (const char *tag, int len) |
Get the dba_keyword corresponding to the given name. | |
Protected Member Functions | |
int | find_item (wreport::Varcode code) const throw () |
Find an item by wreport::Varcode, returning -1 if not found. | |
wreport::Var & | get_item (wreport::Varcode code) |
Find an item by wreport::Varcode, raising an exception if not found. | |
const wreport::Var & | get_item (wreport::Varcode code) const |
Find an item by wreport::Varcode, raising an exception if not found. | |
void | remove_item (wreport::Varcode code) |
Remove an item by wreport::Varcode. | |
Protected Attributes | |
wreport::Var * | keydata [DBA_KEY_COUNT] |
std::vector< wreport::Var * > | m_vars |
DB-All.E record.
A Record is a container for one observation of meteorological values, that includes anagraphical informations, physical location of the observation in time and space, and all the observed variables.
void dballe::Record::add | ( | const Record & | source | ) |
Copy all data from the record source into dest.
At the end of the function, dest will contain its previous values, plus the values in source. If a value is present both in source and in dest, the one in dest will be overwritten.
source | The record to copy data from. |
const wreport::Var* dballe::Record::key_peek | ( | dba_keyword | parameter | ) | const throw () |
Look at the value of a parameter.
Referenced by peek().
const char* dballe::Record::key_peek_value | ( | dba_keyword | parameter | ) | const throw () |
Look at the raw value of a keyword in the record, without raising errors.
parameter | The keyword to get the value for. |
Referenced by peek_value().
void dballe::Record::key_unset | ( | dba_keyword | parameter | ) |
Remove a parameter from the record.
parameter | The parameter to remove. |
Referenced by unset().
static dba_keyword dballe::Record::keyword_byname | ( | const char * | tag | ) | [static] |
Get the dba_keyword corresponding to the given name.
static dba_keyword dballe::Record::keyword_byname_len | ( | const char * | tag, |
int | len | ||
) | [static] |
Get the dba_keyword corresponding to the given name.
tag | The name to query. |
len | The length of the name in tag. |
static wreport::Varinfo dballe::Record::keyword_info | ( | dba_keyword | keyword | ) | [static] |
Return informations about a keyword.
static const char* dballe::Record::keyword_name | ( | dba_keyword | keyword | ) | [static] |
Return the name of a dba_keyword.
void dballe::Record::parse_date | ( | int * | values | ) | const |
Parse the date set in the Record.
This function will examine the values year, month, day, hour, min and sec, and will compute the lower bound of the datetime they represent.
values | An array of 6 integers that will be filled with the minimum year, month, day, hour, minute and seconds. |
void dballe::Record::parse_date_extremes | ( | int * | minvalues, |
int * | maxvalues | ||
) | const |
Parse the date extremes set in Record.
This function will examine the values yearmin, monthmin, daymin, hourmin, minumin, secmin, yearmax, monthmax, daymax, hourmax, minumax, secmax, year, month, day, hour, min and sec, and will compute the two datetime extremes that bound the interval they represent.
minvalues | An array of 6 integers that will be filled with the minimum year, month, day, hour, minute and seconds. |
maxvalues | An array of 6 integers that will be filled with the maximum year, month, day, hour, minute and seconds. |
const wreport::Var* dballe::Record::peek | ( | const char * | name | ) | const |
Get the variable for an item.
name | The name of the item to get the value for |
Referenced by get().
const char* dballe::Record::peek_value | ( | const char * | name | ) | const |
Get the string value for an item.
name | The name of the item to get the value for |
void dballe::Record::print | ( | FILE * | out | ) | const |
Print the contents of this record to the given file descriptor.
out | The output file descriptor |
void dballe::Record::set_from_string | ( | const char * | str | ) |
Set a value in the record according to an assignment encoded in a string.
String can use keywords, aliases and varcodes. Examples: ana_id=3, name=Bologna, B12012=32.4
rec | The record where the value is to be set. |
str | The string containing the assignment. |
Set the record to contain only those fields that change source1 into source2.
If a field has been deleted from source1 to source2, it will not be copied in dest.
source1 | The original record to compute the changes from. |
source2 | The new record that has changes over source1. |
const wreport::Var* dballe::Record::var_peek | ( | wreport::Varcode | code | ) | const throw () |
Look at the value of a variable.
Referenced by peek().
const char* dballe::Record::var_peek_value | ( | wreport::Varcode | code | ) | const throw () |
Look at the raw value of a variable in the record, without raising errors.
code | The variable to get the value for. See vartable::h |
Referenced by peek_value().
void dballe::Record::var_unset | ( | wreport::Varcode | code | ) |
Remove a parameter from the record.
code | The variable to remove. See vartable::h |
Referenced by unset().