33 #ifndef DART_DYNAMICS_DETAIL_BODYNODEPTR_HPP_
34 #define DART_DYNAMICS_DETAIL_BODYNODEPTR_HPP_
65 std::shared_ptr<const Skeleton>
getSkeleton()
const;
108 template <
class BodyNodeT>
131 template <
class OtherBodyNodeT>
152 template <
class OtherBodyNodeT>
168 operator BodyNodeT*()
const
200 ->decrementReferenceCount();
206 ->incrementReferenceCount();
222 template <
class BodyNodeT>
242 template <
class OtherBodyNodeT>
258 template <
class OtherBodyNodeT>
282 std::shared_ptr<const Skeleton> skeleton =
mLocker->mSkeleton.lock();
283 if (
nullptr == skeleton)
303 template <
class OtherBodyNodeT>
306 if (
nullptr == _weakPtr.
mLocker)
312 std::lock_guard<std::mutex>
lock(_weakPtr.
mLocker->mMutex);
313 std::shared_ptr<const Skeleton> skeleton
314 = _weakPtr.
mLocker->mSkeleton.lock();
315 if (
nullptr == skeleton)
340 std::shared_ptr<const Skeleton> skeleton =
mLocker->mSkeleton.lock();
341 if (
nullptr == skeleton)
353 std::shared_ptr<MutexedWeakSkeletonPtr>
mLocker;
Definition: BodyNodePtr.hpp:54
std::shared_ptr< MutexedWeakSkeletonPtr > mLockedSkeleton
Shared reference to a weak_ptr of this BodyNode's Skeleton, along with a mutex to ensure thread safet...
Definition: BodyNodePtr.hpp:101
std::shared_ptr< Skeleton > getSkeleton()
Return the Skeleton this BodyNode belongs to.
Definition: BodyNode.cpp:152
std::atomic< int > mReferenceCount
Reference count for the number of BodyNodePtrs that are referring to this BodyNode.
Definition: BodyNodePtr.hpp:89
SkeletonRefCountingBase()
Default Constructor.
Definition: BodyNode.cpp:128
std::weak_ptr< Skeleton > mSkeleton
Weak pointer to the Skeleton this BodyNode belongs to.
Definition: BodyNodePtr.hpp:85
std::shared_ptr< Skeleton > mReferenceSkeleton
If mReferenceCount is zero, then mReferenceSkeleton will hold a nullptr.
Definition: BodyNodePtr.hpp:96
void incrementReferenceCount() const
Atomically increment the reference count for this BodyNode.
Definition: BodyNode.cpp:136
void decrementReferenceCount() const
Atomically decrement the reference count for this BodyNode.
Definition: BodyNode.cpp:144
TemplateBodyNodePtr is a templated class that enables users to create a reference-counting BodyNodePt...
Definition: BodyNodePtr.hpp:110
BodyNodeT * mPtr
Raw pointer for the BodyNode that this BodyNodePtr references.
Definition: BodyNodePtr.hpp:214
TemplateBodyNodePtr(const TemplateBodyNodePtr< OtherBodyNodeT > &_bnp)
Templated constructor for copying other BodyNodePtrs.
Definition: BodyNodePtr.hpp:132
BodyNodeT & operator*() const
Dereferencing operator.
Definition: BodyNodePtr.hpp:174
TemplateBodyNodePtr & operator=(BodyNodeT *_ptr)
Assignment operator.
Definition: BodyNodePtr.hpp:161
TemplateBodyNodePtr()
Default constructor.
Definition: BodyNodePtr.hpp:113
void set(BodyNodeT *_ptr)
Set the BodyNode for this BodyNodePtr.
Definition: BodyNodePtr.hpp:192
TemplateBodyNodePtr(BodyNodeT *_ptr)
Typical constructor.
Definition: BodyNodePtr.hpp:119
BodyNodeT * get() const
Get the raw BodyNode pointer.
Definition: BodyNodePtr.hpp:186
TemplateBodyNodePtr(const TemplateBodyNodePtr &_bnp)
User defined copy-constructor.
Definition: BodyNodePtr.hpp:125
~TemplateBodyNodePtr()
Destructor. Releases the BodyNode reference before being destroyed.
Definition: BodyNodePtr.hpp:139
BodyNodeT * operator->() const
Dereferencing operation.
Definition: BodyNodePtr.hpp:180
TemplateBodyNodePtr & operator=(const TemplateBodyNodePtr &bnp)
User defined assignment operator.
Definition: BodyNodePtr.hpp:145
TemplateBodyNodePtr & operator=(const TemplateBodyNodePtr< OtherBodyNodeT > &_bnp)
Change the BodyNode that this BodyNodePtr references.
Definition: BodyNodePtr.hpp:153
TemplateWeakBodyNodePtr is a templated class that enables users to create a non-reference-holding Wea...
Definition: BodyNodePtr.hpp:224
void set(BodyNodeT *_ptr)
Set the BodyNode for this WeakBodyNodePtr.
Definition: BodyNodePtr.hpp:290
TemplateWeakBodyNodePtr & operator=(BodyNodeT *_ptr)
Assignment operator for raw BodyNode pointers.
Definition: BodyNodePtr.hpp:251
BodyNodeT * mPtr
Raw pointer for the BodyNode that this WeakBodyNodePtr references.
Definition: BodyNodePtr.hpp:349
TemplateWeakBodyNodePtr(BodyNodeT *_ptr)
Typical constructor.
Definition: BodyNodePtr.hpp:236
void set(const TemplateWeakBodyNodePtr< OtherBodyNodeT > &_weakPtr)
Attempt to set the BodyNode for this WeakBodyNodePtr based on another WeakBodyNodePtr.
Definition: BodyNodePtr.hpp:304
TemplateBodyNodePtr< BodyNodeT > lock() const
Locks the BodyNode reference to ensure that the referenced BodyNode (1) is currently still available,...
Definition: BodyNodePtr.hpp:273
TemplateWeakBodyNodePtr()
Default constructor.
Definition: BodyNodePtr.hpp:230
TemplateWeakBodyNodePtr & operator=(const TemplateWeakBodyNodePtr< OtherBodyNodeT > &_weakPtr)
Assignment operator for WeakBodyNodePtrs.
Definition: BodyNodePtr.hpp:259
TemplateWeakBodyNodePtr(const TemplateWeakBodyNodePtr< OtherBodyNodeT > &_weakPtr)
Constructor that takes in a WeakBodyNodePtr.
Definition: BodyNodePtr.hpp:243
bool expired() const
Returns true if this WeakBodyNodePtr is referencing a nullptr or a pointer which has been deleted.
Definition: BodyNodePtr.hpp:332
std::shared_ptr< MutexedWeakSkeletonPtr > mLocker
A shared_ptr that allows the WeakBodyNodePtr to know whether it can lock into a BodyNodePtr.
Definition: BodyNodePtr.hpp:353
Definition: BulletCollisionDetector.cpp:65
Definition: BodyNodePtr.hpp:47
std::weak_ptr< const Skeleton > mSkeleton
Definition: BodyNodePtr.hpp:49
std::mutex mMutex
Definition: BodyNodePtr.hpp:48