00001 /* 00002 * This file is part of the "Archon" framework. 00003 * (http://files3d.sourceforge.net) 00004 * 00005 * Copyright © 2002 by Kristian Spangsege and Brian Kristiansen. 00006 * 00007 * Permission to use, copy, modify, and distribute this software and 00008 * its documentation under the terms of the GNU General Public License is 00009 * hereby granted. No representations are made about the suitability of 00010 * this software for any purpose. It is provided "as is" without express 00011 * or implied warranty. See the GNU General Public License 00012 * (http://www.gnu.org/copyleft/gpl.html) for more details. 00013 * 00014 * The characters in this file are ISO8859-1 encoded. 00015 * 00016 * The documentation in this file is in "Doxygen" style 00017 * (http://www.doxygen.org). 00018 */ 00019 00020 #ifndef ARCHON_X3D_FIELD_TYPE_H 00021 #define ARCHON_X3D_FIELD_TYPE_H 00022 00029 #include <string> 00030 #include <vector> 00031 00032 #include <archon/math/rotation.H> 00033 00034 #include <archon/util/ref.H> 00035 #include <archon/util/time.H> 00036 #include <archon/util/image.H> 00037 00038 #include <archon/x3d/server/exception.H> 00039 #include <archon/x3d/server/event.H> 00040 00041 namespace Archon 00042 { 00043 namespace X3D 00044 { 00045 using namespace std; 00046 using namespace Math; 00047 using namespace Utilities; 00048 00049 struct SFBool 00050 { 00051 typedef bool Type; 00052 typedef Type ArgType; 00053 typedef SimpleValue<Type> Value; 00054 static const unsigned index = 0; 00055 static const FieldType *type; 00056 }; 00057 00058 struct MFBool 00059 { 00060 typedef SFBool Single; 00061 typedef vector<Single::Type> Type; 00062 typedef const Type &ArgType; 00063 typedef SimpleValue<Type> Value; 00064 static const unsigned index = 1; 00065 static const FieldType *type; 00066 }; 00067 00068 00069 struct SFColor 00070 { 00071 typedef double ElemType; 00072 static const unsigned size = 3; 00073 typedef BasicVector<ElemType, size> Type; 00074 typedef Type ArgType; 00075 typedef SimpleValue<Type> Value; 00076 static const unsigned index = 2; 00077 static const FieldType *type; 00078 }; 00079 00080 struct MFColor 00081 { 00082 typedef SFColor Single; 00083 typedef vector<Single::Type> Type; 00084 typedef const Type &ArgType; 00085 typedef SimpleValue<Type> Value; 00086 static const unsigned index = 3; 00087 static const FieldType *type; 00088 }; 00089 00090 00091 struct SFColorRGBA 00092 { 00093 typedef double ElemType; 00094 static const unsigned size = 4; 00095 typedef BasicVector<ElemType, size> Type; 00096 typedef Type ArgType; 00097 typedef SimpleValue<Type> Value; 00098 static const unsigned index = 4; 00099 static const FieldType *type; 00100 }; 00101 00102 struct MFColorRGBA 00103 { 00104 typedef SFColorRGBA Single; 00105 typedef vector<Single::Type> Type; 00106 typedef const Type &ArgType; 00107 typedef SimpleValue<Type> Value; 00108 static const unsigned index = 5; 00109 static const FieldType *type; 00110 }; 00111 00112 00113 struct SFDouble 00114 { 00115 typedef double Type; 00116 typedef Type ArgType; 00117 typedef SimpleValue<Type> Value; 00118 static const unsigned index = 6; 00119 static const FieldType *type; 00120 }; 00121 00122 struct MFDouble 00123 { 00124 typedef SFDouble Single; 00125 typedef vector<Single::Type> Type; 00126 typedef const Type &ArgType; 00127 typedef SimpleValue<Type> Value; 00128 static const unsigned index = 7; 00129 static const FieldType *type; 00130 }; 00131 00132 00133 struct SFFloat 00134 { 00135 typedef double Type; 00136 typedef Type ArgType; 00137 typedef SimpleValue<Type> Value; 00138 static const unsigned index = 8; 00139 static const FieldType *type; 00140 }; 00141 00142 struct MFFloat 00143 { 00144 typedef SFFloat Single; 00145 typedef vector<Single::Type> Type; 00146 typedef const Type &ArgType; 00147 typedef SimpleValue<Type> Value; 00148 static const unsigned index = 9; 00149 static const FieldType *type; 00150 }; 00151 00152 00153 struct SFImage 00154 { 00155 typedef Image Type; 00156 typedef const Type &ArgType; 00157 typedef SimpleValue<Type> Value; 00158 static const unsigned index = 10; 00159 static const FieldType *type; 00160 }; 00161 00162 struct MFImage 00163 { 00164 typedef SFImage Single; 00165 typedef vector<Single::Type> Type; 00166 typedef const Type &ArgType; 00167 typedef SimpleValue<Type> Value; 00168 static const unsigned index = 11; 00169 static const FieldType *type; 00170 }; 00171 00172 00173 struct SFInt32 00174 { 00175 typedef int Type; 00176 typedef Type ArgType; 00177 typedef SimpleValue<Type> Value; 00178 static const unsigned index = 12; 00179 static const FieldType *type; 00180 }; 00181 00182 struct MFInt32 00183 { 00184 typedef SFInt32 Single; 00185 typedef vector<Single::Type> Type; 00186 typedef const Type &ArgType; 00187 typedef SimpleValue<Type> Value; 00188 static const unsigned index = 13; 00189 static const FieldType *type; 00190 }; 00191 00192 00193 struct SFNode 00194 { 00195 static const unsigned index = 14; 00196 static const FieldType *type; 00197 }; 00198 00199 struct MFNode 00200 { 00201 static const unsigned index = 15; 00202 static const FieldType *type; 00203 }; 00204 00205 template<typename C> struct SFNodeVar: SFNode 00206 { 00207 typedef Ref<C> Type; 00208 typedef Type ArgType; 00209 typedef NodeValue Value; 00210 }; 00211 00212 template<typename C> struct MFNodeVar: MFNode 00213 { 00214 typedef SFNodeVar<C> Single; 00215 typedef vector<typename Single::Type> Type; 00216 typedef const Type &ArgType; 00217 typedef NodeSequenceValue Value; 00218 }; 00219 00220 00221 struct SFRotation 00222 { 00223 typedef double ElemType; 00224 static const unsigned size = 4; 00225 typedef Rotation3 Type; 00226 typedef Type ArgType; 00227 typedef SimpleValue<Type> Value; 00228 static const unsigned index = 16; 00229 static const FieldType *type; 00230 }; 00231 00232 struct MFRotation 00233 { 00234 typedef SFRotation Single; 00235 typedef vector<Single::Type> Type; 00236 typedef const Type &ArgType; 00237 typedef SimpleValue<Type> Value; 00238 static const unsigned index = 17; 00239 static const FieldType *type; 00240 }; 00241 00242 00243 struct SFString 00244 { 00245 typedef string Type; 00246 typedef Type ArgType; 00247 typedef SimpleValue<Type> Value; 00248 static const unsigned index = 18; 00249 static const FieldType *type; 00250 }; 00251 00252 struct MFString 00253 { 00254 typedef SFString Single; 00255 typedef vector<Single::Type> Type; 00256 typedef const Type &ArgType; 00257 typedef SimpleValue<Type> Value; 00258 static const unsigned index = 19; 00259 static const FieldType *type; 00260 }; 00261 00262 00263 struct SFTime 00264 { 00265 typedef long ElemType; 00266 static const unsigned size = 2; 00267 typedef Time Type; 00268 typedef Type ArgType; 00269 typedef SimpleValue<Type> Value; 00270 static const unsigned index = 20; 00271 static const FieldType *type; 00272 }; 00273 00274 struct MFTime 00275 { 00276 typedef SFTime Single; 00277 typedef vector<Single::Type> Type; 00278 typedef const Type &ArgType; 00279 typedef SimpleValue<Type> Value; 00280 static const unsigned index = 21; 00281 static const FieldType *type; 00282 }; 00283 00284 00285 struct SFVec2d 00286 { 00287 typedef SFDouble::Type ElemType; 00288 static const unsigned size = 2; 00289 typedef BasicVector<ElemType, size> Type; 00290 typedef Type ArgType; 00291 typedef SimpleValue<Type> Value; 00292 static const unsigned index = 22; 00293 static const FieldType *type; 00294 }; 00295 00296 struct MFVec2d 00297 { 00298 typedef SFVec2d Single; 00299 typedef vector<Single::Type> Type; 00300 typedef const Type &ArgType; 00301 typedef SimpleValue<Type> Value; 00302 static const unsigned index = 23; 00303 static const FieldType *type; 00304 }; 00305 00306 00307 struct SFVec2f 00308 { 00309 typedef SFFloat::Type ElemType; 00310 static const unsigned size = 2; 00311 typedef BasicVector<ElemType, size> Type; 00312 typedef Type ArgType; 00313 typedef SimpleValue<Type> Value; 00314 static const unsigned index = 24; 00315 static const FieldType *type; 00316 }; 00317 00318 struct MFVec2f 00319 { 00320 typedef SFVec2f Single; 00321 typedef vector<Single::Type> Type; 00322 typedef const Type &ArgType; 00323 typedef SimpleValue<Type> Value; 00324 static const unsigned index = 25; 00325 static const FieldType *type; 00326 }; 00327 00328 00329 struct SFVec3d 00330 { 00331 typedef SFDouble::Type ElemType; 00332 static const unsigned size = 3; 00333 typedef BasicVector<ElemType, size> Type; 00334 typedef Type ArgType; 00335 typedef SimpleValue<Type> Value; 00336 static const unsigned index = 26; 00337 static const FieldType *type; 00338 }; 00339 00340 struct MFVec3d 00341 { 00342 typedef SFVec3d Single; 00343 typedef vector<Single::Type> Type; 00344 typedef const Type &ArgType; 00345 typedef SimpleValue<Type> Value; 00346 static const unsigned index = 27; 00347 static const FieldType *type; 00348 }; 00349 00350 00351 struct SFVec3f 00352 { 00353 typedef SFFloat::Type ElemType; 00354 static const unsigned size = 3; 00355 typedef BasicVector<ElemType, size> Type; 00356 typedef Type ArgType; 00357 typedef SimpleValue<Type> Value; 00358 static const unsigned index = 28; 00359 static const FieldType *type; 00360 }; 00361 00362 struct MFVec3f 00363 { 00364 typedef SFVec3f Single; 00365 typedef vector<Single::Type> Type; 00366 typedef const Type &ArgType; 00367 typedef SimpleValue<Type> Value; 00368 static const unsigned index = 29; 00369 static const FieldType *type; 00370 }; 00371 00372 const unsigned fieldTypeIndexRoof = 30; 00373 } 00374 } 00375 00376 #endif // ARCHON_X3D_FIELD_TYPE_H