Open Inventor Reference
SoNodeKitPath.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37
38/*
39 * Copyright (C) 1990,91 Silicon Graphics, Inc.
40 *
41 _______________________________________________________________________
42 ______________ S I L I C O N G R A P H I C S I N C . ____________
43 |
44 | $Revision: 1.1.1.1 $
45 |
46 | Description:
47 | This file contains the definition of the SoNodeKitPath class
48 |
49 | Author(s) : Paul Isaacs, Paul S. Strauss, Nick Thompson
50 |
51 ______________ S I L I C O N G R A P H I C S I N C . ____________
52 _______________________________________________________________________
53 */
54
55#ifndef _SO_NODE_KIT_PATH_
56#define _SO_NODE_KIT_PATH_
57
58#include <Inventor/SoPath.h>
59
60class SoBaseKit;
61class SoSearchAction;
62
63
66
104
106
107 public:
108
110 int getLength() const;
111
116 SoNode * getTail() const;
117
119 SoNode * getNode(int i) const;
120
124 SoNode * getNodeFromTail(int i) const;
125
130 void truncate(int start);
131
133 void pop();
134
139 void append(SoBaseKit *childKit);
140
143 void append(const SoNodeKitPath *fromPath);
144
146 bool containsNode(SoBaseKit *node) const;
147
151 int findFork(const SoNodeKitPath *path) const;
152
155 friend bool operator ==(const SoNodeKitPath &p1, const SoNodeKitPath &p2);
156
157 protected:
159 SoNodeKitPath(int approxLength) : SoPath(approxLength) {}
161 virtual ~SoNodeKitPath();
162
163 private:
165 static SoSearchAction *searchAction;
166
168
171 void append(int childIndex);
172 void append(SoNode *childNode);
173 void append(const SoPath *fromPath);
174 void push(int childIndex);
175 int getIndex(int i) const;
176 int getIndexFromTail(int i) const;
177 void insertIndex(SoNode *parent,int newIndex);
178 void removeIndex(SoNode *parent,int oldIndex);
179 void replaceIndex(SoNode *parent,int index,SoNode *newChild);
180};
181
182#endif /* _SO_NODE_KIT_PATH_ */
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition SbSystem.h:77
Base class for all node kits.
Definition SoBaseKit.h:262
Path that points to a list of hierarchical nodekits.
bool containsNode(SoBaseKit *node) const
Returns TRUE if the passed nodekit is found anywhere in the path chain.
void append(const SoNodeKitPath *fromPath)
Adds all nodekits in fromPath's chain to end of chain; the head node of fromPath must be the same as ...
SoNode * getTail() const
Return the last nodekit in a path chain.
void append(SoBaseKit *childKit)
Adds childKit to end of chain; uses first occurrence of childKit as a part within current last nodeki...
SoNode * getNodeFromTail(int i) const
Returns a pointer to the i'th nodekit in the chain, counting backward from the tail nodekit.
SoNodeKitPath(int approxLength)
Hide the constructor.
int findFork(const SoNodeKitPath *path) const
If the two paths have different head nodes, this returns -1.
void pop()
Pops the last nodekit off the end of the path.
void truncate(int start)
Truncates the path chain, removing all nodes from index start on.
virtual ~SoNodeKitPath()
Destructor.
SoNode * getNode(int i) const
Returns a pointer to the i'th node in the nodekit path.
int getLength() const
Returns length of path chain (number of nodekits).
Abstract base class for all database nodes.
Definition SoNode.h:103
Path that points to a list of hierarchical nodes.
Definition SoPath.h:109
friend INVENTOR_API bool operator==(const SoPath &p1, const SoPath &p2)
Comparison operator: returns TRUE if all nodes in paths are identical.
void insertIndex(SoNode *parent, int newIndex)
This is called when a node in the path chain has a child added.
void append(int childIndex)
Adds node to end of chain; the node is the childIndex'th child of the current tail node.
void replaceIndex(SoNode *parent, int index, SoNode *newChild)
This is called when a node in the path chain replaces a child.
void removeIndex(SoNode *parent, int oldIndex)
This is called when a node in the path chain has a child removed.
int getIndex(int i) const
Return the index of the i'th node (within its parent) in the chain.
Definition SoPath.h:164
void push(int childIndex)
These allow a path to be treated as a stack; they push a node at the end of the chain and pop the las...
Definition SoPath.h:143
int getIndexFromTail(int i) const
Return the index of the i'th node (within its parent) in the chain, counting backward from the tail n...
Definition SoPath.h:169
Searches for nodes in a scene graph.