Botcraft 1.21.5
Loading...
Searching...
No Matches
Botcraft::Utilities::ScopeLockedWrapper< T, Mutex, Lock > Class Template Reference

Mutex protected reference, will be locked until destroyed. More...

#include <ScopeLockedWrapper.hpp>

Public Member Functions

 ScopeLockedWrapper (T &val, Mutex &mutex)
 
T * operator-> () const
 
T & operator* () const
 

Private Attributes

T & v
 
Lock< Mutex > lock
 

Detailed Description

template<class T, class Mutex = std::mutex, template< class... > class Lock = std::scoped_lock>
class Botcraft::Utilities::ScopeLockedWrapper< T, Mutex, Lock >

Mutex protected reference, will be locked until destroyed.

Template Parameters
TClass to store
MutexMutex type to use
LockLock type to use

Definition at line 16 of file ScopeLockedWrapper.hpp.

Constructor & Destructor Documentation

◆ ScopeLockedWrapper()

template<class T , class Mutex = std::mutex, template< class... > class Lock = std::scoped_lock>
Botcraft::Utilities::ScopeLockedWrapper< T, Mutex, Lock >::ScopeLockedWrapper ( T &  val,
Mutex &  mutex 
)
inline

Definition at line 19 of file ScopeLockedWrapper.hpp.

Member Function Documentation

◆ operator*()

template<class T , class Mutex = std::mutex, template< class... > class Lock = std::scoped_lock>
T & Botcraft::Utilities::ScopeLockedWrapper< T, Mutex, Lock >::operator* ( ) const
inline

◆ operator->()

template<class T , class Mutex = std::mutex, template< class... > class Lock = std::scoped_lock>
T * Botcraft::Utilities::ScopeLockedWrapper< T, Mutex, Lock >::operator-> ( ) const
inline

Member Data Documentation

◆ lock

template<class T , class Mutex = std::mutex, template< class... > class Lock = std::scoped_lock>
Lock<Mutex> Botcraft::Utilities::ScopeLockedWrapper< T, Mutex, Lock >::lock
private

Definition at line 25 of file ScopeLockedWrapper.hpp.

◆ v

template<class T , class Mutex = std::mutex, template< class... > class Lock = std::scoped_lock>
T& Botcraft::Utilities::ScopeLockedWrapper< T, Mutex, Lock >::v
private

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