ifw-ccf  3.0.0-pre2
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
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. More...
 
virtual ~Db ()
 
std::string GenDbPath (const std::vector< std::string > &keys)
 Generate proper DB name. More...
 
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. More...
 
bool IsConnected ()
 Check if connected to the associated database(s). More...
 
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. More...
 
void UpdateSmStatus (const std::string &status)
 Update the state/substate/status in the OLDB/PubSub. More...
 
template<class TYPE >
TYPE Get (const std::string &key)
 Get value for the given key. More...
 
template<class TYPE >
TYPE Get2 (const std::vector< std::string > &keys)
 Get value for the given key. More...
 
std::string GetAsStr (const std::string &key)
 Get the attribute as string, in case the type is not know. More...
 
template<class TYPE >
void Set (const std::string &key, const TYPE value)
 Set the referenced key to the given value. More...
 
template<class TYPE >
void Set2 (const std::vector< std::string > &keys, const TYPE value)
 Set the referenced key to the given value. More...
 
void TestConnection ()
 Test if the connection to the OLDB is working properly. More...
 
 Db (const Db &)=delete
 
Dboperator= (const Db &)=delete
 Disable copy constructor. More...
 

Static Public Member Functions

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

Static Public Attributes

static Dbs_instance = nullptr
 Singleton instance. More...
 

Detailed Description

Interface to the OLDB and Pub/Sub.

Constructor & Destructor Documentation

◆ Db() [1/2]

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

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

◆ ~Db()

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

◆ Db() [2/2]

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

Member Function Documentation

◆ GenDbPath()

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

Generate proper DB name.

◆ Get()

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

Get value for the given key.

◆ Get2()

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

Get value for the given key.

◆ GetAsStr()

std::string ccf::common::Db::GetAsStr ( const std::string &  key)

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

◆ GetSmState()

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

◆ GetSmStatusState()

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

◆ GetSmStatusSubstate()

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

◆ Instance()

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

Return reference to Singleton instance of the application class.

◆ IsConnected()

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

Check if connected to the associated database(s).

◆ operator=()

Db& ccf::common::Db::operator= ( const Db )
delete

Disable copy constructor.

◆ Scan()

std::map< std::string, std::string > 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 ccf::common::Db::Set ( const std::string &  key,
const TYPE  value 
)
inline

Set the referenced key to the given value.

◆ Set2()

template<class TYPE >
void ccf::common::Db::Set2 ( const std::vector< std::string > &  keys,
const TYPE  value 
)
inline

Set the referenced key to the given value.

◆ Simulate()

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

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

◆ TestConnection()

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

Test if the connection to the OLDB is working properly.

◆ UpdateSmStatus() [1/2]

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

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

◆ UpdateSmStatus() [2/2]

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

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

Member Data Documentation

◆ s_instance

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

Singleton instance.


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