33 #ifndef DART_DYNAMICS_DETAIL_DEGREEOFFREEDOMPTR_HPP_
34 #define DART_DYNAMICS_DETAIL_DEGREEOFFREEDOMPTR_HPP_
51 template <
class DegreeOfFreedomT,
class BodyNodeT>
66 template <
class OtherDegreeOfFreedomT,
class OtherBodyNodeT>
69 OtherBodyNodeT>& _dofp)
82 template <
class OtherDegreeOfFreedomT,
class OtherBodyNodeT>
85 OtherBodyNodeT>& _dofp)
92 operator DegreeOfFreedomT*()
const {
return get(); }
101 DegreeOfFreedomT*
get()
const
126 void set(DegreeOfFreedomT* _ptr)
135 mIndex = _ptr->getIndexInJoint();
143 template <
class OtherDofT,
class OtherBodyNodeT>
145 OtherBodyNodeT>& _rhs)
const
147 if(
nullptr ==
mBodyNodePtr &&
nullptr == _rhs.mBodyNodePtr)
157 template <
class OtherDofT,
class OtherBodyNodeT>
159 OtherBodyNodeT>& _rhs)
const
161 return !( *
this == _rhs );
165 template <
class OtherDofT,
class OtherBodyNodeT>
167 OtherBodyNodeT>& _rhs)
const
170 return (
mIndex < _rhs.mIndex);
176 template <
class OtherDofT,
class OtherBodyNodeT>
178 OtherBodyNodeT>& _rhs)
const
181 return (
mIndex > _rhs.mIndex);
187 template <
class OtherDofT,
class OtherBodyNodeT>
189 OtherBodyNodeT>& _rhs)
const
191 return (*
this < _rhs) || (*
this == _rhs);
195 template <
class OtherDofT,
class OtherBodyNodeT>
197 OtherBodyNodeT>& _rhs)
const
199 return (*
this > _rhs) || (*
this == _rhs);
218 template <
class DegreeOfFreedomT,
class BodyNodeT>
233 template <
class OtherDofT,
class OtherBodyNodeT>
236 OtherBodyNodeT>& _weakPtr)
242 template <
class OtherDofT,
class OtherBodyNodeT>
245 OtherBodyNodeT>& _strongPtr)
247 set(_strongPtr.get());
258 template <
class OtherDofT,
class OtherBodyNodeT>
261 OtherBodyNodeT>& _weakPtr)
268 template <
class OtherDofT,
class OtherBodyNodeT>
271 OtherBodyNodeT>& _strongPtr)
273 set(_strongPtr.get());
284 if(
nullptr == bodyNode)
288 bodyNode->getParentJoint()->getDof(
mIndex));
292 void set(DegreeOfFreedomT* _ptr)
302 mIndex = _ptr->getIndexInJoint();
307 template <
class OtherDofT,
class OtherBodyNodeT>
309 OtherBodyNodeT>& _weakPtr)
TemplateBodyNodePtr is a templated class that enables users to create a reference-counting BodyNodePt...
Definition: BodyNodePtr.hpp:111
TemplateDegreeOfFreedomPtr is a templated class that enables users to create a reference-counting Deg...
Definition: DegreeOfFreedomPtr.hpp:53
DegreeOfFreedomT & operator*() const
Dereferencing operator.
Definition: DegreeOfFreedomPtr.hpp:95
TemplateBodyNodePtr< BodyNodeT > mBodyNodePtr
Reference-holding pointer to the child BodyNode of this DegreeOfFreedom.
Definition: DegreeOfFreedomPtr.hpp:206
bool operator>=(const TemplateDegreeOfFreedomPtr< OtherDofT, OtherBodyNodeT > &_rhs) const
Greater than or equal to.
Definition: DegreeOfFreedomPtr.hpp:196
bool operator<=(const TemplateDegreeOfFreedomPtr< OtherDofT, OtherBodyNodeT > &_rhs) const
Less than or equal to.
Definition: DegreeOfFreedomPtr.hpp:188
bool operator==(const TemplateDegreeOfFreedomPtr< OtherDofT, OtherBodyNodeT > &_rhs) const
Equality.
Definition: DegreeOfFreedomPtr.hpp:144
bool operator>(const TemplateDegreeOfFreedomPtr< OtherDofT, OtherBodyNodeT > &_rhs) const
Greater than.
Definition: DegreeOfFreedomPtr.hpp:177
TemplateDegreeOfFreedomPtr()=default
Default constructor.
TemplateDegreeOfFreedomPtr(DegreeOfFreedomT *_ptr)
Typical constructor.
Definition: DegreeOfFreedomPtr.hpp:63
TemplateDegreeOfFreedomPtr(const TemplateDegreeOfFreedomPtr< OtherDegreeOfFreedomT, OtherBodyNodeT > &_dofp)
Constructor that takes in a strong DegreeOfFreedomPtrs.
Definition: DegreeOfFreedomPtr.hpp:67
DegreeOfFreedomT * operator->() const
Dereferencing operation.
Definition: DegreeOfFreedomPtr.hpp:98
TemplateDegreeOfFreedomPtr & operator=(DegreeOfFreedomT *_ptr)
Assignment operator.
Definition: DegreeOfFreedomPtr.hpp:75
TemplateBodyNodePtr< BodyNodeT > getBodyNodePtr() const
Get the BodyNode that this DegreeOfFreedomPtr is tied to.
Definition: DegreeOfFreedomPtr.hpp:110
void set(DegreeOfFreedomT *_ptr)
Set the DegreeOfFreedom for this DegreeOfFreedomPtr.
Definition: DegreeOfFreedomPtr.hpp:126
bool operator!=(const TemplateDegreeOfFreedomPtr< OtherDofT, OtherBodyNodeT > &_rhs) const
Inequality.
Definition: DegreeOfFreedomPtr.hpp:158
bool operator<(const TemplateDegreeOfFreedomPtr< OtherDofT, OtherBodyNodeT > &_rhs) const
Less than.
Definition: DegreeOfFreedomPtr.hpp:166
std::size_t getLocalIndex() const
Get the local generalized coordinate index that this DegreeOfFreedomPtr is tied to.
Definition: DegreeOfFreedomPtr.hpp:117
DegreeOfFreedomT * get() const
Get the raw DegreeOfFreedom pointer.
Definition: DegreeOfFreedomPtr.hpp:101
std::size_t mIndex
Local index of this DegreeOfFreedom within its Joint.
Definition: DegreeOfFreedomPtr.hpp:209
TemplateWeakBodyNodePtr is a templated class that enables users to create a non-reference-holding Wea...
Definition: BodyNodePtr.hpp:199
TemplateWeakDegreeOfFreedomPtr is a templated class that enables users to create a non-reference-hold...
Definition: DegreeOfFreedomPtr.hpp:220
void set(DegreeOfFreedomT *_ptr)
Set the DegreeOfFreedom for this WeakDegreeOfFreedomPtr.
Definition: DegreeOfFreedomPtr.hpp:292
TemplateWeakDegreeOfFreedomPtr(const TemplateWeakDegreeOfFreedomPtr< OtherDofT, OtherBodyNodeT > &_weakPtr)
Constructor that takes in a WeakDegreeOfFreedomPtr.
Definition: DegreeOfFreedomPtr.hpp:234
TemplateWeakDegreeOfFreedomPtr(const TemplateDegreeOfFreedomPtr< OtherDofT, OtherBodyNodeT > &_strongPtr)
Constructor that takes in a strong DegreeOfFreedomPtr.
Definition: DegreeOfFreedomPtr.hpp:243
TemplateWeakDegreeOfFreedomPtr()
Default constructor.
Definition: DegreeOfFreedomPtr.hpp:226
TemplateWeakBodyNodePtr< BodyNodeT > mWeakBodyNode
Weak pointer to the child BodyNode of this DegreeOfFreedom.
Definition: DegreeOfFreedomPtr.hpp:317
TemplateWeakDegreeOfFreedomPtr(DegreeOfFreedomT *_ptr)
Typical constructor.
Definition: DegreeOfFreedomPtr.hpp:230
void set(const TemplateWeakDegreeOfFreedomPtr< OtherDofT, OtherBodyNodeT > &_weakPtr)
Attempt to set the DegreeOfFreedom for this WeakDegreeOfFreedomPtr based on another WeakDegreeOfFreed...
Definition: DegreeOfFreedomPtr.hpp:308
TemplateWeakDegreeOfFreedomPtr & operator=(DegreeOfFreedomT *_ptr)
Assignment operator for raw DegreeOfFreedom pointers.
Definition: DegreeOfFreedomPtr.hpp:251
std::size_t mIndex
Local index of this DegreeOfFreedom within its Joint.
Definition: DegreeOfFreedomPtr.hpp:320
TemplateDegreeOfFreedomPtr< DegreeOfFreedomT, BodyNodeT > lock() const
Locks the DegreeOfFreedom reference to ensure that the referenced DegreeOfFreedom is currently still ...
Definition: DegreeOfFreedomPtr.hpp:281
constexpr std::size_t INVALID_INDEX
Definition: InvalidIndex.hpp:41
Definition: BulletCollisionDetector.cpp:63