rad  3.0.0
dbInterface.hpp
Go to the documentation of this file.
1 
9 #ifndef EXMALSERVER_DB_INTERFACE_HPP_
10 #define EXMALSERVER_DB_INTERFACE_HPP_
11 
12 #include <rad/dbAdapter.hpp>
13 
14 #include <string>
15 
16 namespace exmalserver {
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 
36 class DbInterface {
37  public:
44  DbInterface(const std::string& prefix, rad::DbAdapter& runtime_db);
45 
49  virtual ~DbInterface();
50 
54  std::string GetControlState();
55 
59  std::string GetControlSubstate();
60 
64  std::string GetControlStatus();
65 
70  std::string Get(const std::string& key);
71 
75  void SetControlState(const std::string& value);
76 
80  void SetControlSubstate(const std::string& value);
81 
85  void SetControlStatus(const std::string& value);
86 
94  void SetControl(const std::string& state, const std::string& substate,
95  const std::string& status);
96 
102  void SetConfig(Config& cfg);
103 
108  void Set(const std::string& key, const std::string& value);
109 
110  DbInterface(const DbInterface&) = delete;
111  DbInterface& operator=(const DbInterface&) = delete;
112 
113  private:
114  std::string m_prefix;
115  rad::DbAdapter& m_runtime_db;
116 };
117 
118 } // namespace exmalserver
119 
120 #endif // EXMALSERVER_DB_INTERFACE_HPP_
exmalserver::KEY_CONFIG_LOG_PROPERTIES
const std::string KEY_CONFIG_LOG_PROPERTIES
Definition: dbInterface.hpp:29
exmalserver::DbInterface::operator=
DbInterface & operator=(const DbInterface &)=delete
Disable copy constructor.
exmalserver::DbInterface::SetControlStatus
void SetControlStatus(const std::string &value)
Definition: dbInterface.cpp:60
exmalserver
Definition: actionMgr.cpp:24
exmalserver::DbInterface::Get
std::string Get(const std::string &key)
Definition: dbInterface.cpp:45
exmalserver::KEY_CONFIG_DB_ENDPOINT
const std::string KEY_CONFIG_DB_ENDPOINT
Definition: dbInterface.hpp:24
exmalserver::DbInterface::GetControlStatus
std::string GetControlStatus()
Definition: dbInterface.cpp:40
exmalserver::DbInterface::GetControlSubstate
std::string GetControlSubstate()
Definition: dbInterface.cpp:35
exmalserver::KEY_CONFIG_FILENAME
const std::string KEY_CONFIG_FILENAME
Definition: dbInterface.hpp:27
exmalserver::KEY_CONFIG_DB_TIMEOUT_SEC
const std::string KEY_CONFIG_DB_TIMEOUT_SEC
Definition: dbInterface.hpp:25
exmalserver::DbInterface::SetControl
void SetControl(const std::string &state, const std::string &substate, const std::string &status)
Definition: dbInterface.cpp:65
exmalserver::DbInterface::~DbInterface
virtual ~DbInterface()
Definition: dbInterface.cpp:28
exmalserver::DbInterface
Definition: dbInterface.hpp:36
exmalserver::KEY_CONTROL_STATUS
const std::string KEY_CONTROL_STATUS
Definition: dbInterface.hpp:20
exmalserver::DbInterface::SetConfig
void SetConfig(Config &cfg)
Definition: dbInterface.cpp:86
exmalserver::Config
Definition: config.hpp:41
exmalserver::KEY_CONTROL_SIMULATION
const std::string KEY_CONTROL_SIMULATION
Definition: dbInterface.hpp:21
exmalserver::KEY_CONFIG_LOG_LEVEL
const std::string KEY_CONFIG_LOG_LEVEL
Definition: dbInterface.hpp:28
exmalserver::DbInterface::GetControlState
std::string GetControlState()
Definition: dbInterface.cpp:30
exmalserver::DbInterface::SetControlState
void SetControlState(const std::string &value)
Definition: dbInterface.cpp:50
exmalserver::KEY_CONTROL_SUBSTATE
const std::string KEY_CONTROL_SUBSTATE
Definition: dbInterface.hpp:19
exmalserver::DbInterface::DbInterface
DbInterface(const std::string &prefix, rad::DbAdapter &runtime_db)
Definition: dbInterface.cpp:19
exmalserver::DbInterface::Set
void Set(const std::string &key, const std::string &value)
Definition: dbInterface.cpp:109
exmalserver::DbInterface::DbInterface
DbInterface(const DbInterface &)=delete
dbAdapter.hpp
DbAdapter class header file.
exmalserver::KEY_CONTROL_STATE
const std::string KEY_CONTROL_STATE
Definition: dbInterface.hpp:18
exmalserver::DbInterface::SetControlSubstate
void SetControlSubstate(const std::string &value)
Definition: dbInterface.cpp:55
rad::DbAdapter
Definition: dbAdapter.hpp:29
exmalserver::KEY_CONFIG_SM_SCXML
const std::string KEY_CONFIG_SM_SCXML
Definition: dbInterface.hpp:26
exmalserver::KEY_CONFIG_REQ_ENDPOINT
const std::string KEY_CONFIG_REQ_ENDPOINT
Definition: dbInterface.hpp:23