ifw-ccf  1.0.0
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 (const std::string &prefix)
 Constructor. The prefix indicates location in database of this application. More...
 
virtual ~Db ()
 
void Disconnect ()
 Disconnect from the assosicated database(s). More...
 
void Connect ()
 Connect to the associated database(s). 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::set< 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...
 
std::string Get (const std::string &key)
 Get value for the given key. More...
 
std::vector< std::string > MultiGet (const std::vector< std::string > &keys)
 Get multiple keys from the DB. More...
 
bool Exists (const std::string &key)
 Check if the given key exists. More...
 
int Delete (const std::vector< std::string > &keys)
 Delete the keys specified. More...
 
void Set (const std::string &key, const std::string &value)
 Set the referenced key to the given value. More...
 
template<class TYPE >
void Set (const std::string &key, TYPE value)
 Set the referenced key to the given value. More...
 
const std::string & GetAddress (const std::string &key)
 Get the complete address of the given key (append the index if missing and cache the name). More...
 
 Db (const Db &)=delete
 
Dboperator= (const Db &)=delete
 Disable copy constructor. More...
 
rad::DbAdapter & GetDb ()
 Disable assignment operator. 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 = NULL
 Singleton instance. More...
 

Detailed Description

Interface to the OLDB and Pub/Sub.

Constructor & Destructor Documentation

◆ Db() [1/2]

ccf::common::Db::Db ( const std::string &  prefix)

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

◆ Connect()

void ccf::common::Db::Connect ( )

Connect to the associated database(s).

◆ Delete()

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

Delete the keys specified.

◆ Disconnect()

void ccf::common::Db::Disconnect ( )

Disconnect from the assosicated database(s).

◆ Exists()

bool ccf::common::Db::Exists ( const std::string &  key)

Check if the given key exists.

◆ Get()

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

Get value for the given key.

◆ GetAddress()

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

Get the complete address of the given key (append the index if missing and cache the name).

◆ GetDb()

rad::DbAdapter & ccf::common::Db::GetDb ( )

Disable assignment operator.

Get reference to DB used.

◆ 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).

◆ MultiGet()

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

Get multiple keys from the DB.

◆ 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() [1/2]

void ccf::common::Db::Set ( const std::string &  key,
const std::string &  value 
)

Set the referenced key to the given value.

◆ Set() [2/2]

template<class TYPE >
void ccf::common::Db::Set ( const std::string &  key,
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.

◆ 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::set< scxml4cpp::State * > &  status)

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

Member Data Documentation

◆ s_instance

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

Singleton instance.


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