13namespace tracktion {
inline namespace engine
21template<
typename Type>
24 static Type constrain (
const Type& v)
38template<
typename Type,
typename Constrainer = DummyConstrainer<Type>>
46 template<
typename OtherType>
49 value.
store (Constrainer::constrain (other));
55 value.
store (other.value);
61 value.
store (other.value);
68 return value.
load() == other.value.load();
74 return value.
load() != other.value.load();
81 return Constrainer::constrain (value.
load());
85 operator Type() const noexcept
87 return Constrainer::constrain (value.
load());
Wraps an atomic with an interface compatible with var so it can be used within CachedValues in a thre...
bool operator==(const AtomicWrapper &other) const noexcept
Compares the unerlaying value of another wrapper with this one.
bool operator!=(const AtomicWrapper &other) const noexcept
Compares the unerlaying value of another wrapper with this one.
AtomicWrapper()=default
Constructor.
AtomicWrapper(const OtherType &other)
Constructs a copy of another wrapper type.
AtomicWrapper & operator=(const AtomicWrapper &other) noexcept
Assigns another AtomicWrapper's underlying value to this one atomically.
AtomicWrapper(const AtomicWrapper &other)
Constructs a copy of another AtomicWrapper.
Dummy constrainer which should optimise away to nothing.