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;
395 static void initClass();
396 static void exitClass();
408 void insertIndex(
SoNode *parent,
int newIndex);
412 void removeIndex(
SoNode *parent,
int oldIndex);
416 void replaceIndex(
SoNode *parent,
int index,
SoNode *newChild);
424 SbBool isRelevantNotification(SoNotList *list)
const;
426 void setNumPublic(
int num);
434 void appendMI(
SoNode *node,
int index,
int instanceIndex);
437 SoPath *copy_(
int startFromNodeIndex = 0,
int numNodes = 0,
bool createTempPath =
false)
const;
440 inline const size_t& getHash()
const
442 if ( m_pathHash !=
static_cast< size_t >(-1) )
444 return computeHash();
456 int u_getIndex(
int i)
const {
return (
int)indices[i].index; }
457 int u_getIndexFromTail(
int i)
const {
return (
int)indices[
getLength() - 1 - i].index; }
458 int u_getInstanceIndex(
int i)
const {
return (
int)indices[i].instanceIndex; }
466 void setHeadMI(
SoNode *node,
int instanceIndex);
473 void appendMI(
int childIndex,
int instanceIndex);
481 void appendMI(
SoNode *childNode,
int instanceIndex);
487 void pushMI(
int childIndex,
int instanceIndex);
489 bool isForwardTraversing()
const;
493 void auditPath(
SbBool flag) { doAuditors = flag; }
496 virtual SbBool readInstance(
SoInput *in,
unsigned short flags);
501 const size_t& computeHash()
const;
504 std::vector<inventor::NodeIndex> indices;
505 mutable int numPublic;
506 mutable int minNumPublic;
508 static SoType classTypeId;
511 int getFullLength()
const
515 static void* createInstance(
SoType* dynamicType = NULL);
518 mutable size_t m_pathHash;
616 {
return (nodes[getFullLength() - 1]); }
620 {
return (nodes[getFullLength() - 1 - i]); }
625 return indices[getFullLength() - 1 - i].index;
631 return indices[getFullLength() - 1 - i].instanceIndex;
636 {
return getFullLength(); }
645#ifndef HIDDEN_FROM_DOC
666 SoLightPath(
int approxLength=0);
668 SoLightPath(
const SoLightPath& other);
672 void setHead(
SoNode *node);
675 void append(
int childIndex)
676 { indices.push_back(inventor::NodeIndex(childIndex, inventor::NodeIndex::NODE));}
679 void appendMI(
int childIndex,
int instanceIndex)
680 { indices.push_back(inventor::NodeIndex(childIndex, instanceIndex)); }
685 void push(
int childIndex) { append(childIndex); }
686 void pushMI(
int childIndex,
int instanceIndex) { appendMI(childIndex, instanceIndex); }
687 void push() { append(-1);}
688 void pop() { truncate(getFullLength() - 1); }
690 void setTail(
int childIndex)
692 setTail(childIndex, inventor::NodeIndex::NODE);
695 void setTail(
int childIndex,
int instanceIndex)
697 setTail(inventor::NodeIndex(childIndex, instanceIndex));
700 void setTail(
const inventor::NodeIndex& index)
702 size_t tailPos = (size_t)(getFullLength()-1);
703 if ( tailPos >= indices.size() )
704 indices.resize(tailPos+1);
705 indices[tailPos] = index;
709 return getNode(getFullLength()-1);
713 SoNode * getHead()
const {
return headNode; }
716 SoNode * getNode(
int i)
const;
720 int getIndex(
int i)
const
722 return indices[i].index;
726 int getInstanceIndex(
int i)
const
727 {
return indices[i].instanceIndex; }
732 int getFullLength()
const {
return (
int) indices.size();}
735 void truncate(
int start)
737 indices.resize(start > 0 ? start : 0);
743 void makeTempPath(SoTempPath *)
const;
745 SoLightPath& operator=(
const SoLightPath& other);
751 mutable std::vector<inventor::NodeIndex> indices;
762 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.
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.