ifw-ccf 5.0.2
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ifw::ccf::common::Db Class Reference

Interface to the OLDB and Pub/Sub. More...

#include <db.hpp>

Public Member Functions

 Db ()
 Constructor. The prefix indicates location in database of this application.
 
virtual ~Db ()
 
std::string GenDbPath (const std::vector< std::string > &db_key_els)
 Generate proper DB name.
 
std::map< std::string, std::string > Scan (const std::string &key, const std::string &pattern)
 Scan the namespace of the associated DB, applying the key and pattern.
 
bool IsConnected ()
 Check if connected to the associated database(s).
 
std::string GetSmState ()
 
std::string GetSmStatusState ()
 
std::string GetSmStatusSubstate ()
 
void UpdateSmStatus (std::list< scxml4cpp::State * > &status)
 Update the state/substate/status in the OLDB/PubSub.
 
void UpdateSmStatus (const std::string &status)
 Update the state/substate/status in the OLDB/PubSub.
 
void PublishRecStatus (const recif::RecStatus &rec_status)
 Update the current Recording Status in Pub/Sub.
 
template<class TYPE >
TYPE Get (const std::string &db_key)
 Get value for the given key.
 
template<class TYPE >
TYPE Get2 (const std::vector< std::string > &db_key_els)
 Get value for the given key.
 
std::string GetAsStr (const std::string &db_key)
 Get the attribute as string, in case the type is not know.
 
template<class TYPE >
void Set (const std::string &db_key, const TYPE value, const bool force_update=false)
 Set the referenced key to the given value.
 
template<class TYPE >
void Set2 (const std::vector< std::string > &db_key_els, const TYPE value, const bool force_update=false)
 Set the referenced key to the given value.
 
void SetFromStr (const std::string &db_key, const std::string &par_name, const std::string &value, const bool force_update=false)
 Write the parameter, which values is provided as a string, to the OLDB.
 
void SetFromStr2 (const std::vector< std::string > &db_key_els, const std::string &par_name, const std::string &value, const bool force_update=false)
 Write the parameter, which values is provided as a string, to the OLDB.
 
void SetFromStr (const std::string &db_key, const std::string &value, const ifw::fnd::datatype::DataType data_type, const bool force_update=false)
 Set the value from a string, applying the given IFW data type.
 
void SetFromStr2 (const std::vector< std::string > &db_key_els, const std::string &value, const ifw::fnd::datatype::DataType data_type, const bool force_update=false)
 Set the value from a string, applying the given IFW data type.
 
void TestConnection ()
 Test if the connection to the OLDB is working properly.
 
void UpdateStagingSetupInDb ()
 Update the current Staging Setup buffered in the DB.
 
ifw::core::utils::bat::DbInterface & GetBatDb ()
 Get reference to BAT DB handle.
 
 Db (const Db &)=delete
 
Dboperator= (const Db &)=delete
 Disable copy constructor.
 

Static Public Member Functions

static DbInstance ()
 Return reference to Singleton instance of the application class.
 
static void Simulate ()
 Put the object in simulation, using an internal map as DB.
 
static bool IsSimulated ()
 

Static Public Attributes

static Dbs_instance = nullptr
 Singleton instance.
 

Detailed Description

Interface to the OLDB and Pub/Sub.

Constructor & Destructor Documentation

◆ Db() [1/2]

ifw::ccf::common::Db::Db ( )

Constructor. The prefix indicates location in database of this application.

◆ ~Db()

ifw::ccf::common::Db::~Db ( )
virtual

◆ Db() [2/2]

ifw::ccf::common::Db::Db ( const Db & )
delete

Member Function Documentation

◆ GenDbPath()

std::string ifw::ccf::common::Db::GenDbPath ( const std::vector< std::string > & db_key_els)

Generate proper DB name.

◆ Get()

template<class TYPE >
TYPE ifw::ccf::common::Db::Get ( const std::string & db_key)
inline

Get value for the given key.

◆ Get2()

template<class TYPE >
TYPE ifw::ccf::common::Db::Get2 ( const std::vector< std::string > & db_key_els)
inline

Get value for the given key.

◆ GetAsStr()

std::string ifw::ccf::common::Db::GetAsStr ( const std::string & db_key)

Get the attribute as string, in case the type is not know.

◆ GetBatDb()

ifw::core::utils::bat::DbInterface & ifw::ccf::common::Db::GetBatDb ( )

Get reference to BAT DB handle.

◆ GetSmState()

std::string ifw::ccf::common::Db::GetSmState ( )
Returns
The current state of the application stored in the DB.

◆ GetSmStatusState()

std::string ifw::ccf::common::Db::GetSmStatusState ( )
Returns
The current sub-state of the application stored in the DB.

◆ GetSmStatusSubstate()

std::string ifw::ccf::common::Db::GetSmStatusSubstate ( )
Returns
The current state and sub-state of the application stored in the DB.

◆ Instance()

Db & ifw::ccf::common::Db::Instance ( )
static

Return reference to Singleton instance of the application class.

◆ IsConnected()

bool ifw::ccf::common::Db::IsConnected ( )

Check if connected to the associated database(s).

◆ IsSimulated()

bool ifw::ccf::common::Db::IsSimulated ( )
static

◆ operator=()

Disable copy constructor.

◆ PublishRecStatus()

void ifw::ccf::common::Db::PublishRecStatus ( const recif::RecStatus & rec_status)

Update the current Recording Status in Pub/Sub.

◆ Scan()

std::map< std::string, std::string > ifw::ccf::common::Db::Scan ( const std::string & key,
const std::string & pattern )

Scan the namespace of the associated DB, applying the key and pattern.

◆ Set()

template<class TYPE >
void ifw::ccf::common::Db::Set ( const std::string & db_key,
const TYPE value,
const bool force_update = false )
inline

Set the referenced key to the given value.

◆ Set2()

template<class TYPE >
void ifw::ccf::common::Db::Set2 ( const std::vector< std::string > & db_key_els,
const TYPE value,
const bool force_update = false )
inline

Set the referenced key to the given value.

◆ SetFromStr() [1/2]

void ifw::ccf::common::Db::SetFromStr ( const std::string & db_key,
const std::string & par_name,
const std::string & value,
const bool force_update = false )

Write the parameter, which values is provided as a string, to the OLDB.

◆ SetFromStr() [2/2]

void ifw::ccf::common::Db::SetFromStr ( const std::string & db_key,
const std::string & value,
const ifw::fnd::datatype::DataType data_type,
const bool force_update = false )

Set the value from a string, applying the given IFW data type.

◆ SetFromStr2() [1/2]

void ifw::ccf::common::Db::SetFromStr2 ( const std::vector< std::string > & db_key_els,
const std::string & par_name,
const std::string & value,
const bool force_update = false )

Write the parameter, which values is provided as a string, to the OLDB.

◆ SetFromStr2() [2/2]

void ifw::ccf::common::Db::SetFromStr2 ( const std::vector< std::string > & db_key_els,
const std::string & value,
const ifw::fnd::datatype::DataType data_type,
const bool force_update = false )

Set the value from a string, applying the given IFW data type.

◆ Simulate()

void ifw::ccf::common::Db::Simulate ( )
static

Put the object in simulation, using an internal map as DB.

◆ TestConnection()

void ifw::ccf::common::Db::TestConnection ( )

Test if the connection to the OLDB is working properly.

◆ UpdateSmStatus() [1/2]

void ifw::ccf::common::Db::UpdateSmStatus ( const std::string & status)

Update the state/substate/status in the OLDB/PubSub.

◆ UpdateSmStatus() [2/2]

void ifw::ccf::common::Db::UpdateSmStatus ( std::list< scxml4cpp::State * > & status)

Update the state/substate/status in the OLDB/PubSub.

◆ UpdateStagingSetupInDb()

void ifw::ccf::common::Db::UpdateStagingSetupInDb ( )

Update the current Staging Setup buffered in the DB.

Member Data Documentation

◆ s_instance

Db * ifw::ccf::common::Db::s_instance = nullptr
static

Singleton instance.


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