lintel 0.2.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
lintel::PropertyValueStorage< T, Enable > Class Template Reference

#include <PropertyValueStorage.h>

Public Member Functions

 PropertyValueStorage ()
 
 PropertyValueStorage (const T &value)
 
T load () const
 
void store (const T &value)
 

Static Public Member Functions

static constexpr bool isLockFree ()
 

Detailed Description

template<class T, class Enable = void>
class lintel::PropertyValueStorage< T, Enable >

Storage for a property value.

For trivially copyable types whose std::atomic<T> is always lock-free the value is held in a std::atomic and read/written without any lock, so that it can be accessed from real-time contexts. All other types (e.g. std::string) fall back to a reader-writer lock.

Constructor & Destructor Documentation

◆ PropertyValueStorage() [1/2]

template<class T , class Enable = void>
lintel::PropertyValueStorage< T, Enable >::PropertyValueStorage ( )
inline

◆ PropertyValueStorage() [2/2]

template<class T , class Enable = void>
lintel::PropertyValueStorage< T, Enable >::PropertyValueStorage ( const T &  value)
inlineexplicit

Member Function Documentation

◆ isLockFree()

template<class T , class Enable = void>
static constexpr bool lintel::PropertyValueStorage< T, Enable >::isLockFree ( )
inlinestaticconstexpr
Returns
true if reads/writes are guaranteed lock-free

◆ load()

template<class T , class Enable = void>
T lintel::PropertyValueStorage< T, Enable >::load ( ) const
inline
Returns
the current value (lock-free if the specialization applies)

◆ store()

template<class T , class Enable = void>
void lintel::PropertyValueStorage< T, Enable >::store ( const T &  value)
inline

Set the value


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