OpenDaVINCI  4.15.3
odcore::wrapper::SimpleDB::SimpleDB Class Reference

#include <SimpleDB.h>

Inheritance diagram for odcore::wrapper::SimpleDB::SimpleDB:
Inheritance graph

Public Member Functions

virtual ~SimpleDB ()
 
virtual void put (const int32_t &key, const string &value)
 
virtual const string get (const int32_t &key) const
 

Protected Member Functions

 SimpleDB ()
 

Protected Attributes

unique_ptr< Mutexm_mutex
 
map< int, string > m_entries
 

Friends

class KeyValueDatabaseFactoryWorker< KeyValueDatabaseSimpleDB >
 

Constructor & Destructor Documentation

odcore::wrapper::SimpleDB::SimpleDB::SimpleDB ( )
protected
odcore::wrapper::SimpleDB::SimpleDB::~SimpleDB ( )
virtual

References m_entries.

Member Function Documentation

const string odcore::wrapper::SimpleDB::SimpleDB::get ( const int32_t &  key) const
virtual

This method returns the value for a key. The value for a non-existing key is "".

Parameters
keyThe key for which the value has to be returned.
Returns
The value.

Implements odcore::wrapper::KeyValueDatabase.

References m_entries, and m_mutex.

void odcore::wrapper::SimpleDB::SimpleDB::put ( const int32_t &  key,
const string &  value 
)
virtual

This method puts a key/value pair into the database. An existing entry is substituted.

Parameters
keyThe key.
valueThe value.

Implements odcore::wrapper::KeyValueDatabase.

References m_entries, and m_mutex.

Friends And Related Function Documentation

Member Data Documentation

map<int, string> odcore::wrapper::SimpleDB::SimpleDB::m_entries
mutableprotected

Referenced by get(), put(), and ~SimpleDB().

unique_ptr<Mutex> odcore::wrapper::SimpleDB::SimpleDB::m_mutex
protected

Referenced by get(), put(), and SimpleDB().