DART
6.10.1
|
The Node class is a base class for BodyNode and any object that attaches to a BodyNode. More...
#include <Node.hpp>
Classes | |
class | Properties |
If your Node has a Properties class, then that Properties class should inherit this Node::Properties class. More... | |
class | State |
If your Node has a State class, then that State class should inherit this Node::State class. More... | |
Public Types | |
template<class Mixin > | |
using | MakeState = common::MakeCloneable< State, Mixin > |
Use the MakeState class to easily create a State extension from an existing class or struct. More... | |
template<class Mixin > | |
using | MakeProperties = common::MakeCloneable< Properties, Mixin > |
Use the MakeProperties class to easily create a Properties extension from an existing class or struct. More... | |
Public Member Functions | |
virtual | ~Node ()=default |
Virtual destructor. More... | |
virtual const std::string & | setName (const std::string &newName)=0 |
Set the name of this Node. More... | |
virtual const std::string & | getName () const =0 |
Get the name of this Node. More... | |
virtual void | setNodeState (const State &otherState) |
Set the State of this Node. By default, this does nothing. More... | |
virtual std::unique_ptr< State > | getNodeState () const |
Get the State of this Node. More... | |
virtual void | copyNodeStateTo (std::unique_ptr< State > &outputState) const |
Copy the State of this Node into a unique_ptr. More... | |
virtual void | setNodeProperties (const Properties &properties) |
Set the Properties of this Node. By default, this does nothing. More... | |
virtual std::unique_ptr< Properties > | getNodeProperties () const |
Get the Properties of this Node. More... | |
virtual void | copyNodePropertiesTo (std::unique_ptr< Properties > &outputProperties) const |
Copy the Properties of this Node into a unique_ptr. More... | |
BodyNodePtr | getBodyNodePtr () |
Get a pointer to the BodyNode that this Node is associated with. More... | |
ConstBodyNodePtr | getBodyNodePtr () const |
Get a pointer to the BodyNode that this Node is associated with. More... | |
bool | isRemoved () const |
Returns true if this Node has been staged for removal from its BodyNode. More... | |
virtual std::shared_ptr< Skeleton > | getSkeleton () |
Return the Skeleton that this Node is attached to. More... | |
virtual std::shared_ptr< const Skeleton > | getSkeleton () const |
Return the Skeleton that this Node is attached to. More... | |
virtual std::size_t | incrementVersion () |
Increment the version for this object. More... | |
virtual std::size_t | getVersion () const |
Get the version number of this object. More... | |
Protected Member Functions | |
virtual Node * | cloneNode (BodyNode *bn) const =0 |
Allow your Node implementation to be cloned into a new BodyNode. More... | |
Node (BodyNode *_bn) | |
Constructor. More... | |
std::string | registerNameChange (const std::string &newName) |
Inform the Skeleton that the name of this Node has changed. More... | |
void | attach () |
Attach the Node to its BodyNode. More... | |
void | stageForRemoval () |
When all external references to the Node disappear, it will be deleted. More... | |
void | sendDestructionNotification () const |
Send a destruction notification to all Observers. More... | |
void | addObserver (Observer *_observer) const |
Add an Observer to the list of Observers. More... | |
void | removeObserver (Observer *_observer) const |
Remove an Observer from the list of Observers. More... | |
void | setVersionDependentObject (VersionCounter *dependent) |
Protected Attributes | |
std::weak_ptr< NodeDestructor > | mDestructor |
weak pointer to the destructor for this Node. More... | |
BodyNode * | mBodyNode |
Pointer to the BodyNode that this Node is attached to. More... | |
bool | mAmAttached |
bool that tracks whether this Node is attached to its BodyNode More... | |
std::size_t | mIndexInBodyNode |
The index of this Node within its vector in its BodyNode's NodeMap. More... | |
std::size_t | mIndexInSkeleton |
The index of this Node within its vector in its Skeleton's NodeMap. More... | |
std::size_t | mIndexInTree |
Index of this Node within its tree. More... | |
std::set< Observer * > | mObservers |
List of current Observers. More... | |
std::size_t | mVersion |
Private Member Functions | |
std::shared_ptr< NodeDestructor > | getOrCreateDestructor () |
Private Attributes | |
VersionCounter * | mDependent |
Friends | |
class | BodyNode |
class | Skeleton |
template<class > | |
class | AccessoryNode |
template<class , class > | |
class | TemplateNodePtr |
template<class , class > | |
class | TemplateWeakNodePtr |
The Node class is a base class for BodyNode and any object that attaches to a BodyNode.
This base class handles ownership and reference counting for the classes that inherit it.
In most cases, when creating your own custom Node class, you will also want to inherit from AccessoryNode using CRTP.
using dart::dynamics::Node::MakeProperties = common::MakeCloneable<Properties, Mixin> |
Use the MakeProperties class to easily create a Properties extension from an existing class or struct.
using dart::dynamics::Node::MakeState = common::MakeCloneable<State, Mixin> |
Use the MakeState class to easily create a State extension from an existing class or struct.
|
virtualdefault |
Virtual destructor.
|
protected |
Constructor.
|
protectedinherited |
Add an Observer to the list of Observers.
Allow your Node implementation to be cloned into a new BodyNode.
Implemented in dart::dynamics::BodyNode.
|
virtual |
Copy the Properties of this Node into a unique_ptr.
By default, this simply calls getNodeProperties() and passes the result into the outputProperties, but this function can be overriden to be more performant.
|
virtual |
Copy the State of this Node into a unique_ptr.
By default, this simply calls getNodeState() and passes the result into the outputState, but this function can be overriden to be more performant by avoiding allocations.
BodyNodePtr dart::dynamics::Node::getBodyNodePtr | ( | ) |
ConstBodyNodePtr dart::dynamics::Node::getBodyNodePtr | ( | ) | const |
|
pure virtual |
Get the name of this Node.
Implemented in dart::dynamics::BodyNode.
|
virtual |
Get the Properties of this Node.
By default, this returns a nullptr which implies that the Node has no properties.
|
virtual |
|
private |
|
virtual |
Return the Skeleton that this Node is attached to.
Reimplemented in dart::dynamics::BodyNode.
|
virtual |
Return the Skeleton that this Node is attached to.
Reimplemented in dart::dynamics::BodyNode.
|
virtualinherited |
Get the version number of this object.
|
virtualinherited |
Increment the version for this object.
Reimplemented in dart::dynamics::Shape.
bool dart::dynamics::Node::isRemoved | ( | ) | const |
Returns true if this Node has been staged for removal from its BodyNode.
It will be deleted once all strong references to it expire. If it is an AccessoryNode, you can call reattach() to prevent that from happening.
|
protected |
|
protectedinherited |
Remove an Observer from the list of Observers.
|
protectedinherited |
Send a destruction notification to all Observers.
This will cause all Observers to behave as if this Subject has been permanently deleted, so it should only be called when that behavior is desired.
|
pure virtual |
Set the name of this Node.
Implemented in dart::dynamics::BodyNode.
|
virtual |
Set the Properties of this Node. By default, this does nothing.
|
virtual |
|
protectedinherited |
|
protected |
When all external references to the Node disappear, it will be deleted.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
|
protected |
|
privateinherited |
|
protected |
weak pointer to the destructor for this Node.
We use a shared_ptr "destructor" class instead of managing Nodes directly with shared_ptrs because this scheme allows BodyNodes to circumvent the shared_ptr management by setting the mNode member of the Destructor to a nullptr. That way the BodyNode can never be deleted by its Destructor.
|
protected |
|
protected |
|
protected |
Index of this Node within its tree.
|
mutableprotectedinherited |
List of current Observers.
|
protectedinherited |