Template Class Safe#
Defined in File Safe.h
Nested Relationships#
Nested Types#
Class Documentation#
-
template<typename ValueType, typename MutexType = INTERNAL::DefaultMutex>
class Safe# Wraps a value together with a mutex.
- Template Parameters:
ValueType – The type of the value to protect.
MutexType – The type of the mutex.
Public Types
-
template<template<typename> class LockType = INTERNAL::DefaultReadOnlyLock>
using ReadAccess = Access<LockType, AccessMode::ReadOnly>#
-
template<template<typename> class LockType = INTERNAL::DefaultReadWriteLock>
using WriteAccess = Access<LockType, AccessMode::ReadWrite>#
Public Functions
-
template<typename ...ValueArgs>
inline explicit Safe(DefaultConstructMutex _, ValueArgs&&... valueArgs)# Construct a Safe object with default construction of the mutex and perfect forwarding of the other arguments to construct the value object.
- Parameters:
valueArgs – Perfect forwarding arguments to construct the value object.
-
template<typename MutexArg, typename ...ValueArgs>
inline explicit Safe(MutexArg &&mutexArg, ValueArgs&&... valueArgs)# Construct a Safe object, forwarding the first argument to construct the mutex and the other arguments to construct the value object.
- Parameters:
mutexArg – Perfect forwarding argument to construct the mutex object.
valueArgs – Perfect forwarding arguments to construct the value object.
-
template<template<typename> class LockType = INTERNAL::DefaultReadOnlyLock>
inline ReadAccess<LockType> ReadLock() const#
-
template<template<typename> class LockType = INTERNAL::DefaultReadOnlyLock, typename ...LockArgs>
inline ReadAccess<LockType> ReadLock(LockArgs&&... lockArgs) const#
-
template<template<typename> class LockType = INTERNAL::DefaultReadWriteLock>
inline WriteAccess<LockType> WriteLock()#
-
template<template<typename> class LockType = INTERNAL::DefaultReadWriteLock, typename ...LockArgs>
inline WriteAccess<LockType> WriteLock(LockArgs&&... lockArgs)#
-
template<template<typename> class LockType = INTERNAL::DefaultReadOnlyLock, typename ...LockArgs>
inline RemoveRefValueType Copy(LockArgs&&... lockArgs) const#
-
template<template<typename> class LockType = INTERNAL::DefaultReadWriteLock, typename ...LockArgs>
inline void Assign(ConstValueReferenceType value, LockArgs&&... lockArgs)#
-
template<template<typename> class LockType = INTERNAL::DefaultReadWriteLock, typename ...LockArgs>
inline void Assign(RemoveRefValueType &&value, LockArgs&&... lockArgs)#
-
inline constexpr ConstValueReferenceType GetUnsafe() const noexcept#
Unsafe const accessor to the value.
Note
If you use this function, you exit the realm of safety!
- Returns:
Const reference to the value object.
-
inline constexpr ValueReferenceType GetUnsafe() noexcept#
Unsafe accessor to the value.
Note
If you use this function, you exit the realm of safety!
- Returns:
Reference to the value object.