Developer Documentation
|
Iterator class for the skeleton. More...
#include <Type-Skeleton/ObjectTypes/Skeleton/SkeletonT.hh>
Public Member Functions | |
Iterator () | |
Default constructor. More... | |
Iterator (Joint *_root) | |
Constructor - Creates an iterator for the given (sub-)tree. More... | |
Iterator (const Iterator &other) | |
Copy Constructor - Creates a copy of the given iterator. More... | |
~Iterator () | |
Destructor. | |
Iterator & | operator= (const Iterator &other) |
Assignment Operator. More... | |
Iterator & | operator++ () |
Increase the iterator. More... | |
bool | operator!= (const Iterator &other) const |
Compares the iterators. More... | |
bool | operator== (const Iterator &other) const |
Compares the iterators. More... | |
Joint * | operator* () const |
Returns a pointer to the current joint. | |
Joint * | operator-> () const |
Returns a pointer to the current joint. More... | |
operator bool () const | |
Returns false if the iterator is done iterating. More... | |
Private Member Functions | |
Joint * | nextSibling (Joint *_pParent, Joint *_pJoint) |
Given a parent and one of its child nodes this method finds and returns the next sibling. More... | |
Private Attributes | |
Joint * | pCurrent_ |
std::stack< Joint * > | stJoints_ |
Iterator class for the skeleton.
This iterator can be used to iterate over all joints in a top-down (root to leaf), left-to-right order. It is possible to iterate over subtrees by constructing an iterator passing the root of the subtree as parameter. Cast the iterator to boolean to test if it iterated all joints.
Definition at line 82 of file SkeletonT.hh.
SkeletonT< PointT >::Iterator::Iterator | ( | ) |
Default constructor.
Creates an invalid iterator, not pointing to anything yet.
Definition at line 73 of file SkeletonT_impl.hh.
Constructor - Creates an iterator for the given (sub-)tree.
The iterator will traverse all nodes below _root (inclusive _root) in a top-down, "left-to-right" manner.
Definition at line 86 of file SkeletonT_impl.hh.
Copy Constructor - Creates a copy of the given iterator.
This iterator will become a copy of the given iterator. They both point to the same position now, but iterate the tree independently.
Definition at line 100 of file SkeletonT_impl.hh.
|
private |
Given a parent and one of its child nodes this method finds and returns the next sibling.
_pParent | The parent node, take it from the stack |
_pJoint | A child node of _pParent, its next sibling is wanted |
Definition at line 258 of file SkeletonT_impl.hh.
SkeletonT< PointT >::Iterator::operator bool | ( | ) | const |
Returns false if the iterator is done iterating.
There are two ways to test if the joint iterator has reached its end. Cast it to bool and test if it is false or compare it to the return value of SkeletonT<>::end.
Definition at line 243 of file SkeletonT_impl.hh.
bool SkeletonT< PointT >::Iterator::operator!= | ( | const Iterator & | other | ) | const |
Compares the iterators.
The iterators are equal if they point to the same joint, no matter where they began to iterate.
Definition at line 187 of file SkeletonT_impl.hh.
SkeletonT< PointT >::Iterator & SkeletonT< PointT >::Iterator::operator++ | ( | ) |
Increase the iterator.
The iterator will be changed to point to the next child, or whatever joint is next.
Definition at line 141 of file SkeletonT_impl.hh.
SkeletonT< PointT >::Joint * SkeletonT< PointT >::Iterator::operator-> | ( | ) | const |
Returns a pointer to the current joint.
This way it is possible to access the joint by calling:
Definition at line 229 of file SkeletonT_impl.hh.
SkeletonT< PointT >::Iterator & SkeletonT< PointT >::Iterator::operator= | ( | const Iterator & | other | ) |
Assignment Operator.
Assign values from given iterator to this iterator and also return self
Definition at line 126 of file SkeletonT_impl.hh.
bool SkeletonT< PointT >::Iterator::operator== | ( | const Iterator & | other | ) | const |
Compares the iterators.
The iterators are equal if they point to the same joint, no matter where they began to iterate.
Definition at line 200 of file SkeletonT_impl.hh.