![]() |
http://www.sim.no/ http://www.coin3d.org/ |
00001 #ifndef COIN_SOTYPE_H 00002 #define COIN_SOTYPE_H 00003 00004 /**************************************************************************\ 00005 * 00006 * This file is part of the Coin 3D visualization library. 00007 * Copyright (C) by Kongsberg Oil & Gas Technologies. 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * ("GPL") version 2 as published by the Free Software Foundation. 00012 * See the file LICENSE.GPL at the root directory of this source 00013 * distribution for additional information about the GNU GPL. 00014 * 00015 * For using Coin with software that can not be combined with the GNU 00016 * GPL, and for taking advantage of the additional benefits of our 00017 * support services, please contact Kongsberg Oil & Gas Technologies 00018 * about acquiring a Coin Professional Edition License. 00019 * 00020 * See http://www.coin3d.org/ for more information. 00021 * 00022 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY. 00023 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 00024 * 00025 \**************************************************************************/ 00026 00027 #include <Inventor/SbBasic.h> 00028 #include <stdlib.h> // For NULL definition. 00029 00030 #ifndef COIN_INTERNAL 00031 // The next include for Open Inventor compatibility. 00032 // 00033 // FIXME: I haven't checked that this is actually required -- test vs 00034 // SGI Inventor. 20050524 mortene. 00035 #include <Inventor/SbDict.h> 00036 #endif // COIN_INTERNAL 00037 00038 // ************************************************************************* 00039 00040 class SbName; 00041 class SoTypedObject; 00042 class SoTypeList; 00043 class SoFieldData; 00044 class SbDict; 00045 struct SoTypeData; 00046 template <class Type> class SbList; 00047 00048 // ************************************************************************* 00049 00050 class COIN_DLL_API SoType { 00051 public: 00052 typedef void * (*instantiationMethod)(void); 00053 00054 static SoType fromName(const SbName name); 00055 SbName getName(void) const; 00056 const SoType getParent(void) const; 00057 SbBool isDerivedFrom(const SoType type) const; 00058 00059 static int getAllDerivedFrom(const SoType type, SoTypeList & list); 00060 00061 SbBool canCreateInstance(void) const; 00062 void * createInstance(void) const; 00063 00064 uint16_t getData(void) const; 00065 int16_t getKey(void) const; 00066 00067 SbBool operator == (const SoType type) const; 00068 SbBool operator != (const SoType type) const; 00069 00070 SbBool operator < (const SoType type) const; 00071 SbBool operator <= (const SoType type) const; 00072 SbBool operator >= (const SoType type) const; 00073 SbBool operator > (const SoType type) const; 00074 00075 static const SoType createType(const SoType parent, const SbName name, 00076 const instantiationMethod method = NULL, 00077 const uint16_t data = 0); 00078 00079 static const SoType overrideType(const SoType originalType, 00080 const instantiationMethod method = NULL); 00081 00082 static SbBool removeType(const SbName & name); 00083 00084 static void init(void); 00085 00086 static SoType fromKey(uint16_t key); 00087 static SoType badType(void); 00088 SbBool isBad(void) const; 00089 00090 void makeInternal(void); 00091 SbBool isInternal(void) const; 00092 00093 static int getNumTypes(void); 00094 00095 instantiationMethod getInstantiationMethod(void) const; 00096 00097 private: 00098 static void clean(void); 00099 00100 int16_t index; 00101 00102 static SbList<SoTypeData *> * typedatalist; 00103 }; 00104 00105 /* inline methods ************************************************/ 00106 00107 inline int16_t 00108 SoType::getKey(void) const 00109 { 00110 return this->index; 00111 } 00112 00113 inline SbBool 00114 SoType::operator != (const SoType type) const 00115 { 00116 return (this->getKey() != type.getKey()); 00117 } 00118 00119 inline SbBool 00120 SoType::operator == (const SoType type) const 00121 { 00122 return (this->getKey() == type.getKey()); 00123 } 00124 00125 inline SbBool 00126 SoType::operator < (const SoType type) const 00127 { 00128 return (this->getKey() < type.getKey()); 00129 } 00130 00131 inline SbBool 00132 SoType::operator <= (const SoType type) const 00133 { 00134 return (this->getKey() <= type.getKey()); 00135 } 00136 00137 inline SbBool 00138 SoType::operator >= (const SoType type) const 00139 { 00140 return (this->getKey() >= type.getKey()); 00141 } 00142 00143 inline SbBool 00144 SoType::operator > (const SoType type) const 00145 { 00146 return (this->getKey() > type.getKey()); 00147 } 00148 00149 inline SbBool 00150 SoType::isBad(void) const 00151 { 00152 return (this->index == 0); 00153 } 00154 00155 #endif // !COIN_SOTYPE_H
Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.
Generated on Fri Dec 11 2015 03:24:56 for Coin by Doxygen 1.7.6.1.