00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#ifndef COIN_SOTYPE_H
00021
#define COIN_SOTYPE_H
00022
00023
#include <Inventor/SbBasic.h>
00024
#include <Inventor/SbDict.h>
00025
#include <stdlib.h>
00026
00027
class SbName;
00028
class SoTypedObject;
00029
class SoTypeList;
00030
struct SoTypeData;
00031
template <
class Type>
class SbList;
00032
00033 class COIN_DLL_API SoType {
00034
public:
00035 typedef void * (*instantiationMethod)(
void);
00036
00037
static SoType fromName(
const SbName name);
00038
SbName getName(
void) const;
00039 const SoType getParent(
void) const;
00040 SbBool isDerivedFrom(const SoType type) const;
00041
00042 static
int getAllDerivedFrom(const SoType type,
SoTypeList & list);
00043
00044 SbBool canCreateInstance(
void) const;
00045
void * createInstance(
void) const;
00046
00047 uint16_t getData(
void) const;
00048 int16_t getKey(
void) const;
00049
00050 SbBool operator == (const SoType type) const;
00051 SbBool operator != (const SoType type) const;
00052
00053 SbBool operator < (const SoType type) const;
00054 SbBool operator <= (const SoType type) const;
00055 SbBool operator >= (const SoType type) const;
00056 SbBool operator > (const SoType type) const;
00057
00058 static const SoType createType(const SoType parent, const
SbName name,
00059 const
instantiationMethod method = (instantiationMethod) NULL,
00060 const uint16_t data = 0);
00061
00062 static const SoType overrideType(const SoType originalType,
00063 const instantiationMethod method = (instantiationMethod) NULL);
00064
00065 static
void init(
void);
00066
00067 static SoType fromKey(uint16_t key);
00068 static SoType badType(
void);
00069 SbBool isBad(
void) const;
00070
00071
void makeInternal(
void);
00072 SbBool isInternal(
void) const;
00073
00074 static
int getNumTypes(
void);
00075
00076 private:
00077 static
void clean(
void);
00078
00079 int16_t index;
00080
00081 static
SoTypeList * typelist;
00082 static
SbList<SoTypeData *> * typedatalist;
00083 static
SbDict * typedict;
00084 };
00085
00086
00087
00088 inline int16_t
00089 SoType::getKey(
void)
const
00090
{
00091
return this->index;
00092 }
00093
00094
inline SbBool
00095 SoType::operator != (
const SoType type)
const
00096
{
00097
return (this->
getKey() != type.
getKey());
00098 }
00099
00100
inline SbBool
00101 SoType::operator == (
const SoType type)
const
00102
{
00103
return (this->
getKey() == type.
getKey());
00104 }
00105
00106
inline SbBool
00107 SoType::operator < (
const SoType type)
const
00108
{
00109
return (this->
getKey() < type.
getKey());
00110 }
00111
00112
inline SbBool
00113 SoType::operator <= (
const SoType type)
const
00114
{
00115
return (this->
getKey() <= type.
getKey());
00116 }
00117
00118
inline SbBool
00119 SoType::operator >= (
const SoType type)
const
00120
{
00121
return (this->
getKey() >= type.
getKey());
00122 }
00123
00124
inline SbBool
00125 SoType::operator > (
const SoType type)
const
00126
{
00127
return (this->
getKey() > type.
getKey());
00128 }
00129
00130
inline SbBool
00131 SoType::isBad(
void)
const
00132
{
00133
return (this->index == 0);
00134 }
00135
00136
#endif // !COIN_SOTYPE_H