|
HLCC Documentation 2.2.0
|
#include <dataContext.hpp>
Public Member Functions | |
| DataContext (std::shared_ptr< OldbInterface > oldb_interface=nullptr) | |
| virtual | ~DataContext () |
| void | ReloadConfig () override |
| Config & | GetConfig () override |
| const Config & | GetConfigConst () const |
| void | UpdateDb () override |
| OldbInterface & | GetOldbInterface () override |
| void | EnablePublishing (bool enabled) |
| bool | IsPublishingEnabled () const |
| DataContext (const DataContext &)=delete | |
| DataContext & | operator= (const DataContext &)=delete |
| Disable copy constructor. | |
This class provide access to the application run-time data including the in-memory DB.
| hlcc::pfssimhlcc::DataContext::DataContext | ( | std::shared_ptr< OldbInterface > | oldb_interface = nullptr | ) |
This constructor uses the application configuration to initialize the adapter object to the in-memory DB.
| [in] | oldb_interface | Can be passed explicitly to use a mock for testing. Otherwise it will be created. |
|
virtual |
Destructor
|
delete |
| void hlcc::pfssimhlcc::DataContext::EnablePublishing | ( | bool | enabled | ) |
Normally methods of DataContext write to the OLDB, or also publish data on channels. This method allows controlling this behavior, e.g. for unit tests.
| enabled | true enables publishing, false disables it (or also when the MS LSV does the publishing instead???) |
|
override |
| const Config & hlcc::pfssimhlcc::DataContext::GetConfigConst | ( | ) | const |
|
override |
| bool hlcc::pfssimhlcc::DataContext::IsPublishingEnabled | ( | ) | const |
|
delete |
Disable copy constructor.
|
override |
Reload the configuration from file.
|
override |
Try to connect to the DB and write the application configuration to the OLDB.
Initially called by rad::Application::Init. Later also called by, e.g., ActionsApp::SetConfig.
We initialize the telescope position with the value from OLDB, reflecting a previous run. The target pos also gets initialized to the current pos so that the telescope initially stands still.
rad::Application::Init calls only DataContext::UpdateDb, but no other, more suitable, init method of DataContext. Note that in the ctor of DataContext, Config is not yet initialized and thus we cannot use OldbInterface yet.