rad  3.0.0
dbInterface.hpp
Go to the documentation of this file.
1 
9 #ifndef HELLO_DB_INTERFACE_HPP_
10 #define HELLO_DB_INTERFACE_HPP_
11 
12 #include <rad/dbAdapter.hpp>
13 
14 #include <string>
15 
16 namespace hello {
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_FILENAME = "cfg.filename";
29 const std::string KEY_CONFIG_LOG_LEVEL = "cfg.log.level";
30 const std::string KEY_CONFIG_LOG_PROPERTIES = "cfg.log.properties";
31 
32 class Config;
33 
38 {
39 public:
40  DbInterface(const std::string& prefix, rad::DbAdapter& runtime_db);
41  virtual ~DbInterface();
42 
43  std::string GetControlState();
44  std::string GetControlSubstate();
45  std::string GetControlStatus();
46  std::string Get(const std::string& key);
47 
48  void SetControlState(const std::string& value);
49  void SetControlSubstate(const std::string& value);
50  void SetControlStatus(const std::string& value);
51  void SetControl(const std::string& state, const std::string& substate, const std::string& status);
52 
53  void SetConfig(Config& cfg);
54 
55  void Set(const std::string& key, const std::string& value);
56 
57  DbInterface(const DbInterface&) = delete;
58  DbInterface& operator= (const DbInterface&) = delete;
59 
60 private:
61  std::string m_prefix;
62  rad::DbAdapter& m_runtime_db;
63 };
64 
65 } // namespace hello
66 
67 #endif // HELLO_DB_INTERFACE_HPP_
68 
hello::DbInterface::GetControlState
std::string GetControlState()
Definition: dbInterface.cpp:46
hello::DbInterface::SetControlStatus
void SetControlStatus(const std::string &value)
Definition: dbInterface.cpp:95
hello::KEY_CONFIG_REQ_ENDPOINT
const std::string KEY_CONFIG_REQ_ENDPOINT
Definition: dbInterface.hpp:23
hello::KEY_CONTROL_STATUS
const std::string KEY_CONTROL_STATUS
Definition: dbInterface.hpp:20
hello::DbInterface::SetControlState
void SetControlState(const std::string &value)
Definition: dbInterface.cpp:79
hello::DbInterface::SetConfig
void SetConfig(Config &cfg)
Definition: dbInterface.cpp:130
hello::KEY_CONTROL_SUBSTATE
const std::string KEY_CONTROL_SUBSTATE
Definition: dbInterface.hpp:19
hello::DbInterface::Set
void Set(const std::string &key, const std::string &value)
Definition: dbInterface.cpp:158
hello::DbInterface::GetControlStatus
std::string GetControlStatus()
Definition: dbInterface.cpp:62
hello::Config
Definition: config.hpp:47
hello::KEY_CONTROL_STATE
const std::string KEY_CONTROL_STATE
Definition: dbInterface.hpp:18
hello::DbInterface::GetControlSubstate
std::string GetControlSubstate()
Definition: dbInterface.cpp:54
hello::KEY_CONTROL_SIMULATION
const std::string KEY_CONTROL_SIMULATION
Definition: dbInterface.hpp:21
hello
Definition: actionMgr.cpp:21
hello::DbInterface::DbInterface
DbInterface(const std::string &prefix, rad::DbAdapter &runtime_db)
Definition: dbInterface.cpp:25
hello::DbInterface
Definition: dbInterface.hpp:38
hello::DbInterface::Get
std::string Get(const std::string &key)
Definition: dbInterface.cpp:71
hello::DbInterface::SetControl
void SetControl(const std::string &state, const std::string &substate, const std::string &status)
Definition: dbInterface.cpp:107
hello::KEY_CONFIG_LOG_PROPERTIES
const std::string KEY_CONFIG_LOG_PROPERTIES
Definition: dbInterface.hpp:30
hello::KEY_CONFIG_DB_ENDPOINT
const std::string KEY_CONFIG_DB_ENDPOINT
Definition: dbInterface.hpp:25
hello::KEY_CONFIG_DB_TIMEOUT_SEC
const std::string KEY_CONFIG_DB_TIMEOUT_SEC
Definition: dbInterface.hpp:26
hello::KEY_CONFIG_FILENAME
const std::string KEY_CONFIG_FILENAME
Definition: dbInterface.hpp:28
hello::KEY_CONFIG_SM_SCXML
const std::string KEY_CONFIG_SM_SCXML
Definition: dbInterface.hpp:27
hello::DbInterface::SetControlSubstate
void SetControlSubstate(const std::string &value)
Definition: dbInterface.cpp:87
hello::KEY_CONFIG_SUB_ENDPOINT
const std::string KEY_CONFIG_SUB_ENDPOINT
Definition: dbInterface.hpp:24
hello::DbInterface::~DbInterface
virtual ~DbInterface()
Definition: dbInterface.cpp:39
hello::KEY_CONFIG_LOG_LEVEL
const std::string KEY_CONFIG_LOG_LEVEL
Definition: dbInterface.hpp:29
rad::DbAdapter
Definition: dbAdapter.hpp:29
hello::DbInterface::DbInterface
DbInterface(const DbInterface &)=delete
hello::DbInterface::operator=
DbInterface & operator=(const DbInterface &)=delete
Disable copy constructor.