BehaviorTree
Core Library to create and execute Behavior Trees
Loading...
Searching...
No Matches
BT::LockedPtr< T > Class Template Reference

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

 LockedPtr (T *obj, std::mutex *obj_mutex)
 
 LockedPtr (LockedPtr const &)=delete
 
LockedPtroperator= (LockedPtr const &)=delete
 
 LockedPtr (LockedPtr &&other) noexcept
 
LockedPtroperator= (LockedPtr &&other) noexcept
 
 operator bool () const
 
void lock ()
 
void unlock ()
 
const T * get () const
 
const T * operator-> () const
 
T * operator-> ()
 
template<typename OtherT >
void assign (const OtherT &other)
 

Detailed Description

template<typename T>
class BT::LockedPtr< T >

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.


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