ifw  0.0.1-dev
 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_DB_ENDPOINT = "cfg.db.endpoint";
25 const std::string KEY_CONFIG_DB_TIMEOUT_SEC = "cfg.db.timeout.sec";
26 const std::string KEY_CONFIG_SM_SCXML = "cfg.sm.scxml";
27 const std::string KEY_CONFIG_FILENAME = "cfg.filename";
28 const std::string KEY_CONFIG_LOG_LEVEL = "cfg.log.level";
29 
33 class DbInterface {
34  public:
41  DbInterface(const std::string& prefix, rad::DbAdapter& runtime_db);
42 
46  virtual ~DbInterface();
47 
51  std::string GetControlState();
52 
56  std::string GetControlSubstate();
57 
61  std::string GetControlStatus();
62 
67  std::string Get(const std::string& key);
68 
72  void SetControlState(const std::string& value);
73 
77  void SetControlSubstate(const std::string& value);
78 
82  void SetControlStatus(const std::string& value);
83 
91  void SetControl(const std::string& state, const std::string& substate,
92  const std::string& status);
93 
102  void SetConfig(const std::string& req_endpoint,
103  const std::string& db_endpoint, const timeval& db_timeout,
104  const std::string& scxml_filename,
105  const std::string& config_filename,
106  const std::string& log_level);
107 
112  void Set(const std::string& key, const std::string& value);
113 
114  DbInterface(const DbInterface&) = delete;
115  DbInterface& operator=(const DbInterface&) = delete;
116 
117  private:
118  std::string m_prefix;
119  rad::DbAdapter& m_runtime_db;
120 };
121 
122 } // namespace server
123 
124 #endif // SERVER_DB_INTERFACE_HPP_
double value
Definition: easylogging++.h:814
DbInterface & operator=(const DbInterface &)=delete
Disable copy constructor.
const std::string KEY_CONTROL_STATUS
Definition: dbInterface.hpp:20
void Set(const std::string &key, const std::string &value)
Definition: dbInterface.cpp:115
std::string GetControlSubstate()
Definition: dbInterface.cpp:37
const std::string KEY_CONFIG_REQ_ENDPOINT
Definition: dbInterface.hpp:23
const std::string KEY_CONFIG_FILENAME
Definition: dbInterface.hpp:27
void SetConfig(const std::string &req_endpoint, const std::string &db_endpoint, const timeval &db_timeout, const std::string &scxml_filename, const std::string &config_filename, const std::string &log_level)
Definition: dbInterface.cpp:89
Definition: DbAdapter.hpp:29
def server
Definition: hellorad.py:88
void SetControlState(const std::string &value)
Definition: dbInterface.cpp:52
std::string GetControlStatus()
Definition: dbInterface.cpp:42
const std::string KEY_CONTROL_SIMULATION
Definition: dbInterface.hpp:21
optional int32 substate
Definition: topics.proto:77
const std::string KEY_CONFIG_DB_TIMEOUT_SEC
Definition: dbInterface.hpp:25
std::string Get(const std::string &key)
Definition: dbInterface.cpp:47
virtual ~DbInterface()
Definition: dbInterface.cpp:28
const std::string KEY_CONTROL_STATE
Definition: dbInterface.hpp:18
std::string GetControlState()
Definition: dbInterface.cpp:32
void SetControl(const std::string &state, const std::string &substate, const std::string &status)
Definition: dbInterface.cpp:67
const std::string KEY_CONFIG_LOG_LEVEL
Definition: dbInterface.hpp:28
DbInterface(const std::string &prefix, rad::DbAdapter &runtime_db)
Definition: dbInterface.cpp:18
void SetControlSubstate(const std::string &value)
Definition: dbInterface.cpp:57
void SetControlStatus(const std::string &value)
Definition: dbInterface.cpp:62
const std::string KEY_CONTROL_SUBSTATE
Definition: dbInterface.hpp:19
const std::string KEY_CONFIG_SM_SCXML
Definition: dbInterface.hpp:26
const std::string KEY_CONFIG_DB_ENDPOINT
Definition: dbInterface.hpp:24