00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef SOQTOBJECT_H
00025 #define SOQTOBJECT_H
00026
00027 #include <assert.h>
00028
00029 #include <Inventor/SbBasic.h>
00030 #include <Inventor/SbString.h>
00031 #include <Inventor/SoType.h>
00032
00033 #include <Inventor/Qt/SoQtBasic.h>
00034
00035
00036
00037 class SOQT_DLL_API SoQtObject {
00038 static SoType classTypeId;
00039
00040 public:
00041 static void initClass(void);
00042 static SoType getClassTypeId(void);
00043 virtual SoType getTypeId(void) const = 0;
00044 SbBool isOfType(SoType type) const;
00045
00046 static void init(void);
00047
00048
00049
00050
00051
00052
00053 #if (SOQT_MAJOR_VERSION > 1)
00054 #error Resolve missing virtual destructor issue for the new major release!
00055 #endif
00056
00057 };
00058
00059
00060
00061
00062
00063 #define SOQT_SUN_CC_4_0_SOTYPE_INIT_BUG 0
00064
00065 #if SOQT_SUN_CC_4_0_SOTYPE_INIT_BUG
00066 #define SOQT_STATIC_SOTYPE_INIT
00067 #else
00068 #define SOQT_STATIC_SOTYPE_INIT = SoType::badType()
00069 #endif
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 #define SOQT_OBJECT_ABSTRACT_HEADER(classname, parentname) \
00080 public: \
00081 static void initClass(void); \
00082 static SoType getClassTypeId(void); \
00083 virtual SoType getTypeId(void) const ; \
00084 private: \
00085 typedef parentname inherited; \
00086 static SoType classTypeId
00087
00088 #define SOQT_OBJECT_HEADER(classname, parentname) \
00089 public: \
00090 static void initClass(void); \
00091 static SoType getClassTypeId(void); \
00092 virtual SoType getTypeId(void) const; \
00093 static void * createInstance(void); \
00094 private: \
00095 typedef parentname inherited; \
00096 static SoType classTypeId
00097
00098 #define SOQT_OBJECT_ABSTRACT_SOURCE(classname) \
00099 void classname::initClass(void) { \
00100 assert(classname::classTypeId == SoType::badType()); \
00101 classname::classTypeId = \
00102 SoType::createType(inherited::getClassTypeId(), \
00103 SO__QUOTE(classname)); \
00104 } \
00105 SoType classname::getClassTypeId(void) { \
00106 return classname::classTypeId; \
00107 } \
00108 SoType classname::getTypeId(void) const { \
00109 return classname::classTypeId; \
00110 } \
00111 SoType classname::classTypeId SOQT_STATIC_SOTYPE_INIT
00112
00113 #define SOQT_OBJECT_SOURCE(classname) \
00114 void classname::initClass(void) { \
00115 assert(classname::classTypeId == SoType::badType()); \
00116 classname::classTypeId = \
00117 SoType::createType(inherited::getClassTypeId(), \
00118 SO__QUOTE(classname), \
00119 classname::createInstance); \
00120 } \
00121 SoType classname::getClassTypeId(void) { \
00122 return classname::classTypeId; \
00123 } \
00124 SoType classname::getTypeId(void) const { \
00125 return classname::classTypeId; \
00126 } \
00127 void * classname::createInstance(void) { \
00128 assert(classname::classTypeId != SoType::badType()); \
00129 return (void *) new classname; \
00130 } \
00131 SoType classname::classTypeId SOQT_STATIC_SOTYPE_INIT
00132
00133
00134
00135 #endif // ! SOQTOBJECT_H