RelaxedAtomic< T > Struct Template Reference

An atomic that is still copyable, for the access bookkeeping. More...

#include <RobotAPI/libraries/armem/core/base/EntityInstanceBase.h>

Public Member Functions

void increment () const
 
T load () const
 
 operator T () const
 
RelaxedAtomic & operator= (const RelaxedAtomic &other)
 
RelaxedAtomic & operator= (T newValue)
 
 RelaxedAtomic ()=default
 
 RelaxedAtomic (const RelaxedAtomic &other)
 
 RelaxedAtomic (T initial)
 
void store (T newValue) const
 

Public Attributes

std::atomic< T > value {}
 

Detailed Description

template<class T>
struct armarx::armem::base::RelaxedAtomic< T >

An atomic that is still copyable, for the access bookkeeping.

EntityInstanceMetadata::access() runs on the query path, which holds only the core segment's shared lock, so several query threads touch the same instance's counters at once. The plain members raced. EntityInstanceMetadata is copied all over the place, though, and std::atomic is not copyable – hence this wrapper, which copies by value and leaves the rest of the struct alone.

Relaxed throughout: these counters order nothing, they are read for LTM importance filtering and for display.

Constructor & Destructor Documentation

◆ RelaxedAtomic() [1/3]

template<class T>
RelaxedAtomic ( )
default

◆ RelaxedAtomic() [2/3]

template<class T>
RelaxedAtomic ( T initial)
inline

◆ RelaxedAtomic() [3/3]

template<class T>
RelaxedAtomic ( const RelaxedAtomic< T > & other)
inline

Member Function Documentation

◆ increment()

template<class T>
void increment ( ) const
inline

◆ load()

template<class T>
T load ( ) const
inline

◆ operator T()

template<class T>
operator T ( ) const
inline

◆ operator=() [1/2]

template<class T>
RelaxedAtomic & operator= ( const RelaxedAtomic< T > & other)
inline

◆ operator=() [2/2]

template<class T>
RelaxedAtomic & operator= ( T newValue)
inline

◆ store()

template<class T>
void store ( T newValue) const
inline

Member Data Documentation

◆ value

template<class T>
std::atomic<T> value {}
mutable

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