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 HELLOMAL_DB_INTERFACE_HPP_
10 #define HELLOMAL_DB_INTERFACE_HPP_
11 
12 #include <rad/dbAdapter.hpp>
13 
14 #include <string>
15 
16 namespace hellomal {
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 const std::string KEY_CONFIG_LOG_PROPERTIES = "cfg.log.properties";
30 
31 class Config;
32 
33 
37 class DbInterface {
38  public:
45  DbInterface(const std::string& prefix, rad::DbAdapter& runtime_db);
46 
50  virtual ~DbInterface();
51 
55  std::string GetControlState();
56 
60  std::string GetControlSubstate();
61 
65  std::string GetControlStatus();
66 
71  std::string Get(const std::string& key);
72 
76  void SetControlState(const std::string& value);
77 
81  void SetControlSubstate(const std::string& value);
82 
86  void SetControlStatus(const std::string& value);
87 
95  void SetControl(const std::string& state, const std::string& substate,
96  const std::string& status);
97 
106  void SetConfig(Config& cfg);
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 hellomal
123 
124 #endif // HELLOMAL_DB_INTERFACE_HPP_
void SetControlState(const std::string &value)
Definition: dbInterface.cpp:54
const std::string KEY_CONFIG_REQ_ENDPOINT
Definition: dbInterface.hpp:23
const std::string KEY_CONTROL_STATUS
Definition: dbInterface.hpp:20
const std::string KEY_CONFIG_LOG_LEVEL
Definition: dbInterface.hpp:28
std::string Get(const std::string &key)
Definition: dbInterface.cpp:49
void SetConfig(Config &cfg)
Definition: dbInterface.cpp:85
void SetControlSubstate(const std::string &value)
Definition: dbInterface.cpp:59
const std::string KEY_CONTROL_SUBSTATE
Definition: dbInterface.hpp:19
const std::string KEY_CONFIG_FILENAME
Definition: dbInterface.hpp:27
DbInterface & operator=(const DbInterface &)=delete
Disable copy constructor.
std::string GetControlState()
Definition: dbInterface.cpp:34
Definition: dbAdapter.hpp:29
std::string GetControlStatus()
Definition: dbInterface.cpp:44
const std::string KEY_CONFIG_LOG_PROPERTIES
Definition: dbInterface.hpp:29
void SetControlStatus(const std::string &value)
Definition: dbInterface.cpp:64
DbInterface(const std::string &prefix, rad::DbAdapter &runtime_db)
Definition: dbInterface.cpp:20
const std::string KEY_CONTROL_SIMULATION
Definition: dbInterface.hpp:21
std::string GetControlSubstate()
Definition: dbInterface.cpp:39
const std::string KEY_CONFIG_DB_TIMEOUT_SEC
Definition: dbInterface.hpp:25
void SetControl(const std::string &state, const std::string &substate, const std::string &status)
Definition: dbInterface.cpp:69
const std::string KEY_CONFIG_SM_SCXML
Definition: dbInterface.hpp:26
const std::string KEY_CONTROL_STATE
Definition: dbInterface.hpp:18
void Set(const std::string &key, const std::string &value)
Definition: dbInterface.cpp:108
const std::string KEY_CONFIG_DB_ENDPOINT
Definition: dbInterface.hpp:24
virtual ~DbInterface()
Definition: dbInterface.cpp:30