Iguana LATEST
Implementation Guardian of Analysis Algorithms
Loading...
Searching...
No Matches
iguana::ConcurrentParam< T > Class Template Referenceabstract

#include <ConcurrentParam.h>

Detailed Description

template<typename T>
class iguana::ConcurrentParam< T >

abstract base class for concurrently mutable configuration parameters

See also
iguana::ConcurrentParamFactory for instantiation

Definition at line 19 of file ConcurrentParam.h.

Public Member Functions

 ConcurrentParam (std::string const &model, std::string const &name)
virtual bool HasKey (concurrent_key_t const key) const =0
virtual T const Load (concurrent_key_t const key) const =0
 access a stored value
virtual bool NeedsUpdate (T const &value, concurrent_key_t const key) const =0
 if either key is not found or value does not match the value at key, the caller likely needs to call Save
virtual void Save (T const &value, concurrent_key_t const key)=0
 modify a value

Protected Attributes

std::shared_mutex m_mutex
 mutex for this ConcurrentParam
std::string const m_name
 a name for this parameter
Inheritance diagram for iguana::ConcurrentParam< T >:
Inheritance graph

Constructor & Destructor Documentation

◆ ConcurrentParam()

template<typename T>
iguana::ConcurrentParam< T >::ConcurrentParam ( std::string const & model,
std::string const & name )
Parameters
modelthe concurrency model this instance must be
namethe name of this parameter
See also
please use ConcurrentParamFactory::Create() for instantiation in algorithms

Member Function Documentation

◆ HasKey()

template<typename T>
virtual bool iguana::ConcurrentParam< T >::HasKey ( concurrent_key_t const key) const
pure virtual
Parameters
keythe key
Returns
true if key key is used

Implemented in iguana::MemoizedParam< T >, and iguana::SingleThreadParam< T >.

◆ Load()

template<typename T>
virtual T const iguana::ConcurrentParam< T >::Load ( concurrent_key_t const key) const
pure virtual

access a stored value

Parameters
keythe access key
Returns
the stored value

Implemented in iguana::MemoizedParam< T >, and iguana::SingleThreadParam< T >.

◆ NeedsUpdate()

template<typename T>
virtual bool iguana::ConcurrentParam< T >::NeedsUpdate ( T const & value,
concurrent_key_t const key ) const
pure virtual

if either key is not found or value does not match the value at key, the caller likely needs to call Save

Parameters
valuethe expected value
keythe key for the expected value
Returns
true if update is needed

Implemented in iguana::MemoizedParam< T >, and iguana::SingleThreadParam< T >.

◆ Save()

template<typename T>
virtual void iguana::ConcurrentParam< T >::Save ( T const & value,
concurrent_key_t const key )
pure virtual

modify a value

Parameters
valuethe value
keythe access key

Implemented in iguana::MemoizedParam< T >, and iguana::SingleThreadParam< T >.

Member Data Documentation

◆ m_mutex

template<typename T>
std::shared_mutex iguana::ConcurrentParam< T >::m_mutex
mutableprotected

mutex for this ConcurrentParam

Definition at line 53 of file ConcurrentParam.h.

◆ m_name

template<typename T>
std::string const iguana::ConcurrentParam< T >::m_name
protected

a name for this parameter

Definition at line 56 of file ConcurrentParam.h.


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