libdballe 9.6
|
Holds data for database I/O. More...
#include <data.h>
Public Member Functions | |
Data (const Data &rec)=default | |
Data (Data &&rec)=default | |
Data & | operator= (const Data &rec)=default |
Data & | operator= (Data &&rec)=default |
bool | operator== (const dballe::Data &rec) const override |
Check if two records are the same. | |
bool | operator!= (const dballe::Data &rec) const override |
Check if two records differ. | |
void | validate () |
Check the data fields for consistency, and fill in missing values: | |
void | clear () override |
Remove all contents from the record. | |
void | clear_vars () override |
Remove all Bxxyyy keys from the record, leaving the rest intact. | |
void | clear_ids () override |
Unset all database IDs in station and values. | |
void | print (FILE *out) const override |
Print the contents of this record to the given stream. | |
void | set_from_string (const char *str) |
Set a value according to an assignment encoded in a string. | |
void | set_from_test_string (const std::string &s) |
Set the Data from a ", "-separated string of assignments. | |
std::string | to_string () const |
Encode in a one-liner of comma-separated assignments. | |
virtual void | clear ()=0 |
Remove all contents from the record. | |
virtual void | clear_ids ()=0 |
Unset all database IDs in station and values. | |
virtual void | clear_vars ()=0 |
Remove all Bxxyyy keys from the record, leaving the rest intact. | |
virtual bool | operator== (const Data &rec) const =0 |
Check if two records are the same. | |
virtual bool | operator!= (const Data &rec) const =0 |
Check if two records differ. | |
virtual void | print (FILE *out) const =0 |
Print the contents of this record to the given stream. | |
Static Public Member Functions | |
static const Data & | downcast (const dballe::Data &data) |
Return a reference to record downcasted as core::Record. | |
static Data & | downcast (dballe::Data &data) |
Return a reference to record downcasted as core::Record. | |
![]() | |
static std::unique_ptr< Data > | create () |
Create a new Record. | |
Public Attributes | |
DBStation | station |
Datetime | datetime |
Level | level |
Trange | trange |
DBValues | values |
Protected Member Functions | |
void | setf (const char *key, unsigned len, const char *val) |
Holds data for database I/O.
Data is a container for one observation of meteorological values, that includes station informations, physical location of the observation in time and space, and all the observed variables.
|
virtual |
Reimplemented from dballe::Data.
|
overridevirtual |
Remove all contents from the record.
Implements dballe::Data.
|
overridevirtual |
Unset all database IDs in station and values.
Implements dballe::Data.
|
overridevirtual |
Remove all Bxxyyy keys from the record, leaving the rest intact.
Implements dballe::Data.
|
static |
Return a reference to record downcasted as core::Record.
Throws an exception if record is not a core::Record.
Referenced by dballe::tests::ActualCursor::data_var_matches().
|
static |
Return a reference to record downcasted as core::Record.
Throws an exception if record is not a core::Record.
|
overridevirtual |
Check if two records differ.
Implements dballe::Data.
|
overridevirtual |
Check if two records are the same.
Implements dballe::Data.
|
overridevirtual |
Print the contents of this record to the given stream.
Implements dballe::Data.
void dballe::core::Data::set_from_string | ( | const char * | str | ) |
Set a value according to an assignment encoded in a string.
String can use keywords, aliases and varcodes. Examples: ana_id=3, name=Bologna, B12012=32.4
In case of numeric parameter, a hyphen ("-") means MISSING_INT (e.g., leveltype2=-
).
str | The string containing the assignment. |
void dballe::core::Data::set_from_test_string | ( | const std::string & | s | ) |
Set the Data from a ", "-separated string of assignments.
The implementation is not efficient and the method is not safe for any input, since ", " could appear in a station identifier. It is however useful to quickly create test queries for unit testing.
void dballe::core::Data::validate | ( | ) |
Check the data fields for consistency, and fill in missing values: