DAQ  1.0.0
Data Acquisition System (basic demo)
Public Types | Public Member Functions | List of all members
IDataSource Class Referenceabstract

The IDataSource class is an interface for the physycal storage. More...

#include <idatasource.h>

Inheritance diagram for IDataSource:
Inheritance graph
[legend]

Public Types

enum  Err { Err::Ok, Err::Failed }
 

Public Member Functions

 IDataSource ()=default
 
virtual ~IDataSource ()=default
 
 IDataSource (const IDataSource &)=delete
 
IDataSourceoperator= (const IDataSource &)=delete
 
 IDataSource (IDataSource &&)=default
 
IDataSourceoperator= (IDataSource &&)=default
 
virtual Err create_scheme () noexcept=0
 create_scheme create data storage persistence, e.g. schema for a relational database More...
 
virtual Err add_variable (const Variable &variable) noexcept=0
 add_variable add a variable to be tracket for the system (by default the only supported variabe value type is double). More...
 
virtual Err add_variable_value (const VarValue &var_value) noexcept=0
 add_variable_value add a new value for the variable. More...
 
virtual Err fetch_variables (const std::function< void(const Variable &var, size_t index)> &send_vale) noexcept=0
 fetch_variables get all variables More...
 
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...
 
virtual Err count_variable_values (const std::string &var_name, const std::function< void(size_t count)> &send_count) noexcept=0
 count_variable_values count all values of a given variable More...
 
virtual Err fetch_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(const VarValue &val, size_t index)> &send_vale) noexcept=0
 fetch_variable_values get all values of a given variables 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) noexcept=0
 count_variable_values count all values of a given variable More...
 

Detailed Description

The IDataSource class is an interface for the physycal storage.

A variable is related for example with sensors, like temperature, luminosity, ... A value is for example the numerica value for a temperature sensor.

See also
add_variable_value, add_variable_value

Member Enumeration Documentation

enum IDataSource::Err
strong
Enumerator
Ok 
Failed 

Constructor & Destructor Documentation

IDataSource::IDataSource ( )
default

Here is the caller graph for this function:

virtual IDataSource::~IDataSource ( )
virtualdefault
IDataSource::IDataSource ( const IDataSource )
delete
IDataSource::IDataSource ( IDataSource &&  )
default

Member Function Documentation

virtual Err IDataSource::add_variable ( const Variable variable)
pure virtualnoexcept

add_variable add a variable to be tracket for the system (by default the only supported variabe value type is double).

Parameters
variableto be created in the physical storage.
Returns
Err::Ok on succes.
See also
add_variable_value

Implemented in SQLiteWrapper, and MockIDataSource.

virtual Err IDataSource::add_variable_value ( const VarValue var_value)
pure virtualnoexcept

add_variable_value add a new value for the variable.

Parameters
var_valuevariable value to be inserted in the storage.
Returns
Err::Ok on succes
See also
add_variable

Implemented in SQLiteWrapper, and MockIDataSource.

virtual Err IDataSource::count_variable_values ( const std::string &  var_name,
const std::function< void(size_t count)> &  send_count 
)
pure virtualnoexcept

count_variable_values count all values of a given variable

Parameters
var_namevariable name to count the values from
send_countin this callack you can receive the number of values for the given variable
Returns
Err::Ok on success

Implemented in SQLiteWrapper, and MockIDataSource.

virtual Err IDataSource::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 
)
pure virtualnoexcept

count_variable_values count all values of a given variable

Parameters
var_namevariable name to count the values from
start_datebegin of the date range
end_dateend of the date range
send_countin this callack you can receive the number of values for the given variable
Returns
Err::Ok on success.

Implemented in SQLiteWrapper, and MockIDataSource.

Here is the caller graph for this function:

virtual Err IDataSource::create_scheme ( )
pure virtualnoexcept

create_scheme create data storage persistence, e.g. schema for a relational database

Returns
Err::Ok on succes

Implemented in SQLiteWrapper, and MockIDataSource.

virtual Err IDataSource::fetch_variable_values ( const std::string &  var_name,
const std::function< void(const VarValue &val, size_t index)> &  send_vale 
)
pure virtualnoexcept

fetch_variable_values get all values of a given variable

Parameters
var_namevariable name to get the values from
send_valethe values will be send in this callback, one at a time, index is the current value index.
Returns
Err::Ok on succes

Implemented in MockIDataSource.

virtual Err IDataSource::fetch_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(const VarValue &val, size_t index)> &  send_vale 
)
pure virtualnoexcept

fetch_variable_values get all values of a given variables in a date range

Parameters
var_namevariable name to get the values from
start_datebegin of the date range
end_dateend of the date range
send_valethe values will be send in this callback, one at a time, index is the current value index.
Returns
Err::Ok on succes

Implemented in SQLiteWrapper, and MockIDataSource.

virtual Err IDataSource::fetch_variables ( const std::function< void(const Variable &var, size_t index)> &  send_vale)
pure virtualnoexcept

fetch_variables get all variables

Parameters
send_valethe variables will be send in this callback, one at a time, index is the current value index.
Returns
Err::Ok on succes

Implemented in SQLiteWrapper, and MockIDataSource.

IDataSource& IDataSource::operator= ( const IDataSource )
delete
IDataSource& IDataSource::operator= ( IDataSource &&  )
default

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