DART  6.6.2
dart::dynamics::SkeletonRefCountingBase Class Reference

#include <BodyNodePtr.hpp>

Inheritance diagram for dart::dynamics::SkeletonRefCountingBase:
dart::dynamics::BodyNode

Public Member Functions

std::shared_ptr< SkeletongetSkeleton ()
 Return the Skeleton this BodyNode belongs to. More...
 
std::shared_ptr< const SkeletongetSkeleton () const
 Return the (const) Skeleton this BodyNode belongs to. More...
 

Protected Member Functions

 SkeletonRefCountingBase ()
 Default Constructor. More...
 

Protected Attributes

std::weak_ptr< SkeletonmSkeleton
 Weak pointer to the Skeleton this BodyNode belongs to. More...
 
std::atomic< int > mReferenceCount
 Reference count for the number of BodyNodePtrs that are referring to this BodyNode. More...
 
std::shared_ptr< SkeletonmReferenceSkeleton
 If mReferenceCount is zero, then mReferenceSkeleton will hold a nullptr. More...
 
std::shared_ptr< MutexedWeakSkeletonPtrmLockedSkeleton
 Shared reference to a weak_ptr of this BodyNode's Skeleton, along with a mutex to ensure thread safety. More...
 

Private Member Functions

void incrementReferenceCount () const
 Atomically increment the reference count for this BodyNode. More...
 
void decrementReferenceCount () const
 Atomically decrement the reference count for this BodyNode. More...
 

Friends

template<class >
class TemplateBodyNodePtr
 
template<class >
class TemplateWeakBodyNodePtr
 

Constructor & Destructor Documentation

◆ SkeletonRefCountingBase()

dart::dynamics::SkeletonRefCountingBase::SkeletonRefCountingBase ( )
protected

Default Constructor.

Member Function Documentation

◆ decrementReferenceCount()

void dart::dynamics::SkeletonRefCountingBase::decrementReferenceCount ( ) const
private

Atomically decrement the reference count for this BodyNode.

This should only be called by the BodyNodePtr class

◆ getSkeleton() [1/2]

SkeletonPtr dart::dynamics::SkeletonRefCountingBase::getSkeleton ( )

Return the Skeleton this BodyNode belongs to.

◆ getSkeleton() [2/2]

ConstSkeletonPtr dart::dynamics::SkeletonRefCountingBase::getSkeleton ( ) const

Return the (const) Skeleton this BodyNode belongs to.

◆ incrementReferenceCount()

void dart::dynamics::SkeletonRefCountingBase::incrementReferenceCount ( ) const
private

Atomically increment the reference count for this BodyNode.

This should only be called by the BodyNodePtr class

Friends And Related Function Documentation

◆ TemplateBodyNodePtr

template<class >
friend class TemplateBodyNodePtr
friend

◆ TemplateWeakBodyNodePtr

template<class >
friend class TemplateWeakBodyNodePtr
friend

Member Data Documentation

◆ mLockedSkeleton

std::shared_ptr<MutexedWeakSkeletonPtr> dart::dynamics::SkeletonRefCountingBase::mLockedSkeleton
protected

Shared reference to a weak_ptr of this BodyNode's Skeleton, along with a mutex to ensure thread safety.

This is used by WeakBodyNodePtrs to know when this BodyNode has expired.

◆ mReferenceCount

std::atomic<int> dart::dynamics::SkeletonRefCountingBase::mReferenceCount
mutableprotected

Reference count for the number of BodyNodePtrs that are referring to this BodyNode.

◆ mReferenceSkeleton

std::shared_ptr<Skeleton> dart::dynamics::SkeletonRefCountingBase::mReferenceSkeleton
mutableprotected

If mReferenceCount is zero, then mReferenceSkeleton will hold a nullptr.

If mReferenceCount is greater than zero, then mReferenceSkeleton will hold a shared_ptr to the Skeleton that this BodyNode belongs to. This is to keep this BodyNode alive, so long as a BodyNodePtr that references it exists.

◆ mSkeleton

std::weak_ptr<Skeleton> dart::dynamics::SkeletonRefCountingBase::mSkeleton
protected

Weak pointer to the Skeleton this BodyNode belongs to.