33 #ifndef DART_COMMON_LOCKABLEREFERENCE_IMPL_HPP_
34 #define DART_COMMON_LOCKABLEREFERENCE_IMPL_HPP_
42 template <
typename Lockable>
44 std::weak_ptr<const void> lockableHolder,
Lockable& lockable) noexcept
45 : mLockableHolder(std::move(lockableHolder)), mLockable(lockable)
51 template <
typename Lockable>
54 if (mLockableHolder.expired())
61 template <
typename Lockable>
64 if (mLockableHolder.expired())
67 return mLockable.try_lock();
71 template <
typename Lockable>
74 if (mLockableHolder.expired())
81 template <
typename Lockable>
82 template <
typename InputIterator>
84 std::weak_ptr<const void> lockableHolder,
87 : mLockableHolder(
std::move(lockableHolder)), mLockables(first, last)
89 using IteratorValueType =
90 typename std::iterator_traits<InputIterator>::value_type;
91 using IteratorLockable =
typename std::remove_pointer<
95 std::is_same<Lockable, IteratorLockable>::value,
96 "Lockable of this class and the lockable of InputIterator are not the "
101 template <
typename Lockable>
104 if (mLockableHolder.expired())
107 for (
auto lockable : mLockables)
112 template <
typename Lockable>
115 if (mLockableHolder.expired())
118 for (
auto lockable : mLockables)
120 if (!lockable->try_lock())
128 template <
typename Lockable>
131 if (mLockableHolder.expired())
134 for (
auto it = mLockables.rbegin(); it != mLockables.rend(); ++it)
139 template <
typename Lockable>
140 template <
typename T>
147 template <
typename Lockable>
148 template <
typename T>
std::string type
Definition: SdfParser.cpp:82
bool try_lock() noexcept override
Tries to lock the lockables that this class references; returns false if one of the lockables is not ...
Definition: LockableReference-impl.hpp:113
MultiLockableReference(std::weak_ptr< const void > lockableHolder, InputIterator first, InputIterator last)
Constructs from multiple lockables.
Definition: LockableReference-impl.hpp:83
void unlock() noexcept override
Unlocks the lockables.
Definition: LockableReference-impl.hpp:129
void lock() override
Locks lockable that this class references; blocks if one of the lockables are not avaliable.
Definition: LockableReference-impl.hpp:102
T * ptr(T &obj)
Converts reference to pointer.
Definition: LockableReference-impl.hpp:141
bool try_lock() noexcept override
Tries to lock the lockables that this class references; returns false if one of the lockables is not ...
Definition: LockableReference-impl.hpp:62
LockableT Lockable
Definition: LockableReference.hpp:82
void unlock() noexcept override
Unlocks the lockables.
Definition: LockableReference-impl.hpp:72
void lock() override
Locks lockable that this class references; blocks if one of the lockables are not avaliable.
Definition: LockableReference-impl.hpp:52
SingleLockableReference(std::weak_ptr< const void > lockableHolder, Lockable &lockable) noexcept
Constructor from a single lockable.
Definition: LockableReference-impl.hpp:43
Definition: BulletCollisionDetector.cpp:65
Definition: SharedLibraryManager.hpp:46