30 #ifndef __X3DTYPEFUNCTIONS_H__
31 #define __X3DTYPEFUNCTIONS_H__
80 inline const char* typeToString( X3DType t ) {
82 case SFFLOAT:
return "SFFloat";
83 case MFFLOAT:
return "MFFloat";
84 case SFDOUBLE:
return "SFDouble";
85 case MFDOUBLE:
return "MFDouble";
86 case SFTIME:
return "SFTime";
87 case MFTIME:
return "MFTime";
88 case SFINT32:
return "SFInt32";
89 case MFINT32:
return "MFInt32";
90 case SFVEC2F:
return "SFVec2f";
91 case MFVEC2F:
return "MFVec2f";
92 case SFVEC2D:
return "SFVec2d";
93 case MFVEC2D:
return "MFVec2d";
94 case SFVEC3F:
return "SFVec3f";
95 case MFVEC3F:
return "MFVec3f";
96 case SFVEC3D:
return "SFVec3d";
97 case MFVEC3D:
return "MFVec3d";
98 case SFVEC4F:
return "SFVec4f";
99 case MFVEC4F:
return "MFVec4f";
100 case SFVEC4D:
return "SFVec4d";
101 case MFVEC4D:
return "MFVec4d";
102 case SFBOOL:
return "SFBool";
103 case MFBOOL:
return "MFBool";
104 case SFSTRING:
return "SFString";
105 case MFSTRING:
return "MFString";
106 case SFNODE:
return "SFNode";
107 case MFNODE:
return "MFNode";
108 case SFCOLOR:
return "SFColor";
109 case MFCOLOR:
return "MFColor";
110 case SFCOLORRGBA:
return "SFColorRGBA";
111 case MFCOLORRGBA:
return "MFColorRGBA";
112 case SFROTATION:
return "SFRotation";
113 case MFROTATION:
return "MFRotation";
114 case SFQUATERNION:
return "SFQuaternion";
115 case MFQUATERNION:
return "MFQuaternion";
116 case SFMATRIX3F:
return "SFMatrix3f";
117 case MFMATRIX3F:
return "MFMatrix3f";
118 case SFMATRIX4F:
return "SFMatrix4f";
119 case MFMATRIX4F:
return "MFMatrix4f";
120 case SFMATRIX3D:
return "SFMatrix3d";
121 case MFMATRIX3D:
return "MFMatrix3d";
122 case SFMATRIX4D:
return "SFMatrix4d";
123 case MFMATRIX4D:
return "MFMatrix4d";
124 case UNKNOWN_X3D_TYPE:
125 default:
return "UNKNOWN_X3D_TYPE";
129 inline X3DType stringToType(
const char *t ) {
130 if( strcmp( t,
"SFFloat" ) == 0 )
return SFFLOAT;
131 else if( strcmp( t,
"MFFloat" ) == 0 )
return MFFLOAT;
132 else if( strcmp( t,
"SFDouble" ) == 0 )
return SFDOUBLE;
133 else if( strcmp( t,
"MFDouble" ) == 0 )
return MFDOUBLE;
134 else if( strcmp( t,
"SFTime" ) == 0 )
return SFTIME;
135 else if( strcmp( t,
"MFTime" ) == 0 )
return MFTIME;
136 else if( strcmp( t,
"SFInt32" ) == 0 )
return SFINT32;
137 else if( strcmp( t,
"MFInt32" ) == 0 )
return MFINT32;
138 else if( strcmp( t,
"SFVec2f" ) == 0 )
return SFVEC2F;
139 else if( strcmp( t,
"MFVec2f" ) == 0 )
return MFVEC2F;
140 else if( strcmp( t,
"SFVec3f" ) == 0 )
return SFVEC3F;
141 else if( strcmp( t,
"MFVec3f" ) == 0 )
return MFVEC3F;
142 else if( strcmp( t,
"SFVec4f" ) == 0 )
return SFVEC4F;
143 else if( strcmp( t,
"MFVec4f" ) == 0 )
return MFVEC4F;
144 else if( strcmp( t,
"SFVec2d" ) == 0 )
return SFVEC2D;
145 else if( strcmp( t,
"MFVec2d" ) == 0 )
return MFVEC2D;
146 else if( strcmp( t,
"SFVec3d" ) == 0 )
return SFVEC3D;
147 else if( strcmp( t,
"MFVec3d" ) == 0 )
return MFVEC3D;
148 else if( strcmp( t,
"SFVec4d" ) == 0 )
return SFVEC4D;
149 else if( strcmp( t,
"MFVec4d" ) == 0 )
return MFVEC4D;
150 else if( strcmp( t,
"SFBool" ) == 0 )
return SFBOOL;
151 else if( strcmp( t,
"MFBool" ) == 0 )
return MFBOOL;
152 else if( strcmp( t,
"SFString" ) == 0 )
return SFSTRING;
153 else if( strcmp( t,
"MFString" ) == 0 )
return MFSTRING;
154 else if( strcmp( t,
"SFNode" ) == 0 )
return SFNODE;
155 else if( strcmp( t,
"MFNode" ) == 0 )
return MFNODE;
156 else if( strcmp( t,
"SFColor" ) == 0 )
return SFCOLOR;
157 else if( strcmp( t,
"MFColor" ) == 0 )
return MFCOLOR;
158 else if( strcmp( t,
"SFColorRGBA" ) == 0 )
return SFCOLORRGBA;
159 else if( strcmp( t,
"MFColorRGBA" ) == 0 )
return MFCOLORRGBA;
160 else if( strcmp( t,
"SFRotation" ) == 0 )
return SFROTATION;
161 else if( strcmp( t,
"MFRotation" ) == 0 )
return MFROTATION;
162 else if( strcmp( t,
"SFQuaternion" ) == 0 )
return SFQUATERNION;
163 else if( strcmp( t,
"MFQuaternion" ) == 0 )
return MFQUATERNION;
164 else if( strcmp( t,
"SFMatrix3f" ) == 0 )
return SFMATRIX3F;
165 else if( strcmp( t,
"MFMatrix3f" ) == 0 )
return MFMATRIX3F;
166 else if( strcmp( t,
"SFMatrix4f" ) == 0 )
return SFMATRIX4F;
167 else if( strcmp( t,
"MFMatrix4f" ) == 0 )
return MFMATRIX4F;
168 else if( strcmp( t,
"SFMatrix3d" ) == 0 )
return SFMATRIX3D;
169 else if( strcmp( t,
"MFMatrix3d" ) == 0 )
return MFMATRIX3D;
170 else if( strcmp( t,
"SFMatrix4d" ) == 0 )
return SFMATRIX4D;
171 else if( strcmp( t,
"MFMatrix4d" ) == 0 )
return MFMATRIX4D;
172 else return UNKNOWN_X3D_TYPE;
175 inline Field *newFieldInstance( X3DTypes::X3DType t ) {
177 case X3DTypes::SFFLOAT:
179 case X3DTypes::MFFLOAT:
181 case X3DTypes::SFDOUBLE:
183 case X3DTypes::MFDOUBLE:
185 case X3DTypes::SFTIME:
187 case X3DTypes::MFTIME:
189 case X3DTypes::SFINT32:
191 case X3DTypes::MFINT32:
193 case X3DTypes::SFVEC2F:
195 case X3DTypes::MFVEC2F:
197 case X3DTypes::SFVEC2D:
199 case X3DTypes::MFVEC2D:
201 case X3DTypes::SFVEC3F:
203 case X3DTypes::MFVEC3F:
205 case X3DTypes::SFVEC3D:
207 case X3DTypes::MFVEC3D:
209 case X3DTypes::SFVEC4F:
211 case X3DTypes::MFVEC4F:
213 case X3DTypes::SFVEC4D:
215 case X3DTypes::MFVEC4D:
217 case X3DTypes::SFBOOL:
219 case X3DTypes::MFBOOL:
221 case X3DTypes::SFSTRING:
223 case X3DTypes::MFSTRING:
225 case X3DTypes::SFNODE:
227 case X3DTypes::MFNODE:
229 case X3DTypes::SFCOLOR:
231 case X3DTypes::MFCOLOR:
233 case X3DTypes::SFCOLORRGBA:
234 return new SFColorRGBA;
235 case X3DTypes::MFCOLORRGBA:
236 return new MFColorRGBA;
237 case X3DTypes::SFROTATION:
238 return new SFRotation;
239 case X3DTypes::MFROTATION:
240 return new MFRotation;
241 case X3DTypes::SFQUATERNION:
242 return new SFQuaternion;
243 case X3DTypes::MFQUATERNION:
244 return new MFQuaternion;
245 case X3DTypes::SFMATRIX3F:
246 return new SFMatrix3f;
247 case X3DTypes::MFMATRIX3F:
248 return new MFMatrix3f;
249 case X3DTypes::SFMATRIX4F:
250 return new SFMatrix4f;
251 case X3DTypes::MFMATRIX4F:
252 return new MFMatrix4f;
253 case X3DTypes::SFMATRIX3D:
254 return new SFMatrix3d;
255 case X3DTypes::MFMATRIX3D:
256 return new MFMatrix3d;
257 case X3DTypes::SFMATRIX4D:
258 return new SFMatrix4d;
259 case X3DTypes::MFMATRIX4D:
260 return new MFMatrix4d;
261 case X3DTypes::UNKNOWN_X3D_TYPE:
262 default:
return NULL;
266 inline Field *newFieldInstance(
const char *t ) {
267 return newFieldInstance( stringToType( t ) );
Contains different templates to modify field behaviour.
Contains the MFBool field class.
Contains the MFColorRGBA field class.
Contains the MFColor field class.
Contains the MFDouble field class.
Contains the MFFloat field class.
Contains the MFInt32 field class.
Contains the MFMatrix3d field class.
Contains the MFMatrix3f field class.
Contains the MFMatrix4d field class.
Contains the MFMatrix4f field class.
Contains the MFNode class.
Contains the MFQuaternion field class.
Contains the MFRotation field class.
Contains the MFString field class.
Contains the MFTime field class.
Contains the MFVec2d field class.
Contains the MFVec2f field class.
Contains the MFVec3d field class.
Contains the MFVec3f field class.
Contains the MFVec4d field class.
Contains the MFVec4f field class.
Contains the SFBool field class.
Contains the SFColorRGBA field class.
Contains the SFColor field class.
Contains the SFDouble field class.
Contains the SFFloat field class.
Contains the SFInt32 field class.
Contains the SFMatrix3d field class.
Contains the SFMatrix3f field class.
Contains the SFMatrix4d field class.
Contains the SFMatrix4f field class.
Contains the SFNode class.
Contains the SFQuaternion field class.
Contains the SFRotation field class.
Contains the SFString field class.
Contains the SFTime field class.
Contains the SFVec2d field class.
Contains the SFVec2f field class.
Contains the SFVec3d field class.
Contains the SFVec3f field class.
Contains the SFVec4d field class.
Contains the SFVec4f field class.
Header file containing all X3D types enumerated.
H3D API namespace.
Definition: Anchor.h:38