CDatapool Class Reference

temporary data storage to avoid storing on disk More...

#include <mia/core/datapool.hh>

Public Member Functions

void add (const std::string &key, boost::any value)
 
void clear ()
 
boost::any get (const std::string &key) const
 
boost::any get_and_remove (const std::string &key)
 
bool has_key (const std::string &key) const
 
bool has_unused_data () const
 
void remove (const std::string &key)
 

Static Public Member Functions

static CDatapoolinstance ()
 

Detailed Description

temporary data storage to avoid storing on disk

This class implements a data storage pool as a singelton that can be used to store some data temporarly like if it would be stored on disk. Each IO plugin automatically defines an interface to store in and load from this pool. The extension, by which this behaviour is triggered is ".@".

Todo:

add delete key function,

add automatic key generation

(maybe) all plugins that load data should load to the pool first to enable loading from temporarly generated data

Definition at line 48 of file datapool.hh.

Member Function Documentation

◆ add()

void CDatapool::add ( const std::string &  key,
boost::any  value 
)

add some data to the pool, if the key already exists, the value is replaced

Parameters
keyunique identifier
valuevalue to be stored

◆ clear()

void CDatapool::clear ( )

Remove all stored data from the pool.

◆ get()

boost::any CDatapool::get ( const std::string &  key) const
Parameters
keykey of data to be retrieved
Returns
value indexed by key, and throws invalid argument if value not exists

Referenced by TDelayedParameter< T >::get().

◆ get_and_remove()

boost::any CDatapool::get_and_remove ( const std::string &  key)

gets some data and remove this data from the pool

Parameters
keykey of data to be retrieved
Returns
value indexed by key, and throws invalid argument if value not exists

◆ has_key()

bool CDatapool::has_key ( const std::string &  key) const
Parameters
key
Returns
true if key exists in pool and false if not

Referenced by TDelayedParameter< T >::pool_has_key().

◆ has_unused_data()

bool CDatapool::has_unused_data ( ) const

function to be used for debugging purpouses

Returns
true if the pool has some data that was not uses

◆ instance()

static CDatapool& CDatapool::instance ( )
static
Returns
the unique instance of the data pool

Referenced by TDelayedParameter< T >::get(), and TDelayedParameter< T >::pool_has_key().

◆ remove()

void CDatapool::remove ( const std::string &  key)

remove this data from the pool

Parameters
keykey of data to be retrieved

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