DART  6.6.2
dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT > Class Template Reference

TemplateWeakNodePtr is a templated class that enables users to create a weak non-reference-holding WeakNodePtr. More...

#include <NodePtr.hpp>

Public Member Functions

 TemplateWeakNodePtr ()
 Default constructor. More...
 
 TemplateWeakNodePtr (NodeT *_ptr)
 Typical constructor. More...
 
template<class OtherNodeT , class OtherBodyNodeT >
 TemplateWeakNodePtr (const TemplateWeakNodePtr< OtherNodeT, OtherBodyNodeT > &_weakPtr)
 Constructor that takes in a WeakNodePtr. More...
 
template<class OtherNodeT , class OtherBodyNodeT >
 TemplateWeakNodePtr (const TemplateNodePtr< OtherNodeT, OtherBodyNodeT > &_strongPtr)
 Constructor that takes in a strong NodePtr. More...
 
TemplateWeakNodePtroperator= (NodeT *_ptr)
 Assignment operator for raw Node pointers. More...
 
template<class OtherNodeT , class OtherBodyNodeT >
TemplateWeakNodePtroperator= (const TemplateWeakNodePtr< OtherNodeT, OtherBodyNodeT > &_weakPtr)
 Assignment operator for WeakNodePtrs. More...
 
template<class OtherNodeT , class OtherBodyNodeT >
TemplateWeakNodePtroperator= (const TemplateNodePtr< OtherNodeT, OtherBodyNodeT > &_strongPtr)
 Assignment operator for strong NodePtrs. More...
 
TemplateNodePtr< NodeT, BodyNodeT > lock () const
 Locks the Node reference to ensure that the referenced Node is currently still available. More...
 
void set (NodeT *_ptr)
 Set the Node for this WeakNodePtr. More...
 
template<class OtherNodeT , class OtherBodyNodeT >
void set (const TemplateWeakNodePtr< OtherNodeT, OtherBodyNodeT > &_weakPtr)
 Set the Node for this WeakNodePtr based on another WeakNodePtr. More...
 

Protected Attributes

NodeT * mNode
 Node that this pointer references. More...
 
std::weak_ptr< NodeDestructormWeakDestructor
 Destructor for the Node. More...
 
TemplateWeakBodyNodePtr< BodyNodeT > mWeakBodyNodePtr
 Pointer to the BodyNode that the Node is attached to. More...
 

Friends

template<class , class >
class TemplateWeakNodePtr
 

Detailed Description

template<class NodeT, class BodyNodeT>
class dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >

TemplateWeakNodePtr is a templated class that enables users to create a weak non-reference-holding WeakNodePtr.

Holding onto a WeakNodePtr will NOT prevent anything from getting deleted, but you can use lock() to check whether the Node still exists. If it does exist, it will return a valid NodePtr. Otherwise it will return a nullptr NodePtr.

Constructor & Destructor Documentation

◆ TemplateWeakNodePtr() [1/4]

template<class NodeT , class BodyNodeT >
dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::TemplateWeakNodePtr ( )
inline

Default constructor.

◆ TemplateWeakNodePtr() [2/4]

template<class NodeT , class BodyNodeT >
dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::TemplateWeakNodePtr ( NodeT *  _ptr)
inline

Typical constructor.

_ptr must be a valid pointer (or a nullptr) when passed to this constructor

◆ TemplateWeakNodePtr() [3/4]

template<class NodeT , class BodyNodeT >
template<class OtherNodeT , class OtherBodyNodeT >
dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::TemplateWeakNodePtr ( const TemplateWeakNodePtr< OtherNodeT, OtherBodyNodeT > &  _weakPtr)
inline

Constructor that takes in a WeakNodePtr.

◆ TemplateWeakNodePtr() [4/4]

template<class NodeT , class BodyNodeT >
template<class OtherNodeT , class OtherBodyNodeT >
dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::TemplateWeakNodePtr ( const TemplateNodePtr< OtherNodeT, OtherBodyNodeT > &  _strongPtr)
inline

Constructor that takes in a strong NodePtr.

Member Function Documentation

◆ lock()

template<class NodeT , class BodyNodeT >
TemplateNodePtr<NodeT, BodyNodeT> dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::lock ( ) const
inline

Locks the Node reference to ensure that the referenced Node is currently still available.

If the Node is not available any longer (i.e. has been deleted), then this will return a nullptr.

◆ operator=() [1/3]

template<class NodeT , class BodyNodeT >
template<class OtherNodeT , class OtherBodyNodeT >
TemplateWeakNodePtr& dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::operator= ( const TemplateNodePtr< OtherNodeT, OtherBodyNodeT > &  _strongPtr)
inline

Assignment operator for strong NodePtrs.

◆ operator=() [2/3]

template<class NodeT , class BodyNodeT >
template<class OtherNodeT , class OtherBodyNodeT >
TemplateWeakNodePtr& dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::operator= ( const TemplateWeakNodePtr< OtherNodeT, OtherBodyNodeT > &  _weakPtr)
inline

Assignment operator for WeakNodePtrs.

◆ operator=() [3/3]

template<class NodeT , class BodyNodeT >
TemplateWeakNodePtr& dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::operator= ( NodeT *  _ptr)
inline

Assignment operator for raw Node pointers.

◆ set() [1/2]

template<class NodeT , class BodyNodeT >
template<class OtherNodeT , class OtherBodyNodeT >
void dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::set ( const TemplateWeakNodePtr< OtherNodeT, OtherBodyNodeT > &  _weakPtr)
inline

Set the Node for this WeakNodePtr based on another WeakNodePtr.

◆ set() [2/2]

template<class NodeT , class BodyNodeT >
void dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::set ( NodeT *  _ptr)
inline

Set the Node for this WeakNodePtr.

Friends And Related Function Documentation

◆ TemplateWeakNodePtr

template<class NodeT , class BodyNodeT >
template<class , class >
friend class TemplateWeakNodePtr
friend

Member Data Documentation

◆ mNode

template<class NodeT , class BodyNodeT >
NodeT* dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::mNode
protected

Node that this pointer references.

◆ mWeakBodyNodePtr

template<class NodeT , class BodyNodeT >
TemplateWeakBodyNodePtr<BodyNodeT> dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::mWeakBodyNodePtr
protected

Pointer to the BodyNode that the Node is attached to.

◆ mWeakDestructor

template<class NodeT , class BodyNodeT >
std::weak_ptr<NodeDestructor> dart::dynamics::TemplateWeakNodePtr< NodeT, BodyNodeT >::mWeakDestructor
protected

Destructor for the Node.