Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

SoPath.h

00001 /**************************************************************************\ 00002 * 00003 * This file is part of the Coin 3D visualization library. 00004 * Copyright (C) 1998-2003 by Systems in Motion. All rights reserved. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * version 2.1 as published by the Free Software Foundation. See the 00009 * file LICENSE.LGPL at the root directory of the distribution for 00010 * more details. 00011 * 00012 * If you want to use Coin for applications not compatible with the 00013 * LGPL, please contact SIM to acquire a Professional Edition license. 00014 * 00015 * Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY 00016 * http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097 00017 * 00018 \**************************************************************************/ 00019 00020 #ifndef COIN_SOPATH_H 00021 #define COIN_SOPATH_H 00022 00023 #include <Inventor/misc/SoBase.h> 00024 #include <Inventor/lists/SbList.h> 00025 #include <Inventor/lists/SoNodeList.h> 00026 00027 #ifndef COIN_INTERNAL 00028 // For SGI / TGS Open Inventor compile-time compatibility. 00029 #include <Inventor/SoLists.h> 00030 #endif // !COIN_INTERNAL 00031 00032 00033 class SoWriteAction; 00034 class SoNotList; 00035 class SoInput; 00036 class SoPathList; 00037 00038 00039 class COIN_DLL_API SoPath : public SoBase { 00040 typedef SoBase inherited; 00041 00042 public: 00043 static void initClass(void); 00044 00045 SoPath(const int approxlength = 4); 00046 SoPath(SoNode * const head); 00047 SoPath(const SoPath & rhs); 00048 00049 SoPath & operator=(const SoPath & rhs); 00050 00051 static SoType getClassTypeId(void); 00052 virtual SoType getTypeId(void) const; 00053 00054 void setHead(SoNode * const head); 00055 SoNode * getHead(void) const; 00056 void append(const int childindex); 00057 void append(SoNode * const node); 00058 void append(const SoPath * const frompath); 00059 void push(const int childindex); 00060 void pop(void); 00061 SoNode * getTail(void) const; 00062 SoNode * getNode(const int index) const; 00063 SoNode * getNodeFromTail(const int index) const; 00064 int getIndex(const int index) const; 00065 int getIndexFromTail(const int index) const; 00066 int getLength(void) const; 00067 void truncate(const int length); 00068 00069 int findFork(const SoPath * const path) const; 00070 int findNode(const SoNode * const node) const; 00071 00072 SbBool containsNode(const SoNode * const node) const; 00073 SbBool containsPath(const SoPath * const path) const; 00074 SoPath * copy(const int startfromnodeindex = 0, int numnodes = 0) const; 00075 friend COIN_DLL_API SbBool operator==(const SoPath & lhs, const SoPath & rhs); 00076 friend COIN_DLL_API SbBool operator!=(const SoPath & lhs, const SoPath & rhs); 00077 00078 static SoPath * getByName(const SbName name); 00079 static int getByName(const SbName name, SoPathList & l); 00080 00081 void insertIndex(SoNode * const parent, const int newindex); 00082 void removeIndex(SoNode * const parent, const int oldindex); 00083 void replaceIndex(SoNode * const parent, const int index, 00084 SoNode * const newchild); 00085 SbBool isRelevantNotification(SoNotList * const l) const; 00086 00087 virtual void write(SoWriteAction * action); 00088 00089 protected: 00090 virtual ~SoPath(); 00091 void auditPath(const SbBool flag); 00092 00093 private: 00094 static void * createInstance(void); 00095 void append(SoNode * const node, const int index); 00096 int getFullLength(void) const; 00097 void truncate(const int length, const SbBool donotify); 00098 virtual SbBool readInstance(SoInput * in, unsigned short flags); 00099 void setFirstHidden(void); 00100 00101 SoNodeList nodes; 00102 SbList<int> indices; 00103 SbBool isauditing; 00104 int firsthidden; 00105 SbBool firsthiddendirty; 00106 static SoType classTypeId; 00107 00108 friend class SoFullPath; 00109 friend class SoNodeKitPath; 00110 friend class SoAction; 00111 friend class SoTempPath; 00112 }; 00113 00115 00116 inline int 00117 SoPath::getFullLength(void) const 00118 { 00119 return this->nodes.getLength(); 00120 } 00121 00122 inline void 00123 SoPath::push(const int childindex) 00124 { 00125 this->append(childindex); 00126 } 00127 00128 inline void 00129 SoPath::pop(void) 00130 { 00131 this->truncate(this->getFullLength() - 1); 00132 } 00133 00135 00136 00137 #ifndef COIN_INTERNAL 00138 // For SGI / TGS Open Inventor compile-time compatibility. 00139 #include <Inventor/SoFullPath.h> 00140 #include <Inventor/misc/SoLightPath.h> 00141 #endif // COIN_INTERNAL 00142 00143 #endif // !COIN_SOPATH_H

Generated on Tue Jul 27 23:53:01 2004 for Coin by doxygen 1.3.7