OpenDaVINCI  4.15.3
odcore::base::KeyValueDataStore Class Reference

#include <KeyValueDataStore.h>

Public Member Functions

 KeyValueDataStore (std::shared_ptr< wrapper::KeyValueDatabase > keyValueDatabase) throw (odcore::exceptions::NoDatabaseAvailableException)
 
virtual ~KeyValueDataStore ()
 
virtual void put (const int32_t &key, const data::Container &value)
 
data::Container get (const int32_t &key) const
 

Detailed Description

This class is a key/value-based implementation for a datastore. It can be used as follows:

KeyValueDataStore &kv = new KeyValueDataStore(wrapper::KeyValueDatabaseFactory::createKeyValueDatabase());
int32_t key = 1;
TimeStamp ts;
Container c(TIMESTAMP, ts);
kv.put(key, c);

Constructor & Destructor Documentation

odcore::base::KeyValueDataStore::KeyValueDataStore ( std::shared_ptr< wrapper::KeyValueDatabase keyValueDatabase)
throw (odcore::exceptions::NoDatabaseAvailableException
)

Constructor.

Parameters
keyValueDatabaseAssociated key/value database.
Exceptions
NoDatabaseAvailableExceptionif keyValueDatabase is NULL.

References OPENDAVINCI_CORE_THROW_EXCEPTION.

odcore::base::KeyValueDataStore::~KeyValueDataStore ( )
virtual

Member Function Documentation

Container odcore::base::KeyValueDataStore::get ( const int32_t &  key) const

This method returns the value for a key.

Parameters
keyThe key for which the value has to be returned.
Returns
The value.
void odcore::base::KeyValueDataStore::put ( const int32_t &  key,
const data::Container value 
)
virtual

This method puts a key/value pair into the data store.

Parameters
keyThe key.
valueThe value.