55#include <Inventor/misc/SoBase.h>
56#include <Inventor/nodes/SoNode.h>
57#include <Inventor/SoLists.h>
58#include <Inventor/lists/NodeIndex.h>
59#include <Inventor/STL/iostream>
60#include <Inventor/SbEventHandler.h>
351 SoPath *
copy(
int startFromNodeIndex = 0,
int numNodes = 0)
const;
403 static void initClass();
404 static void exitClass();
416 void insertIndex(
SoNode *parent,
int newIndex);
420 void removeIndex(
SoNode *parent,
int oldIndex);
424 void replaceIndex(
SoNode *parent,
int index,
SoNode *newChild);
432 SbBool isRelevantNotification(SoNotList *list)
const;
434 void setNumPublic(
int num);
442 void appendMI(
SoNode *node,
int index,
int instanceIndex);
445 SoPath *copy_(
int startFromNodeIndex = 0,
int numNodes = 0,
bool createTempPath =
false)
const;
448 inline const size_t& getHash()
const
450 if ( m_pathHash !=
static_cast< size_t >(-1) )
452 return computeHash();
464 int u_getIndex(
int i)
const {
return (
int)indices[i].index; }
465 int u_getIndexFromTail(
int i)
const {
return (
int)indices[
getLength() - 1 - i].index; }
466 int u_getInstanceIndex(
int i)
const {
return (
int)indices[i].instanceIndex; }
474 void setHeadMI(
SoNode *node,
int instanceIndex);
481 void appendMI(
int childIndex,
int instanceIndex);
489 void appendMI(
SoNode *childNode,
int instanceIndex);
495 void pushMI(
int childIndex,
int instanceIndex);
497 bool isForwardTraversing()
const;
501 void auditPath(
SbBool flag) { doAuditors = flag; }
504 virtual SbBool readInstance(
SoInput *in,
unsigned short flags);
509 const size_t& computeHash()
const;
512 std::vector<inventor::NodeIndex> indices;
513 mutable int numPublic;
514 mutable int minNumPublic;
516 static SoType classTypeId;
519 int getFullLength()
const
523 static void* createInstance(
SoType* dynamicType = NULL);
526 mutable size_t m_pathHash;
624 {
return (nodes[getFullLength() - 1]); }
628 {
return (nodes[getFullLength() - 1 - i]); }
633 return indices[getFullLength() - 1 - i].index;
639 return indices[getFullLength() - 1 - i].instanceIndex;
644 {
return getFullLength(); }
653#ifndef HIDDEN_FROM_DOC
674 SoLightPath(
int approxLength=0);
676 SoLightPath(
const SoLightPath& other);
680 void setHead(
SoNode *node);
683 void append(
int childIndex)
684 { indices.push_back(inventor::NodeIndex(childIndex, inventor::NodeIndex::NODE));}
687 void appendMI(
int childIndex,
int instanceIndex)
688 { indices.push_back(inventor::NodeIndex(childIndex, instanceIndex)); }
693 void push(
int childIndex) { append(childIndex); }
694 void pushMI(
int childIndex,
int instanceIndex) { appendMI(childIndex, instanceIndex); }
695 void push() { append(-1);}
696 void pop() { truncate(getFullLength() - 1); }
698 void setTail(
int childIndex)
700 setTail(childIndex, inventor::NodeIndex::NODE);
703 void setTail(
int childIndex,
int instanceIndex)
705 setTail(inventor::NodeIndex(childIndex, instanceIndex));
708 void setTail(
const inventor::NodeIndex& index)
710 size_t tailPos = (size_t)(getFullLength()-1);
711 if ( tailPos >= indices.size() )
712 indices.resize(tailPos+1);
713 indices[tailPos] = index;
717 return getNode(getFullLength()-1);
721 SoNode * getHead()
const {
return headNode; }
724 SoNode * getNode(
int i)
const;
728 int getIndex(
int i)
const
730 return indices[i].index;
734 int getInstanceIndex(
int i)
const
735 {
return indices[i].instanceIndex; }
740 int getFullLength()
const {
return (
int) indices.size();}
743 void truncate(
int start)
745 indices.resize(start > 0 ? start : 0);
751 void makeTempPath(SoTempPath *)
const;
753 SoLightPath& operator=(
const SoLightPath& other);
759 mutable std::vector<inventor::NodeIndex> indices;
770 std::ostream& operator << (std::ostream& os,
const SoPath& path);
Class representing an event.
Character string stored in a hash table.
int getLength() const
Returns number of pointers in list.
Abstract base class for all actions.
Base class for all nodes, paths, and engines.
Path that allows access to hidden children.
void pop()
The push() and pop() methods allow a path to be treated as a stack; they push a node at the end of th...
SoNode * getNodeFromTail(int i) const
Returns the i'th node (within its parent) in the chain, counting backward from the tail node.
int getLength() const
Returns length of path chain (number of nodes).
int getInstanceIndexFromTail(int i) const
get instance Index from tail
int getIndexFromTail(int i) const
Returns the index of the i'th node (within its parent) in the chain, counting backward from the tail ...
SoNode * getTail() const
Returns the last node in a path chain.
Abstract base class for all database nodes.
Maintains a list of pointers to nodes.
Path that points to a list of hierarchical nodes.
int getInstanceIndexFromTail(int i) const
Returns the index of the i'th node instance (within its parent, if it is a SoMultipleInstance,...
SoPath()
Constructs an empty path.
friend std::ostream & operator<<(std::ostream &os, const SoPath &path)
Writes the path to the specified output stream.
SoPath(int approxLength)
Constructs a path with a hint to length (number of nodes in chain).
SoPath * copy(int startFromNodeIndex=0, int numNodes=0) const
Creates and returns a new path that is a copy of some or all of this path.
friend int operator==(const SoPath &p1, const SoPath &p2)
Returns TRUE if all nodes in the two path chains are identical.
SoPath(SoNode *node)
Constructs a path and sets the head node to the given node.
static int getByName(const SbName &name, SoPathList &list)
Method to return paths with a given name.
void pop()
The push() and pop() methods allow a path to be treated as a stack; they push a node at the end of th...
int getInstanceIndex(int i) const
Returns the index of the instance inside the parent SoMultipleInstance, SoMultipleCopy or SoArray gro...
SbBool containsNode(const SoNode *node) const
Returns TRUE if the node is found anywhere in the path chain.
SoNode * getNode(const SoType type, int &i) const
Returns the first node and its index, from the head of the given type in the chain.
void append(int childIndex)
Adds node to end of chain; the node is the childIndex'th child of the current tail node.
SoNode * getHead() const
Returns the first node in a path chain.
friend class SoTraversalPassImpl
int getLength() const
Returns length of path chain (number of nodes).
void setHead(SoNode *node)
Sets head node (first node in chain).
void append(SoNode *childNode)
Adds node to end of chain; uses the first occurrence of childNode as child of current tail node.
static SoType getClassTypeId()
Returns type identifier for SoPath class.
void truncate(int start)
Truncates the path chain, removing all nodes from index start on.
friend bool operator<(const SoPath &p1, const SoPath &p2)
Returns TRUE is p1 strictly less than p2: to provide a total order operation for SoPath.
SoNode * getNode(int i) const
Returns the i'th node (within its parent) in the chain.
int getIndex(int i) const
Returns the index of the i'th node (within its parent) in the chain.
SbBool containsPath(const SoPath *path) const
Returns TRUE if the nodes in the chain in the passed path are contained (in consecutive order) in thi...
int findFork(const SoPath *path) const
If the two paths have different head nodes, this returns -1.
void push(int childIndex)
The push() and pop() methods allow a path to be treated as a stack; they push a node at the end of th...
SoNode * getNodeFromTail(int i) const
Returns the i'th node (within its parent) in the chain, counting backward from the tail node.
int getIndexFromTail(int i) const
Returns the index of the i'th node (within its parent) in the chain, counting backward from the tail ...
virtual SoType getTypeId() const
Returns type identifier for path instance.
friend int operator!=(const SoPath &p1, const SoPath &p2)
Not equal operator.
static SoPath * getByName(const SbName &name)
Method to return a path with a given name.
SbBool containsNode(const SoType type) const
Returns TRUE if the node type is found anywhere in the path chain.
SoNode * getTail() const
Returns the last node in a path chain.
void append(const SoPath *fromPath)
Adds all nodes in fromPath's chain to end of chain; the head node of fromPath must be the same as or ...
Maintains a list of pointers to paths.
Stores runtime type information.
Writes a scene graph to a file.