33 #ifndef DART_DYNAMICS_DETAIL_NODEPTR_HPP_ 34 #define DART_DYNAMICS_DETAIL_NODEPTR_HPP_ 36 #include "dart/dynamics/detail/BodyNodePtr.hpp" 48 template <
class NodeT,
class BodyNodeT>
52 template <
class,
class>
55 using element_type = NodeT;
70 template <
class OtherNodeT,
class OtherBodyNodeT>
84 template <
class OtherNodeT,
class OtherBodyNodeT>
93 operator NodeT*()
const 117 void set(NodeT* _ptr)
150 template <
class NodeT,
class BodyNodeT>
154 template <
class,
class>
170 template <
class OtherNodeT,
class OtherBodyNodeT>
178 template <
class OtherNodeT,
class OtherBodyNodeT>
182 set(_strongPtr.
get());
193 template <
class OtherNodeT,
class OtherBodyNodeT>
202 template <
class OtherNodeT,
class OtherBodyNodeT>
206 set(_strongPtr.
get());
216 if (
nullptr == bodyNode)
219 std::shared_ptr<NodeDestructor> destructor = mWeakDestructor.lock();
220 if (
nullptr == destructor)
227 void set(NodeT* _ptr)
232 mWeakDestructor.reset();
233 mWeakBodyNodePtr =
nullptr;
237 mWeakBodyNodePtr = _ptr->getBodyNodePtr();
238 mWeakDestructor = _ptr->getOrCreateDestructor();
243 template <
class OtherNodeT,
class OtherBodyNodeT>
246 mNode = _weakPtr.mNode;
247 mWeakDestructor = _weakPtr.mWeakDestructor;
248 mWeakBodyNodePtr = _weakPtr.mWeakBodyNodePtr;
265 #endif // DART_DYNAMICS_DETAIL_NODEPTR_HPP_ TemplateNodePtr()
Default constructor.
Definition: NodePtr.hpp:58
TemplateWeakNodePtr is a templated class that enables users to create a weak non-reference-holding We...
Definition: NodePtr.hpp:151
TemplateWeakNodePtr & operator=(const TemplateNodePtr< OtherNodeT, OtherBodyNodeT > &_strongPtr)
Assignment operator for strong NodePtrs.
Definition: NodePtr.hpp:203
NodeT * get() const
Get the raw Node pointer.
Definition: NodePtr.hpp:111
NodeT * mNode
Node that this pointer references.
Definition: NodePtr.hpp:253
TemplateBodyNodePtr< BodyNodeT > mBodyNodePtr
Hold onto a BodyNodePtr to the Node's associated BodyNode to make sure that the BodyNode stays alive...
Definition: NodePtr.hpp:142
std::weak_ptr< NodeDestructor > mWeakDestructor
Destructor for the Node.
Definition: NodePtr.hpp:256
TemplateNodePtr & operator=(const TemplateNodePtr< OtherNodeT, OtherBodyNodeT > &_ptr)
Assignment operator for NodePtrs.
Definition: NodePtr.hpp:85
TemplateWeakNodePtr & operator=(NodeT *_ptr)
Assignment operator for raw Node pointers.
Definition: NodePtr.hpp:186
std::shared_ptr< NodeDestructor > mDestructor
Hold onto a shared_ptr to the Node's Destructor to make sure the Node stays alive.
Definition: NodePtr.hpp:138
NodeT & operator*() const
Dereferencing operator.
Definition: NodePtr.hpp:99
TemplateNodePtr is a templated class that enables users to create a strong reference-counting NodePtr...
Definition: NodePtr.hpp:49
TemplateWeakNodePtr(const TemplateWeakNodePtr< OtherNodeT, OtherBodyNodeT > &_weakPtr)
Constructor that takes in a WeakNodePtr.
Definition: NodePtr.hpp:171
TemplateWeakNodePtr & operator=(const TemplateWeakNodePtr< OtherNodeT, OtherBodyNodeT > &_weakPtr)
Assignment operator for WeakNodePtrs.
Definition: NodePtr.hpp:194
Definition: Aspect.cpp:40
TemplateNodePtr & operator=(NodeT *_ptr)
Assignment operator.
Definition: NodePtr.hpp:77
TemplateNodePtr(NodeT *_ptr)
Typical constructor.
Definition: NodePtr.hpp:64
TemplateWeakNodePtr(NodeT *_ptr)
Typical constructor.
Definition: NodePtr.hpp:164
TemplateWeakBodyNodePtr< BodyNodeT > mWeakBodyNodePtr
Pointer to the BodyNode that the Node is attached to.
Definition: NodePtr.hpp:259
TemplateNodePtr(const TemplateNodePtr< OtherNodeT, OtherBodyNodeT > &_ptr)
Constructor that takes in a strong NodePtr.
Definition: NodePtr.hpp:71
TemplateBodyNodePtr is a templated class that enables users to create a reference-counting BodyNodePt...
Definition: BodyNodePtr.hpp:109
TemplateNodePtr< NodeT, BodyNodeT > lock() const
Locks the Node reference to ensure that the referenced Node is currently still available.
Definition: NodePtr.hpp:213
NodeT * mNode
Node that this NodePtr refers to.
Definition: NodePtr.hpp:134
TemplateWeakNodePtr(const TemplateNodePtr< OtherNodeT, OtherBodyNodeT > &_strongPtr)
Constructor that takes in a strong NodePtr.
Definition: NodePtr.hpp:179
NodeT * operator->() const
Dereferencing operation.
Definition: NodePtr.hpp:105
TemplateWeakBodyNodePtr is a templated class that enables users to create a non-reference-holding Wea...
Definition: BodyNodePtr.hpp:223
TemplateWeakNodePtr()
Default constructor.
Definition: NodePtr.hpp:158