3#include "behaviortree_cpp/utils/safe_any.hpp"
10
11
12
13
14
15
16
17
18
19
24 LockedPtr() =
default;
26 LockedPtr(T* obj, std::mutex* obj_mutex) : ref_(obj), mutex_(obj_mutex)
44 std::swap(ref_, other.ref_);
45 std::swap(mutex_, other.mutex_);
50 std::swap(ref_, other.ref_);
51 std::swap(mutex_, other.mutex_);
57 return ref_ !=
nullptr;
81 const T* operator->()
const
91 template <
typename OtherT>
92 void assign(
const OtherT& other)
96 throw std::runtime_error(
"Empty LockedPtr reference");
98 else if constexpr(std::is_same_v<T, OtherT>)
102 else if constexpr(std::is_same_v<BT::Any, OtherT>)
104 other->copyInto(*ref_);
114 std::mutex* mutex_ =
nullptr;
The LockedPtr class is used to share a pointer to an object and a mutex that protects the read/write ...
Definition: locked_reference.hpp:22
Definition: action_node.h:24