Open Inventor Reference
|
This class represents a list of paths (like an SoPathList) in a more compact form. More...
#include <Inventor/misc/SoCompactPathList.h>
Public Member Functions | |
SoCompactPathList (const SoPathList &list) | |
Constructor given path list. | |
~SoCompactPathList () | |
void | reset () |
Resets traversal to the beginning. | |
void | getChildren (int &numIndices, const int *&indices) |
Returns the indices of the current node that are in paths in the list. | |
bool | push (int childIndex) |
Traverses the child with given index of the current node. | |
void | pop () |
Restores current node to what it was before the most recent push() | |
Since many paths in a path list may share common sub-paths from common head nodes, this class stores them with less redundancy.
The SoCompactPathList constructor is passed an SoPathList. It is assumed that the SoPathList is not empty and that all paths in the SoPathList have a common head node; an error will occur otherwise. It is also assumed that no two paths are identical, and that if one path goes through node X, then no other path will end at node X.
While an SoPathList provides random access to any node in any path, an SoCompactPathList provides only sequential access. That is, you can only access the paths in the list in order. Each instance maintains the notion of the "current node" - the node that traversal has last reached - to support this access.
Definition at line 85 of file SoCompactPathList.h.
SoCompactPathList::SoCompactPathList | ( | const SoPathList & | list | ) |
SoCompactPathList::~SoCompactPathList | ( | ) |
void SoCompactPathList::getChildren | ( | int & | numIndices, |
const int *& | indices | ||
) |
The number of indices is returned in "numIndices", and the indices are returned in "indices". numIndices will be 0 if the current node has no children in any path.
void SoCompactPathList::pop | ( | ) |
bool SoCompactPathList::push | ( | int | childIndex | ) |
The child becomes the new current node. If the child is on a path in the list, then getChildren() can be called to get the next set of children. Otherwise, it will always return no children. This method returns TRUE if the given childIndex is in one of the paths in the list, and FALSE otherwise.
void SoCompactPathList::reset | ( | ) |
This allows an instance to be traversed more than once.