#include <dbInterface.hpp>
|
| DbInterface (const std::string &prefix, std::chrono::seconds db_timeout, std::chrono::milliseconds db_task_period, bool with_worker_thread=true) |
|
virtual | ~DbInterface () |
|
bool | IsConnected () |
|
std::string | GetPrefix () |
|
void | SetStates (const std::string &prefix, const std::string &state, const std::string &substate) |
|
template<typename T > |
void | Get (const std::string &key, T &value) |
|
template<typename T > |
void | Set (const std::string &key, const T &value) |
|
template<typename T > |
void | SetAsync (const std::string &key, const T &value) |
| Aynchronous OLDB set for single attributes.
|
|
void | BatchSetAsync (const DbVector &vec) |
| Aynchronous OLDB set for a vector.
|
|
| DbInterface (const DbInterface &)=delete |
| Disable copy constructor.
|
|
DbInterface & | operator= (const DbInterface &)=delete |
| Disable assignment operator.
|
|
This class is the interface to the in-memory DB.
◆ DbInterface() [1/2]
utils::bat::DbInterface::DbInterface |
( |
const std::string & |
prefix, |
|
|
std::chrono::seconds |
db_timeout, |
|
|
std::chrono::milliseconds |
db_task_period, |
|
|
bool |
with_worker_thread = true |
|
) |
| |
Constructor.
- Parameters
-
[in] | prefix | String used as prefix when building the keys. |
[in] | runtime_db | Reference to the in-memory DB adapter. |
◆ ~DbInterface()
utils::bat::DbInterface::~DbInterface |
( |
| ) |
|
|
virtual |
◆ DbInterface() [2/2]
utils::bat::DbInterface::DbInterface |
( |
const DbInterface & |
| ) |
|
|
delete |
Disable copy constructor.
◆ BatchSetAsync()
void utils::bat::DbInterface::BatchSetAsync |
( |
const DbVector & |
vec | ) |
|
Aynchronous OLDB set for a vector.
- Parameters
-
[in] | vec | Vector containing the attributes to write |
This methods allows client application to pass one attribute to be written. The attributes will be added to the internal double map that will be later written into the OLDB by the dedicated OLDB worker thread.
◆ Get()
template<typename T >
void utils::bat::DbInterface::Get |
( |
const std::string & |
key, |
|
|
T & |
value |
|
) |
| |
Read the value associated to a given key.
- Parameters
-
[in] | key | URI of the attribute. |
[out] | value | If the key is accessible, the value associated to the key. |
◆ GetPrefix()
std::string utils::bat::DbInterface::GetPrefix |
( |
| ) |
|
|
inline |
◆ IsConnected()
bool utils::bat::DbInterface::IsConnected |
( |
| ) |
|
|
inline |
◆ operator=()
Disable assignment operator.
◆ Set()
template<typename T >
void utils::bat::DbInterface::Set |
( |
const std::string & |
key, |
|
|
const T & |
value |
|
) |
| |
Write a value for the given key.
- Parameters
-
[in] | key | URI of the attribute. |
[in] | value | The value associated to the key. |
◆ SetAsync()
template<typename T >
void utils::bat::DbInterface::SetAsync |
( |
const std::string & |
key, |
|
|
const T & |
value |
|
) |
| |
Aynchronous OLDB set for single attributes.
- Parameters
-
[in] | key | URI of the attribute to be written. |
[in] | value | Value to be written. |
This methods allows client application to write attributes into the OLDB asynchronously. Each of these attributes will be added to the internal double map that will be later written into the OLDB by the dedicated OLDB worker thread.
◆ SetStates()
void utils::bat::DbInterface::SetStates |
( |
const std::string & |
prefix, |
|
|
const std::string & |
state, |
|
|
const std::string & |
substate |
|
) |
| |
Writes the application states information into the DB.
- Parameters
-
[in] | prefix | to be used for the key. |
[in] | state | State to be stored in the DB. |
[in] | substate | Substate to be stored in the DB. |
The documentation for this class was generated from the following files: