Coin Logo http://www.sim.no/
http://www.coin3d.org/

SoPath.h
1 #ifndef COIN_SOPATH_H
2 #define COIN_SOPATH_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) by Kongsberg Oil & Gas Technologies.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Kongsberg Oil & Gas Technologies
18  * about acquiring a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <Inventor/misc/SoBase.h>
28 #include <Inventor/lists/SbList.h>
29 #include <Inventor/lists/SoNodeList.h>
30 
31 #ifndef COIN_INTERNAL
32 // For SGI / TGS Open Inventor compile-time compatibility.
33 #include <Inventor/SoLists.h>
34 #endif // !COIN_INTERNAL
35 
36 
37 class SoWriteAction;
38 class SoNotList;
39 class SoInput;
40 class SoPathList;
41 
42 
43 class COIN_DLL_API SoPath : public SoBase {
44  typedef SoBase inherited;
45 
46 public:
47  static void initClass(void);
48 
49  SoPath(const int approxlength = 4);
50  SoPath(SoNode * const head);
51  SoPath(const SoPath & rhs);
52 
53  SoPath & operator=(const SoPath & rhs);
54 
55  static SoType getClassTypeId(void);
56  virtual SoType getTypeId(void) const;
57 
58  void setHead(SoNode * const head);
59  SoNode * getHead(void) const;
60  void append(const int childindex);
61  void append(SoNode * const node);
62  void append(const SoPath * const frompath);
63  void push(const int childindex);
64  void pop(void);
65  SoNode * getTail(void) const;
66  SoNode * getNode(const int index) const;
67  SoNode * getNodeFromTail(const int index) const;
68  int getIndex(const int index) const;
69  int getIndexFromTail(const int index) const;
70  int getLength(void) const;
71  void truncate(const int length);
72 
73  int findFork(const SoPath * const path) const;
74  int findNode(const SoNode * const node) const;
75 
76  SbBool containsNode(const SoNode * const node) const;
77  SbBool containsPath(const SoPath * const path) const;
78  SoPath * copy(const int startfromnodeindex = 0, int numnodes = 0) const;
79  friend COIN_DLL_API SbBool operator==(const SoPath & lhs, const SoPath & rhs);
80  friend COIN_DLL_API SbBool operator!=(const SoPath & lhs, const SoPath & rhs);
81 
82  static SoPath * getByName(const SbName name);
83  static int getByName(const SbName name, SoPathList & l);
84 
85  void insertIndex(SoNode * const parent, const int newindex);
86  void removeIndex(SoNode * const parent, const int oldindex);
87  void replaceIndex(SoNode * const parent, const int index,
88  SoNode * const newchild);
89  SbBool isRelevantNotification(SoNotList * const l) const;
90 
91  virtual void write(SoWriteAction * action);
92 
93 protected:
94  virtual ~SoPath();
95  void auditPath(const SbBool flag);
96 
97 private:
98  static void cleanupClass(void);
99  static void * createInstance(void);
100  void append(SoNode * const node, const int index);
101  int getFullLength(void) const;
102  void truncate(const int length, const SbBool donotify);
103  virtual SbBool readInstance(SoInput * in, unsigned short flags);
104  void setFirstHidden(void);
105 
106  SoNodeList nodes;
107  SbList<int> indices;
108  SbBool isauditing;
109  int firsthidden;
110  SbBool firsthiddendirty;
111  static SoType classTypeId;
112 
113  friend class SoFullPath;
114  friend class SoNodeKitPath;
115  friend class SoAction;
116  friend class SoTempPath;
117 };
118 
120 
121 inline int
122 SoPath::getFullLength(void) const
123 {
124  return this->nodes.getLength();
125 }
126 
127 inline void
128 SoPath::push(const int childindex)
129 {
130  this->append(childindex);
131 }
132 
133 inline void
135 {
136  this->truncate(this->getFullLength() - 1);
137 }
138 
140 
141 
142 #ifndef COIN_INTERNAL
143 // For SGI / TGS Open Inventor compile-time compatibility.
144 #include <Inventor/SoFullPath.h>
145 #include <Inventor/misc/SoLightPath.h>
146 #endif // COIN_INTERNAL
147 
148 #endif // !COIN_SOPATH_H
The SoBase class is the top-level superclass for a number of class-hierarchies.SoBase provides the ba...
Definition: SoBase.h:36
The SoPathList class is a container for pointers to SoPath objects.As this class inherits SoBaseList...
Definition: SoPathList.h:31
virtual SoType getTypeId(void) const =0
void push(const int childindex)
Definition: SoPath.h:128
The SoNodeKitPath class is a path that contains only nodekit nodes.All other nodes are hidden from th...
Definition: SoNodeKitPath.h:33
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
The SoFullPath class allows examination of hidden children in paths.SoPath allows only access from th...
Definition: SoFullPath.h:29
The SoPath class is a container class for traversal path descriptions.SoPath objects contain a list o...
Definition: SoPath.h:43
The SoAction class is the base class for all traversal actions.Applying actions is the basic mechanis...
Definition: SoAction.h:68
The SoTempPath class is used to store temporary paths.The path simply turns off auditing in the const...
Definition: SoTempPath.h:29
virtual SbBool readInstance(SoInput *input, unsigned short flags)=0
static void initClass(void)
Definition: SoBase.cpp:338
void append(const int childindex)
Definition: SoPath.cpp:193
The SoNodeList class is a container for pointers to SoNode objects.
Definition: SoNodeList.h:31
The SoWriteAction class writes a scene graph to file.When applied to a scene, this action writes its ...
Definition: SoWriteAction.h:33
The SoInput class is an abstraction of file import functionality.This class takes care of most of the...
Definition: SoInput.h:52
static SoType getClassTypeId(void)
Definition: SoBase.cpp:616
void pop(void)
Definition: SoPath.h:134
The SoNotList class is a list of SoNotRec notification records.
Definition: SoNotification.h:34
The SoType class is the basis for the run-time type system in Coin.Many of the classes in the Coin li...
Definition: SoType.h:50
int getLength(void) const
Definition: SbPList.h:94
The SbName class stores strings by reference.The class is used by Coin for storing keywords...
Definition: SbName.h:31
void truncate(const int length)
Definition: SoPath.cpp:507

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated for Coin by Doxygen 1.8.14.