ifw-daq  3.0.0-pre2
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::OldbAsyncWriter& writer);
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  DbInterface m_db_interface;
60 };
61 
62 } // namespace server
63 
64 #endif // SERVER_DATA_CONTEXT_HPP_
This class provide access to the command line options and the configuration parameters stored in the ...
Definition: config.hpp:60
This class provide access to the application run-time data including the in-memory DB.
Definition: dataContext.hpp:21
virtual ~DataContext()
Destructor.
Definition: dataContext.cpp:26
void UpdateDb()
Try to connect to the DB and update the application configuration.
Definition: dataContext.cpp:37
DataContext(Config &config, rad::OldbAsyncWriter &writer)
This constructor uses the application configuration to initialize the adapter object to the in-memory...
Definition: dataContext.cpp:19
void ReloadConfig()
Reload the configuration from file and reconnect to the in-memory DB.
Definition: dataContext.cpp:30
DbInterface & GetDbInterface()
Definition: dataContext.cpp:50
DataContext(const DataContext &)=delete
DataContext & operator=(const DataContext &)=delete
Disable copy constructor.
This class is the write-only interface to the CII OLDB.
Definition: dbInterface.hpp:46
DbInterface class header file.
Config class header file.