ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
dataContext.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup server
4  * @copyright ESO - European Southern Observatory
5  * @author
6  *
7  * @brief DataContext class header file.
8  */
9 #ifndef SERVER_DATA_CONTEXT_HPP_
10 #define SERVER_DATA_CONTEXT_HPP_
11 
12 #include "config.hpp"
13 #include "dbInterface.hpp"
14 
15 namespace server {
16 
17 /**
18  * This class provide access to the application run-time data including
19  * the in-memory DB.
20  */
21 class DataContext {
22  public:
23  /**
24  * This constructor uses the application configuration to initialize the
25  * adapter object to the in-memory DB.
26  * The DB adapter is then used to initialize the DB interface object that
27  * can be used to access the DB key-value pairs.
28  *
29  * @param[in] config Reference to the application configuration.
30  */
31 
32  DataContext(Config& config, rad::DbAdapter& db_adapter);
33 
34  /**
35  * Destructor
36  */
37  virtual ~DataContext();
38 
39  /**
40  * Reload the configuration from file and reconnect to the in-memory DB.
41  */
42  void ReloadConfig();
43 
44  /**
45  * Try to connect to the DB and update the application configuration.
46  */
47  void UpdateDb();
48 
49  /**
50  * @return A reference to the DB interface object.
51  */
53 
54  DataContext(const DataContext&) = delete; //! Disable copy constructor
55  DataContext& operator=(const DataContext&) = delete; //! Disable assignment operator
56 
57  private:
58  Config& m_config;
59  rad::DbAdapter& m_runtime_db;
60  DbInterface m_db_interface;
61 };
62 
63 } // namespace server
64 
65 #endif // SERVER_DATA_CONTEXT_HPP_
server::DbInterface
This class is the interface to the in-memory DB.
Definition: dbInterface.hpp:46
server::DataContext::operator=
DataContext & operator=(const DataContext &)=delete
Disable copy constructor.
server::DataContext::DataContext
DataContext(Config &config, rad::DbAdapter &db_adapter)
This constructor uses the application configuration to initialize the adapter object to the in-memory...
Definition: dataContext.cpp:19
config.hpp
Config class header file.
server::DataContext::DataContext
DataContext(const DataContext &)=delete
server::DataContext::UpdateDb
void UpdateDb()
Try to connect to the DB and update the application configuration.
Definition: dataContext.cpp:38
dbInterface.hpp
DbInterface class header file.
server::DataContext::GetDbInterface
DbInterface & GetDbInterface()
Definition: dataContext.cpp:55
server::DataContext
This class provide access to the application run-time data including the in-memory DB.
Definition: dataContext.hpp:21
server
Definition: actionMgr.cpp:21
server::DataContext::~DataContext
virtual ~DataContext()
Destructor.
Definition: dataContext.cpp:27
server::DataContext::ReloadConfig
void ReloadConfig()
Reload the configuration from file and reconnect to the in-memory DB.
Definition: dataContext.cpp:31
server::Config
This class provide access to the command line options and the configuration parameters stored in the ...
Definition: config.hpp:46