3#include "behaviortree_cpp/utils/safe_any.hpp"
10
11
12
13
14
15
20 LockedPtr() =
default;
22 LockedPtr(T* obj, std::mutex* obj_mutex) : ref_(obj), mutex_(obj_mutex)
40 std::swap(ref_, other.ref_);
41 std::swap(mutex_, other.mutex_);
46 std::swap(ref_, other.ref_);
47 std::swap(mutex_, other.mutex_);
53 return ref_ !=
nullptr;
77 const T* operator->()
const
87 template <
typename OtherT>
88 void assign(
const OtherT& other)
92 throw std::runtime_error(
"Empty LockedPtr reference");
94 else if constexpr(std::is_same_v<T, OtherT>)
98 else if constexpr(std::is_same_v<BT::Any, OtherT>)
100 other->copyInto(*ref_);
110 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:18
Definition: action_node.h:24