Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
IStorage< Key, Data > Class Template Referenceabstract

Generic storage interface for key–value containers. More...

#include <IStorage.h>

Public Member Functions

virtual ~IStorage ()=default
 
virtual void store (const Key &key, std::shared_ptr< Data > data)=0
 Stores a new element.
 
virtual void assign (const Key &key, std::shared_ptr< Data > data)=0
 Assigns/replaces the data for an existing key.
 
virtual void store_or_assign (const Key &key, std::shared_ptr< Data > data)=0
 Stores or assigns depending on key presence.
 
virtual bool contains (const Key &key) const =0
 Checks if a given key is present in the storage.
 
virtual std::shared_ptr< Data > retrieve (const Key &key)=0
 Retrieves the data associated with a key.
 
virtual void remove (const Key &key)=0
 Removes the entry associated with a key.
 

Detailed Description

template<typename Key, typename Data>
class IStorage< Key, Data >

Generic storage interface for key–value containers.

This template defines the minimal operations required for a storage-like container:

  • insertion (store),
  • replacement (assign),
  • store-or-assign,
  • membership test,
  • retrieval,
  • removal.

It is used by Block as a base abstraction.

Template Parameters
KeyType of the key (e.g. LhaID).
DataStored data type (e.g. Parameter).

Definition at line 24 of file IStorage.h.

Constructor & Destructor Documentation

◆ ~IStorage()

template<typename Key , typename Data >
virtual IStorage< Key, Data >::~IStorage ( )
virtualdefault

Member Function Documentation

◆ assign()

template<typename Key , typename Data >
virtual void IStorage< Key, Data >::assign ( const Key &  key,
std::shared_ptr< Data >  data 
)
pure virtual

Assigns/replaces the data for an existing key.

Implementations typically expect the key to exist and may error or log if it does not.

Parameters
keyKey to update.
dataShared pointer to the new data object.

Implemented in DependentBlock, and Block.

◆ contains()

template<typename Key , typename Data >
virtual bool IStorage< Key, Data >::contains ( const Key &  key) const
pure virtual

Checks if a given key is present in the storage.

Parameters
keyKey to test.
Returns
True if the key exists, false otherwise.

Implemented in Block.

◆ remove()

template<typename Key , typename Data >
virtual void IStorage< Key, Data >::remove ( const Key &  key)
pure virtual

Removes the entry associated with a key.

If the key does not exist, the behavior depends on the implementation (may be a no-op, log, or throw).

Parameters
keyKey to remove.

Implemented in Block.

◆ retrieve()

template<typename Key , typename Data >
virtual std::shared_ptr< Data > IStorage< Key, Data >::retrieve ( const Key &  key)
pure virtual

Retrieves the data associated with a key.

Semantics on non-existing keys are up to the implementation (may throw, log, or return nullptr).

Parameters
keyKey to retrieve.
Returns
Shared pointer to the stored data.

Implemented in Block.

◆ store()

template<typename Key , typename Data >
virtual void IStorage< Key, Data >::store ( const Key &  key,
std::shared_ptr< Data >  data 
)
pure virtual

Stores a new element.

Behavior when the key already exists depends on the implementation (it may overwrite, ignore, or log an error).

Parameters
keyKey associated with the data.
dataShared pointer to the data object.

Implemented in Block.

◆ store_or_assign()

template<typename Key , typename Data >
virtual void IStorage< Key, Data >::store_or_assign ( const Key &  key,
std::shared_ptr< Data >  data 
)
pure virtual

Stores or assigns depending on key presence.

Typically:

  • if key exists → behaves like assign(),
  • otherwise → behaves like store().
Parameters
keyKey to store or update.
dataShared pointer to the data object.

Implemented in Block.


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