DAQ
1.0.0
Data Acquisition System (basic demo)
|
#include <sqlitewrapper.h>
Public Member Functions | |
SQLiteWrapper (const std::string &db_path) | |
SQLiteWrapper create a sqlite3 connection. More... | |
~SQLiteWrapper () override | |
~SQLiteWrapper release the sqlite3 connection. More... | |
Err | create_scheme () noexceptoverride |
create_scheme creates the database schema for sqlite3 More... | |
Err | add_variable (const Variable &var) noexceptoverride |
add_variable add an entry to the variable table. More... | |
Err | add_variable_value (const VarValue &var) noexceptoverride |
add_variable_value add an entry ti the vriable value table, related to an entry in the variable table. More... | |
Err | fetch_variables (const std::function< void(const Variable &var, size_t index)> &send_vale) noexceptoverride |
fetch_variables get all variables. More... | |
Err | fetch_variable_values (const std::string &var_name, const std::function< void(const VarValue &, size_t index)> &send_vale) noexceptoverride |
fetch_variable_values get all values related to a variable. More... | |
Err | count_variable_values (const std::string &var_name, const std::function< void(size_t count)> &send_count) noexceptoverride |
count_variable_values count the number of values for a given variable. More... | |
Err | fetch_variable_values (const std::string &var_name, const std::chrono::system_clock::time_point &start_data, const std::chrono::system_clock::time_point &end_date, const std::function< void(const VarValue &val, size_t index)> &send_vale) noexceptoverride |
fetch_variable_values get all values related to a variable in a date range. More... | |
virtual Err | count_variable_values (const std::string &var_name, const std::chrono::system_clock::time_point &start_date, const std::chrono::system_clock::time_point &end_date, const std::function< void(size_t count)> &send_count) noexceptoverride |
count_variable_values count the number of values for a given variable in a date range. More... | |
Public Member Functions inherited from IDataSource | |
IDataSource ()=default | |
virtual | ~IDataSource ()=default |
IDataSource (const IDataSource &)=delete | |
IDataSource & | operator= (const IDataSource &)=delete |
IDataSource (IDataSource &&)=default | |
IDataSource & | operator= (IDataSource &&)=default |
virtual Err | fetch_variable_values (const std::string &var_name, const std::function< void(const VarValue &val, size_t index)> &send_vale) noexcept=0 |
fetch_variable_values get all values of a given variable More... | |
Private Attributes | |
sqlite3 * | db_ |
Additional Inherited Members | |
Public Types inherited from IDataSource | |
enum | Err { Err::Ok, Err::Failed } |
|
explicit |
SQLiteWrapper create a sqlite3 connection.
exception | if any error happen. |
db_path | the path to the sqlite3 db file |
|
override |
~SQLiteWrapper release the sqlite3 connection.
|
overridevirtualnoexcept |
add_variable add an entry to the variable table.
var | variable info. |
Implements IDataSource.
|
overridevirtualnoexcept |
add_variable_value add an entry ti the vriable value table, related to an entry in the variable table.
var | variable value info to be inserted. |
Implements IDataSource.
|
overridevirtualnoexcept |
count_variable_values count the number of values for a given variable.
var_name | variable to count related values from. |
send_count | get the values amount from this callback. |
Implements IDataSource.
|
overridevirtualnoexcept |
count_variable_values count the number of values for a given variable in a date range.
var_name | variable to count related values from. |
start_data | begin of the date range. |
end_date | end of the date range. |
send_count | get the values amount from this callback. |
Implements IDataSource.
|
overridevirtualnoexcept |
create_scheme creates the database schema for sqlite3
a table with posible variables, a table with variable values and a relation betwen the two (a variable have many variable values).
Implements IDataSource.
|
overridenoexcept |
fetch_variable_values get all values related to a variable.
var_name | variable to get related values from. |
send_vale | get values one at a time from this callback. |
|
overridevirtualnoexcept |
fetch_variable_values get all values related to a variable in a date range.
var_name | variable to get related values from. |
start_data | begin of the date range. |
end_date | end of the date range. |
send_vale | get values one at a time from this callback. |
Implements IDataSource.
|
overridevirtualnoexcept |
fetch_variables get all variables.
send_vale | the variables will be send in this callback, one at a time, index is the current value index. |
Implements IDataSource.
|
private |