ifw-sup  1.0.0
Public Member Functions | List of all members
sup::syssup::common::DataContext Class Reference

#include <dataContext.hpp>

Public Member Functions

 DataContext (IConfig &config, rad::DbAdapter &db_adapter, boost::asio::io_service &ios)
 
virtual ~DataContext ()
 
void ReloadConfig ()
 
void UpdateDb ()
 
DbInterfaceGetDbInterface ()
 
IConfigGetConfig ()
 
State::StateEnum GetState ()
 Get server actual state. More...
 
void SetState (const State::StateEnum state)
 Set server actual state. More...
 
void SetState (const std::string &state)
 Set server actual state. More...
 
State::SubstateEnum GetSubstate ()
 Get server actual substate. More...
 
void SetSubstate (const State::SubstateEnum state)
 Set server actual substate. More...
 
void SetSubstate (const std::string &state)
 Set server actual substate. More...
 
State::StateEnum GetEstimatedState ()
 Get actual estimated state. More...
 
std::string GetEstimatedStateStr ()
 Set actual estimated state as string. More...
 
void SetEstimatedState (const State::StateEnum state)
 Set actual estimated state. More...
 
std::string GetEstimatedSubstateStr ()
 Get actual estimated substate as string. More...
 
State::SubstateEnum GetEstimatedSubstate ()
 Get actual estimated substate. More...
 
void SetEstimatedSubstate (const State::SubstateEnum state)
 Set actual estimated substate. More...
 
void PublishStates ()
 Publish actual states. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ DataContext()

sup::syssup::common::DataContext::DataContext ( IConfig config,
rad::DbAdapter &  db_adapter,
boost::asio::io_service &  ios 
)

This constructor uses the application configuration to initialize the adapter object to the in-memory DB. The DB adapter is then used to initialize the DB interface object that can be used to access the DB key-value pairs.

Parameters
[in]configReference to the application configuration.
[in]db_adapterDB adapter object
[in]iosASIO IO service reference

◆ ~DataContext()

sup::syssup::common::DataContext::~DataContext ( )
virtual

Destructor

Member Function Documentation

◆ GetConfig()

IConfig & sup::syssup::common::DataContext::GetConfig ( )
Returns
A reference to the Config object.

◆ GetDbInterface()

DbInterface & sup::syssup::common::DataContext::GetDbInterface ( )
Returns
A reference to the DB interface object.

◆ GetEstimatedState()

State::StateEnum sup::syssup::common::DataContext::GetEstimatedState ( )

Get actual estimated state.

Returns

◆ GetEstimatedStateStr()

std::string sup::syssup::common::DataContext::GetEstimatedStateStr ( )

Set actual estimated state as string.

Returns

◆ GetEstimatedSubstate()

State::SubstateEnum sup::syssup::common::DataContext::GetEstimatedSubstate ( )

Get actual estimated substate.

Returns

◆ GetEstimatedSubstateStr()

std::string sup::syssup::common::DataContext::GetEstimatedSubstateStr ( )

Get actual estimated substate as string.

Returns

◆ GetState()

State::StateEnum sup::syssup::common::DataContext::GetState ( )

Get server actual state.

Returns

◆ GetSubstate()

State::SubstateEnum sup::syssup::common::DataContext::GetSubstate ( )

Get server actual substate.

Returns

◆ PublishStates()

void sup::syssup::common::DataContext::PublishStates ( )

Publish actual states.

It updates the OLDB and publish status via CII pub/sub.

◆ ReloadConfig()

void sup::syssup::common::DataContext::ReloadConfig ( )

Reload the configuration from file and reconnect to the in-memory DB.

◆ SetEstimatedState()

void sup::syssup::common::DataContext::SetEstimatedState ( const State::StateEnum  state)

Set actual estimated state.

Parameters
statenew state as string

◆ SetEstimatedSubstate()

void sup::syssup::common::DataContext::SetEstimatedSubstate ( const State::SubstateEnum  state)

Set actual estimated substate.

Parameters
statenew substate as string

◆ SetState() [1/2]

void sup::syssup::common::DataContext::SetState ( const State::StateEnum  state)

Set server actual state.

Parameters
statenew state as enumeration

◆ SetState() [2/2]

void sup::syssup::common::DataContext::SetState ( const std::string &  state)

Set server actual state.

Parameters
statenew state as string

◆ SetSubstate() [1/2]

void sup::syssup::common::DataContext::SetSubstate ( const State::SubstateEnum  state)

Set server actual substate.

Parameters
statenew substate as enumeration

◆ SetSubstate() [2/2]

void sup::syssup::common::DataContext::SetSubstate ( const std::string &  state)

Set server actual substate.

Parameters
statenew substate as string

◆ UpdateDb()

void sup::syssup::common::DataContext::UpdateDb ( )

Try to connect to the DB and update the application configuration.


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