openshot-audio  0.1.6
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
juce::Atomic< Type > Class Template Reference

#include <juce_core.h>

Public Member Functions

 Atomic () noexcept
 
 Atomic (const Type initialValue) noexcept
 
 Atomic (const Atomic &other) noexcept
 
 ~Atomic () noexcept
 
Type get () const noexcept
 
Atomicoperator= (const Atomic &other) noexcept
 
Atomicoperator= (const Type newValue) noexcept
 
void set (Type newValue) noexcept
 
Type exchange (Type value) noexcept
 
Type operator+= (Type amountToAdd) noexcept
 
Type operator-= (Type amountToSubtract) noexcept
 
Type operator++ () noexcept
 
Type operator-- () noexcept
 
bool compareAndSetBool (Type newValue, Type valueToCompare) noexcept
 
Type compareAndSetValue (Type newValue, Type valueToCompare) noexcept
 

Static Public Member Functions

static void memoryBarrier () noexcept
 

Public Attributes

volatile Type value
 

Detailed Description

template<typename Type>
class juce::Atomic< Type >

Simple class to hold a primitive value and perform atomic operations on it.

The type used must be a 32 or 64 bit primitive, like an int, pointer, etc. There are methods to perform most of the basic atomic operations.

Constructor & Destructor Documentation

◆ Atomic() [1/3]

template<typename Type>
juce::Atomic< Type >::Atomic ( )
inlinenoexcept

Creates a new value, initialised to zero.

◆ Atomic() [2/3]

template<typename Type>
juce::Atomic< Type >::Atomic ( const Type  initialValue)
inlineexplicitnoexcept

Creates a new value, with a given initial value.

◆ Atomic() [3/3]

template<typename Type>
juce::Atomic< Type >::Atomic ( const Atomic< Type > &  other)
inlinenoexcept

Copies another value (atomically).

◆ ~Atomic()

template<typename Type>
juce::Atomic< Type >::~Atomic ( )
inlinenoexcept

Destructor.

Member Function Documentation

◆ compareAndSetBool()

template<typename Type>
bool Atomic< Type >::compareAndSetBool ( Type  newValue,
Type  valueToCompare 
)
inlinenoexcept

Atomically compares this value with a target value, and if it is equal, sets this to be equal to a new value.

This operation is the atomic equivalent of doing this:

bool compareAndSetBool (Type newValue, Type valueToCompare)
{
if (get() == valueToCompare)
{
set (newValue);
return true;
}
return false;
}
Returns
true if the comparison was true and the value was replaced; false if the comparison failed and the value was left unchanged.
See also
compareAndSetValue

◆ compareAndSetValue()

template<typename Type>
Type Atomic< Type >::compareAndSetValue ( Type  newValue,
Type  valueToCompare 
)
inlinenoexcept

Atomically compares this value with a target value, and if it is equal, sets this to be equal to a new value.

This operation is the atomic equivalent of doing this:

Type compareAndSetValue (Type newValue, Type valueToCompare)
{
Type oldValue = get();
if (oldValue == valueToCompare)
set (newValue);
return oldValue;
}
Returns
the old value before it was changed.
See also
compareAndSetBool

◆ exchange()

template<typename Type>
Type Atomic< Type >::exchange ( Type  value)
inlinenoexcept

Atomically sets the current value, returning the value that was replaced.

◆ get()

template<typename Type >
Type Atomic< Type >::get ( ) const
inlinenoexcept

Atomically reads and returns the current value.

◆ memoryBarrier()

template<typename Type >
void Atomic< Type >::memoryBarrier ( )
inlinestaticnoexcept

Implements a memory read/write barrier.

◆ operator++()

template<typename Type >
Type Atomic< Type >::operator++ ( )
inlinenoexcept

Atomically increments this value, returning the new value.

◆ operator+=()

template<typename Type>
Type Atomic< Type >::operator+= ( Type  amountToAdd)
inlinenoexcept

Atomically adds a number to this value, returning the new value.

◆ operator--()

template<typename Type >
Type Atomic< Type >::operator-- ( )
inlinenoexcept

Atomically decrements this value, returning the new value.

◆ operator-=()

template<typename Type>
Type Atomic< Type >::operator-= ( Type  amountToSubtract)
inlinenoexcept

Atomically subtracts a number from this value, returning the new value.

◆ operator=() [1/2]

template<typename Type>
Atomic& juce::Atomic< Type >::operator= ( const Atomic< Type > &  other)
inlinenoexcept

Copies another value onto this one (atomically).

◆ operator=() [2/2]

template<typename Type>
Atomic& juce::Atomic< Type >::operator= ( const Type  newValue)
inlinenoexcept

Copies another value onto this one (atomically).

◆ set()

template<typename Type>
void juce::Atomic< Type >::set ( Type  newValue)
inlinenoexcept

Atomically sets the current value.

Member Data Documentation

◆ value

template<typename Type>
volatile Type juce::Atomic< Type >::value

The raw value that this class operates on. This is exposed publically in case you need to manipulate it directly for performance reasons.


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