rad  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dbInterface.hpp
Go to the documentation of this file.
1 
9 #ifndef SERVER_DB_INTERFACE_HPP_
10 #define SERVER_DB_INTERFACE_HPP_
11 
12 #include <rad/dbAdapter.hpp>
13 
14 #include <string>
15 
16 namespace server {
17 
18 const std::string KEY_CONTROL_STATE = "ctr.state";
19 const std::string KEY_CONTROL_SUBSTATE = "ctr.substate";
20 const std::string KEY_CONTROL_STATUS = "ctr.status";
21 const std::string KEY_CONTROL_SIMULATION = "ctr.simulation";
22 
23 const std::string KEY_CONFIG_REQ_ENDPOINT = "cfg.req.endpoint";
24 const std::string KEY_CONFIG_SUB_ENDPOINT = "cfg.sub.endpoint";
25 const std::string KEY_CONFIG_DB_ENDPOINT = "cfg.db.endpoint";
26 const std::string KEY_CONFIG_DB_TIMEOUT_SEC = "cfg.db.timeout.sec";
27 const std::string KEY_CONFIG_SM_SCXML = "cfg.sm.scxml";
28 const std::string KEY_CONFIG_SM_SCXML_APPEND = "cfg.sm.scxml_append";
29 const std::string KEY_CONFIG_FILENAME = "cfg.filename";
30 const std::string KEY_CONFIG_LOG_LEVEL = "cfg.log.level";
31 const std::string KEY_CONFIG_LOG_PROPERTIES = "cfg.log.properties";
32 
33 const std::string KEY_DATA_DEVMEAS_X = "dat.meas.x";
34 const std::string KEY_DATA_DEVMEAS_Y = "dat.meas.y";
35 const std::string KEY_DATA_DEVMEAS_TIME = "dat.meas.time";
36 
37 class Config;
38 
42 class DbInterface {
43  public:
44  DbInterface(const std::string& prefix, rad::DbAdapter& runtime_db);
45  virtual ~DbInterface();
46 
47  std::string GetControlState();
48  std::string GetControlSubstate();
49  std::string GetControlStatus();
50  std::string Get(const std::string& key);
51 
52  void SetControlState(const std::string& value);
53  void SetControlSubstate(const std::string& value);
54  void SetControlStatus(const std::string& value);
55  void SetControl(const std::string& state, const std::string& substate,
56  const std::string& status);
57 
58  void SetConfig(Config& cfg);
59 
60  void SetDataDevMeas(const std::string& time_stamp, const double x, const double y);
61 
62  void Set(const std::string& key, const std::string& value);
63 
64  DbInterface(const DbInterface&) = delete;
65  DbInterface& operator=(const DbInterface&) = delete;
66 
67  private:
68  std::string m_prefix;
69  rad::DbAdapter& m_runtime_db;
70 };
71 
72 } // namespace server
73 
74 #endif // SERVER_DB_INTERFACE_HPP_
DbInterface & operator=(const DbInterface &)=delete
Disable copy constructor.
float y
Definition: topics.proto:7
const std::string KEY_CONTROL_STATUS
Definition: dbInterface.hpp:20
void Set(const std::string &key, const std::string &value)
Definition: dbInterface.cpp:169
std::string GetControlSubstate()
Definition: dbInterface.cpp:50
void SetConfig(Config &cfg)
Definition: dbInterface.cpp:123
const std::string KEY_CONFIG_REQ_ENDPOINT
Definition: dbInterface.hpp:23
const std::string KEY_CONFIG_SM_SCXML_APPEND
Definition: dbInterface.hpp:28
const std::string KEY_CONFIG_FILENAME
Definition: dbInterface.hpp:29
Definition: dbAdapter.hpp:29
def server
Server receiving requests and publishing topics.
Definition: hellorad.py:108
void SetControlState(const std::string &value)
Definition: dbInterface.cpp:75
std::string GetControlStatus()
Definition: dbInterface.cpp:58
const std::string KEY_CONTROL_SIMULATION
Definition: dbInterface.hpp:21
const std::string KEY_DATA_DEVMEAS_X
Definition: dbInterface.hpp:33
const std::string KEY_CONFIG_LOG_PROPERTIES
Definition: dbInterface.hpp:31
const std::string KEY_CONFIG_DB_TIMEOUT_SEC
Definition: dbInterface.hpp:26
std::string Get(const std::string &key)
Definition: dbInterface.cpp:67
void SetDataDevMeas(const std::string &time_stamp, const double x, const double y)
Definition: dbInterface.cpp:151
const std::string KEY_CONFIG_SUB_ENDPOINT
Definition: dbInterface.hpp:24
virtual ~DbInterface()
Definition: dbInterface.cpp:37
const std::string KEY_CONTROL_STATE
Definition: dbInterface.hpp:18
std::string GetControlState()
Definition: dbInterface.cpp:42
const std::string KEY_DATA_DEVMEAS_TIME
Definition: dbInterface.hpp:35
const std::string KEY_DATA_DEVMEAS_Y
Definition: dbInterface.hpp:34
void SetControl(const std::string &state, const std::string &substate, const std::string &status)
Definition: dbInterface.cpp:103
const std::string KEY_CONFIG_LOG_LEVEL
Definition: dbInterface.hpp:30
DbInterface(const std::string &prefix, rad::DbAdapter &runtime_db)
Definition: dbInterface.cpp:25
void SetControlSubstate(const std::string &value)
Definition: dbInterface.cpp:83
void SetControlStatus(const std::string &value)
Definition: dbInterface.cpp:91
const std::string KEY_CONTROL_SUBSTATE
Definition: dbInterface.hpp:19
const std::string KEY_CONFIG_SM_SCXML
Definition: dbInterface.hpp:27
const std::string KEY_CONFIG_DB_ENDPOINT
Definition: dbInterface.hpp:25