HLCC Documentation 2.2.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
hlcc::pfssimhlcc::DataContext Class Reference

#include <dataContext.hpp>

Inheritance diagram for hlcc::pfssimhlcc::DataContext:

Public Member Functions

 DataContext (std::shared_ptr< OldbInterface > oldb_interface=nullptr)
 
virtual ~DataContext ()
 
void ReloadConfig () override
 
ConfigGetConfig () override
 
const ConfigGetConfigConst () const
 
void UpdateDb () override
 
OldbInterfaceGetOldbInterface () override
 
void EnablePublishing (bool enabled)
 
bool IsPublishingEnabled () const
 
 DataContext (const DataContext &)=delete
 
DataContextoperator= (const DataContext &)=delete
 Disable copy constructor.
 

Detailed Description

This class provide access to the application run-time data including the in-memory DB.

Constructor & Destructor Documentation

◆ DataContext() [1/2]

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.

Parameters
[in]oldb_interfaceCan be passed explicitly to use a mock for testing. Otherwise it will be created.

◆ ~DataContext()

hlcc::pfssimhlcc::DataContext::~DataContext ( )
virtual

Destructor

◆ DataContext() [2/2]

hlcc::pfssimhlcc::DataContext::DataContext ( const DataContext & )
delete

Member Function Documentation

◆ EnablePublishing()

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.

Parameters
enabledtrue enables publishing, false disables it (or also when the MS LSV does the publishing instead???)

◆ GetConfig()

Config & hlcc::pfssimhlcc::DataContext::GetConfig ( )
override
Returns
reference to the Config object.

◆ GetConfigConst()

const Config & hlcc::pfssimhlcc::DataContext::GetConfigConst ( ) const
Returns
const reference to the Config object. This allows having const methods in DataContext that get config parameters.

◆ GetOldbInterface()

OldbInterface & hlcc::pfssimhlcc::DataContext::GetOldbInterface ( )
override
Returns
A reference to the OLDB interface object.

◆ IsPublishingEnabled()

bool hlcc::pfssimhlcc::DataContext::IsPublishingEnabled ( ) const

◆ operator=()

DataContext & hlcc::pfssimhlcc::DataContext::operator= ( const DataContext & )
delete

Disable copy constructor.

◆ ReloadConfig()

void hlcc::pfssimhlcc::DataContext::ReloadConfig ( )
override

Reload the configuration from file.

◆ UpdateDb()

void hlcc::pfssimhlcc::DataContext::UpdateDb ( )
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.


The documentation for this class was generated from the following files: