DART
6.7.3
|
TemplateWeakBodyNodePtr is a templated class that enables users to create a non-reference-holding WeakBodyNodePtr. More...
#include <BodyNodePtr.hpp>
Public Member Functions | |
TemplateWeakBodyNodePtr () | |
Default constructor. More... | |
TemplateWeakBodyNodePtr (BodyNodeT *_ptr) | |
Typical constructor. More... | |
template<class OtherBodyNodeT > | |
TemplateWeakBodyNodePtr (const TemplateWeakBodyNodePtr< OtherBodyNodeT > &_weakPtr) | |
Constructor that takes in a WeakBodyNodePtr. More... | |
TemplateWeakBodyNodePtr & | operator= (BodyNodeT *_ptr) |
Assignment operator for raw BodyNode pointers. More... | |
template<class OtherBodyNodeT > | |
TemplateWeakBodyNodePtr & | operator= (const TemplateWeakBodyNodePtr< OtherBodyNodeT > &_weakPtr) |
Assignment operator for WeakBodyNodePtrs. More... | |
TemplateBodyNodePtr< BodyNodeT > | lock () const |
Locks the BodyNode reference to ensure that the referenced BodyNode (1) is currently still available, and (2) does not get deleted. More... | |
void | set (BodyNodeT *_ptr) |
Set the BodyNode for this WeakBodyNodePtr. More... | |
template<class OtherBodyNodeT > | |
void | set (const TemplateWeakBodyNodePtr< OtherBodyNodeT > &_weakPtr) |
Attempt to set the BodyNode for this WeakBodyNodePtr based on another WeakBodyNodePtr. More... | |
bool | expired () const |
Returns true if this WeakBodyNodePtr is referencing a nullptr or a pointer which has been deleted. More... | |
Private Attributes | |
BodyNodeT * | mPtr |
Raw pointer for the BodyNode that this WeakBodyNodePtr references. More... | |
std::shared_ptr< MutexedWeakSkeletonPtr > | mLocker |
A shared_ptr that allows the WeakBodyNodePtr to know whether it can lock into a BodyNodePtr. More... | |
Friends | |
template<class > | |
class | TemplateWeakBodyNodePtr |
TemplateWeakBodyNodePtr is a templated class that enables users to create a non-reference-holding WeakBodyNodePtr.
Holding onto a WeakBodyNodePtr will NOT prevent the BodyNode from getting deleted, but you can use lock() to check whether the BodyNode still exists. If it does exist, it will return a valid strong BodyNodePtr. Otherwise, it will return a nullptr BodyNodePtr.
|
inline |
Default constructor.
|
inline |
Typical constructor.
_ptr must be a valid pointer (or a nullptr) when passed to this constructor
|
inline |
Constructor that takes in a WeakBodyNodePtr.
|
inline |
Returns true if this WeakBodyNodePtr is referencing a nullptr or a pointer which has been deleted.
Returns false if it is referencing a pointer which is still active.
Note: in multithreaded application, there is no guarantee that the pointer will still be active after this function has finished. To guarantee that the pointer remains active, use lock() and store its return in a BodyNodePtr
|
inline |
Locks the BodyNode reference to ensure that the referenced BodyNode (1) is currently still available, and (2) does not get deleted.
If the BodyNode is not available any longer (i.e. has been deleted), then this will return a nullptr.
To keep the BodyNode active, you should capture the return value of this function in a BodyNodePtr.
|
inline |
Assignment operator for raw BodyNode pointers.
|
inline |
Assignment operator for WeakBodyNodePtrs.
|
inline |
Set the BodyNode for this WeakBodyNodePtr.
|
inline |
Attempt to set the BodyNode for this WeakBodyNodePtr based on another WeakBodyNodePtr.
|
private |
A shared_ptr that allows the WeakBodyNodePtr to know whether it can lock into a BodyNodePtr.
|
private |
Raw pointer for the BodyNode that this WeakBodyNodePtr references.