Telamon
Public Member Functions | List of all members
telamon_simulator::versioning::VersionedAtomic< ValType, Meta > Class Template Reference

An atomic primitive which support versioning. The type which is wrapper has additional meta data. More...

#include <Versioning.hh>

Public Member Functions

template<typename ... Args>
 VersionedAtomic (Meta meta, Args &&... args)
 
 VersionedAtomic (ValType value, Meta meta={})
 
 VersionedAtomic (const VersionedAtomic &rhs)
 
auto load () const noexcept -> Referenced< ValType, Meta > *
 Load the value stored inside.
 
auto store (ValType new_value, std::optional< Meta > new_meta={}) noexcept
 Store a value inside.
 
template<typename Fun >
auto transform (Fun fun) const
 Apply a function to the value inside. More...
 
auto version () const noexcept -> VersionNum
 
auto compare_exchange_weak (const ValType &expected, std::optional< versioning::VersionNum > expected_version_opt, ValType desired, Meta desired_meta, ContentionFailureCounter &failures) -> std::optional< bool >
 Performs a CAS on the value stored inside. More...
 
template<typename ... Args>
auto compare_exchange_strong (Args &&... args) -> bool
 
auto has_modified_bit () const noexcept -> bool
 
void clear_modified_bit () noexcept
 

Detailed Description

template<typename ValType, typename Meta = void>
class telamon_simulator::versioning::VersionedAtomic< ValType, Meta >

An atomic primitive which support versioning. The type which is wrapper has additional meta data.

Note
T has to implement comparison operators VersionedAtomic is used by the user to implement the required functions of CasWithVersioning, requirement of the NormalizedRepresentation concept

Member Function Documentation

◆ compare_exchange_weak()

template<typename ValType , typename Meta = void>
auto telamon_simulator::versioning::VersionedAtomic< ValType, Meta >::compare_exchange_weak ( const ValType &  expected,
std::optional< versioning::VersionNum expected_version_opt,
ValType  desired,
Meta  desired_meta,
ContentionFailureCounter failures 
) -> std::optional<bool>
inline

Performs a CAS on the value stored inside.

Parameters
expectedThe expected value
desiredThe value which will placed
failuresThe contention counter \ret None if failed (contention) False if some of the requirements were not met True if the CAS was performed successfully

◆ transform()

template<typename ValType , typename Meta = void>
template<typename Fun >
auto telamon_simulator::versioning::VersionedAtomic< ValType, Meta >::transform ( Fun  fun) const
inline

Apply a function to the value inside.

Template Parameters
RThe return type of the function. Also used as the return type of transform
Parameters
funThe function applied to the value inside

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