The LockedPtr class is used to share a pointer to an object and a mutex that protects the read/write access to that object. More...
#include <locked_reference.hpp>
Public Member Functions | |
template<typename OtherT > | |
void | assign (const OtherT &other) |
const T * | get () const |
void | lock () |
LockedPtr ()=default | |
LockedPtr (LockedPtr &&other) | |
LockedPtr (LockedPtr const &)=delete | |
LockedPtr (T *obj, std::mutex *obj_mutex) | |
operator bool () const | |
T * | operator-> () |
const T * | operator-> () const |
LockedPtr & | operator= (LockedPtr &&other) |
LockedPtr & | operator= (LockedPtr const &)=delete |
void | unlock () |
~LockedPtr () | |
Private Attributes | |
std::mutex * | mutex_ = nullptr |
T * | ref_ = nullptr |
The LockedPtr class is used to share a pointer to an object and a mutex that protects the read/write access to that object.
As long as the object remains in scope, the mutex is locked, therefore you must destroy this instance as soon as the pointer was used.
Definition at line 16 of file locked_reference.hpp.
|
default |
|
inline |
Definition at line 21 of file locked_reference.hpp.
|
inline |
Definition at line 26 of file locked_reference.hpp.
|
delete |
|
inline |
Definition at line 37 of file locked_reference.hpp.
|
inline |
Definition at line 86 of file locked_reference.hpp.
|
inline |
Definition at line 70 of file locked_reference.hpp.
|
inline |
Definition at line 54 of file locked_reference.hpp.
|
inline |
Definition at line 49 of file locked_reference.hpp.
|
inline |
Definition at line 80 of file locked_reference.hpp.
|
inline |
Definition at line 75 of file locked_reference.hpp.
|
inline |
Definition at line 43 of file locked_reference.hpp.
|
delete |
|
inline |
Definition at line 62 of file locked_reference.hpp.
|
private |
Definition at line 108 of file locked_reference.hpp.
|
private |
Definition at line 107 of file locked_reference.hpp.