ifw-daq 3.1.0
IFW Data Acquisition modules
Loading...
Searching...
No Matches
dbInterface.hpp
Go to the documentation of this file.
1/**
2 * @file
3 * @ingroup server
4 * @copyright ESO - European Southern Observatory
5 * @author
6 *
7 * @brief DbInterface class header file.
8 */
9#ifndef SERVER_DB_INTERFACE_HPP_
10#define SERVER_DB_INTERFACE_HPP_
11
12#include <rad/oldbAsyncWriter.hpp>
13
14#include <string>
15
16namespace server {
17
18const std::string KEY_CONTROL_STATE = "ctr.state";
19#if 0
20const std::string KEY_CONFIG_REQ_ENDPOINT = "cfg.req.endpoint";
21const std::string KEY_CONFIG_PUB_ENDPOINT = "cfg.pub.endpoint";
22const std::string KEY_CONFIG_DB_ENDPOINT = "cfg.db.endpoint";
23const std::string KEY_CONFIG_DB_PREFIX = "cfg.db.prefix";
24const std::string KEY_CONFIG_DB_TIMEOUT_SEC = "cfg.db.timeout_sec";
25const std::string KEY_CONFIG_SM_SCXML = "cfg.sm.scxml";
26const std::string KEY_CONFIG_FILENAME = "cfg.filename";
27const std::string KEY_CONFIG_LOG_LEVEL = "cfg.log.level";
28const std::string KEY_CONFIG_LOG_PROPERTIES = "cfg.log.properties";
29const std::string KEY_CONFIG_INSTRUMENT_ID = "cfg.instrument_id";
30const std::string KEY_CONFIG_DATAROOT = "cfg.dataroot";
31const std::string KEY_CONFIG_WORKSPACE = "cfg.workspace";
32
33const std::string KEY_CONFIG_STALE_DAQ_ACQUIRING = "cfg.daq.stale.acquiring_hours";
34const std::string KEY_CONFIG_STALE_DAQ_MERGING = "cfg.daq.stale.merging_hours";
35
36const std::string KEY_CONFIG_DPM_REQ_ENDPOINT = "cfg.dpm.req.endpoint";
37const std::string KEY_CONFIG_DPM_PUB_ENDPOINT = "cfg.dpm.pub.endpoint";
38const std::string KEY_CONFIG_DPM_TIMEOUT_SEC = "cfg.dpm.timeout_sec";
39#endif
40class Config;
41
42
43/**
44 * This class is the write-only interface to the CII OLDB.
45 */
47 public:
48 /**
49 * Constructor.
50 *
51 * @param[in] prefix String used as prefix when building the keys.
52 * @param[in] runtime_db Reference to the in-memory DB adapter.
53 */
54 DbInterface(const std::string& prefix, rad::OldbAsyncWriter& runtime_db);
55
56 /**
57 * Destructor
58 */
59 virtual ~DbInterface();
60
61 /**
62 * @param[in] value State to be stored in the DB.
63 */
64 void SetControlState(const std::string& value);
65
66 /**
67 * Set the application configuration information in the DB.
68 *
69 * @param[in] reqEndpoint Request msg endpoint.
70 * @param[in] dbIpAddr DB IP address.
71 * @param[in] dbPort DB port.
72 * @param[in] dbTimeout DB timeout.
73 */
74 void SetConfig(Config& cfg);
75
76 /**
77 * @param[in] key Key to be written in the DB.
78 * @param[in] value Value, associated to the given key, to be written in the DB.
79 */
80 void Set(const std::string& key, const std::string& value);
81
82 DbInterface(const DbInterface&) = delete; //! Disable copy constructor
83 DbInterface& operator=(const DbInterface&) = delete; //! Disable assignment operator
84
85 private:
86 std::string m_prefix;
87 rad::OldbAsyncWriter& m_runtime_db;
88};
89
90} // namespace server
91
92#endif // SERVER_DB_INTERFACE_HPP_
This class provide access to the command line options and the configuration parameters stored in the ...
Definition: config.hpp:61
This class is the write-only interface to the CII OLDB.
Definition: dbInterface.hpp:46
void Set(const std::string &key, const std::string &value)
Definition: dbInterface.cpp:47
void SetConfig(Config &cfg)
Set the application configuration information in the DB.
Definition: dbInterface.cpp:40
void SetControlState(const std::string &value)
Definition: dbInterface.cpp:35
virtual ~DbInterface()
Destructor.
Definition: dbInterface.cpp:31
DbInterface(const DbInterface &)=delete
DbInterface & operator=(const DbInterface &)=delete
Disable copy constructor.
const std::string KEY_CONFIG_PUB_ENDPOINT
Rad configuration keys.
Definition: config.hpp:26
const std::string KEY_CONFIG_DPM_TIMEOUT_SEC
Definition: config.hpp:36
const std::string KEY_CONFIG_STALE_DAQ_ACQUIRING
Definition: config.hpp:30
const std::string KEY_CONFIG_DATAROOT
Definition: config.hpp:28
const std::string KEY_CONFIG_DPM_PUB_ENDPOINT
Definition: config.hpp:35
const std::string KEY_CONFIG_WORKSPACE
Definition: config.hpp:29
const std::string KEY_CONTROL_STATE
Definition: dbInterface.hpp:18
const std::string KEY_CONFIG_INSTRUMENT_ID
Definition: config.hpp:27
const std::string KEY_CONFIG_STALE_DAQ_MERGING
Definition: config.hpp:31
const std::string KEY_CONFIG_DPM_REQ_ENDPOINT
Definition: config.hpp:34