00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef REGISTER_TYPE_H
00020 #define REGISTER_TYPE_H
00021
00022 #include "pandabase.h"
00023
00024 #include "typeHandle.h"
00025 #include "typeRegistry.h"
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 INLINE void
00037 register_type(TypeHandle &type_handle, const string &name);
00038
00039 INLINE void
00040 register_type(TypeHandle &type_handle, const string &name,
00041 TypeHandle parent1);
00042
00043 INLINE void
00044 register_type(TypeHandle &type_handle, const string &name,
00045 TypeHandle parent1, TypeHandle parent2);
00046
00047 INLINE void
00048 register_type(TypeHandle &type_handle, const string &name,
00049 TypeHandle parent1, TypeHandle parent2,
00050 TypeHandle parent3);
00051
00052 INLINE void
00053 register_type(TypeHandle &type_handle, const string &name,
00054 TypeHandle parent1, TypeHandle parent2,
00055 TypeHandle parent3, TypeHandle parent4);
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 INLINE TypeHandle
00067 register_dynamic_type(const string &name);
00068
00069 INLINE TypeHandle
00070 register_dynamic_type(const string &name, TypeHandle parent1);
00071
00072 INLINE TypeHandle
00073 register_dynamic_type(const string &name,
00074 TypeHandle parent1, TypeHandle parent2);
00075
00076 INLINE TypeHandle
00077 register_dynamic_type(const string &name,
00078 TypeHandle parent1, TypeHandle parent2,
00079 TypeHandle parent3);
00080
00081 INLINE TypeHandle
00082 register_dynamic_type(const string &name,
00083 TypeHandle parent1, TypeHandle parent2,
00084 TypeHandle parent3, TypeHandle parent4);
00085
00086
00087
00088 extern TypeHandle EXPCL_PANDAEXPRESS long_type_handle;
00089 extern TypeHandle EXPCL_PANDAEXPRESS int_type_handle;
00090 extern TypeHandle EXPCL_PANDAEXPRESS short_type_handle;
00091 extern TypeHandle EXPCL_PANDAEXPRESS char_type_handle;
00092 extern TypeHandle EXPCL_PANDAEXPRESS bool_type_handle;
00093 extern TypeHandle EXPCL_PANDAEXPRESS double_type_handle;
00094 extern TypeHandle EXPCL_PANDAEXPRESS float_type_handle;
00095
00096 extern TypeHandle long_p_type_handle;
00097 extern TypeHandle int_p_type_handle;
00098 extern TypeHandle short_p_type_handle;
00099 extern TypeHandle char_p_type_handle;
00100 extern TypeHandle bool_p_type_handle;
00101 extern TypeHandle double_p_type_handle;
00102 extern TypeHandle float_p_type_handle;
00103 extern TypeHandle void_p_type_handle;
00104
00105 void EXPCL_PANDAEXPRESS init_system_type_handles();
00106
00107
00108
00109
00110
00111 template<class T>
00112 INLINE TypeHandle _get_type_handle(const T *) {
00113 return T::get_class_type();
00114 }
00115
00116 template<>
00117 INLINE TypeHandle _get_type_handle(const long *) {
00118 return long_type_handle;
00119 }
00120
00121 template<>
00122 INLINE TypeHandle _get_type_handle(const int *) {
00123 return int_type_handle;
00124 }
00125
00126 template<>
00127 INLINE TypeHandle _get_type_handle(const short *) {
00128 return short_type_handle;
00129 }
00130
00131 template<>
00132 INLINE TypeHandle _get_type_handle(const char *) {
00133 return char_type_handle;
00134 }
00135
00136 template<>
00137 INLINE TypeHandle _get_type_handle(const bool *) {
00138 return bool_type_handle;
00139 }
00140
00141 template<>
00142 INLINE TypeHandle _get_type_handle(const double *) {
00143 return double_type_handle;
00144 }
00145
00146 template<>
00147 INLINE TypeHandle _get_type_handle(const float *) {
00148 return float_type_handle;
00149 }
00150
00151 template<>
00152 INLINE TypeHandle _get_type_handle(const long * const *) {
00153 return long_p_type_handle;
00154 }
00155
00156 template<>
00157 INLINE TypeHandle _get_type_handle(const int * const *) {
00158 return int_p_type_handle;
00159 }
00160
00161 template<>
00162 INLINE TypeHandle _get_type_handle(const short * const *) {
00163 return short_p_type_handle;
00164 }
00165
00166 template<>
00167 INLINE TypeHandle _get_type_handle(const char * const *) {
00168 return char_p_type_handle;
00169 }
00170
00171 template<>
00172 INLINE TypeHandle _get_type_handle(const bool * const *) {
00173 return bool_p_type_handle;
00174 }
00175
00176 template<>
00177 INLINE TypeHandle _get_type_handle(const double * const *) {
00178 return double_p_type_handle;
00179 }
00180
00181 template<>
00182 INLINE TypeHandle _get_type_handle(const float * const *) {
00183 return float_p_type_handle;
00184 }
00185
00186 template<>
00187 INLINE TypeHandle _get_type_handle(const void * const *) {
00188 return void_p_type_handle;
00189 }
00190
00191
00192
00193
00194 #define get_type_handle(type) _get_type_handle((const type *)0)
00195
00196
00197
00198
00199
00200
00201 template<class T>
00202 INLINE void _do_init_type(const T *) {
00203 T::init_type();
00204 }
00205
00206 template<>
00207 INLINE void _do_init_type(const long *) {
00208 init_system_type_handles();
00209 }
00210
00211 template<>
00212 INLINE void _do_init_type(const int *) {
00213 init_system_type_handles();
00214 }
00215
00216 template<>
00217 INLINE void _do_init_type(const short *) {
00218 init_system_type_handles();
00219 }
00220
00221 template<>
00222 INLINE void _do_init_type(const char *) {
00223 init_system_type_handles();
00224 }
00225
00226 template<>
00227 INLINE void _do_init_type(const bool *) {
00228 init_system_type_handles();
00229 }
00230
00231 template<>
00232 INLINE void _do_init_type(const double *) {
00233 init_system_type_handles();
00234 }
00235
00236 template<>
00237 INLINE void _do_init_type(const float *) {
00238 init_system_type_handles();
00239 }
00240
00241 template<>
00242 INLINE void _do_init_type(const long * const *) {
00243 init_system_type_handles();
00244 }
00245
00246 template<>
00247 INLINE void _do_init_type(const int * const *) {
00248 init_system_type_handles();
00249 }
00250
00251 template<>
00252 INLINE void _do_init_type(const short * const *) {
00253 init_system_type_handles();
00254 }
00255
00256 template<>
00257 INLINE void _do_init_type(const char * const *) {
00258 init_system_type_handles();
00259 }
00260
00261 template<>
00262 INLINE void _do_init_type(const bool * const *) {
00263 init_system_type_handles();
00264 }
00265
00266 template<>
00267 INLINE void _do_init_type(const double * const *) {
00268 init_system_type_handles();
00269 }
00270
00271 template<>
00272 INLINE void _do_init_type(const float * const *) {
00273 init_system_type_handles();
00274 }
00275
00276 template<>
00277 INLINE void _do_init_type(const void * const *) {
00278 init_system_type_handles();
00279 }
00280
00281 #define do_init_type(type) _do_init_type((const type *)0)
00282
00283 #include "register_type.I"
00284
00285 #endif