Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

X3DBaseTypes.h

Go to the documentation of this file.
00001 
00002 //                            X3DBaseTypes.h                                  //
00004 
00005 #ifndef X3DBASETYPES_H
00006 #define X3DBASETYPES_H
00007 
00008 #include "SFString.h"
00009 #include "SFVec3f.h"
00010 #include "SFPoint3f.h"
00011 #include "SFMatrix34f.h"
00012 
00013 #include <iostream>
00014 #include <string>
00015 #include <list>
00016 #include <vector>
00017 #include <map>
00018 
00019 namespace X3DTK {
00020 
00022 class MFString : public std::vector<SFString>
00023 {
00024 public:
00026   MFString(){};
00028   explicit MFString(const SFString &s);
00029 };
00030 
00032 typedef bool SFBool;
00033 
00035 class MFBool : public std::vector<SFBool>
00036 {
00037 public:
00039   MFBool(){};
00041   explicit MFBool(const SFString &s);
00042 };
00043 
00045 typedef int SFInt32;
00046 
00048 class MFInt32 : public std::vector<SFInt32>
00049 {
00050 public:
00052   MFInt32(){};
00054   explicit MFInt32(size_type n, const SFInt32 &V = SFInt32()); 
00056   explicit MFInt32(const SFString &s);
00057 };
00058 
00060 typedef float SFFloat;
00061 
00063 class MFFloat : public std::vector<SFFloat>
00064 {
00065 public:
00067   MFFloat(){};
00069   explicit MFFloat(size_type n, const SFFloat &V = SFFloat());
00071   explicit MFFloat(const SFString &s);
00072 };
00073 
00075 typedef double SFDouble;
00076 
00078 class MFDouble : public std::vector<SFDouble>
00079 {
00080 public:
00082   MFDouble(){};
00084   explicit MFDouble(const SFString &s);
00085 };
00086 
00088 class SFColorRGBA
00089 {
00090 public:
00092   SFFloat r;
00094   SFFloat g;
00096   SFFloat b;
00098   SFFloat a;
00100   SFColorRGBA(){};
00102   SFColorRGBA(SFFloat r, SFFloat g, SFFloat b, SFFloat a);
00104   explicit SFColorRGBA(const SFString &s);
00105   
00107   friend bool operator== (const SFColorRGBA &r1, const SFColorRGBA &r2);
00109   friend bool operator!= (const SFColorRGBA &r1, const SFColorRGBA &r2);
00110 };
00111 
00113 class MFColorRGBA : public std::vector<SFColorRGBA>
00114 {
00115 public:
00117   MFColorRGBA(){};
00119   MFColorRGBA(size_type n, const SFColorRGBA &C = SFColorRGBA());
00121   explicit MFColorRGBA(const SFString &s);
00122 };
00123 
00125 class SFColor
00126 {
00127 public:
00129   SFFloat r;
00131   SFFloat g;
00133   SFFloat b;
00135   SFColor(){};
00137   SFColor(SFFloat r, SFFloat g, SFFloat b);
00139   explicit SFColor(const SFString &s);
00141   operator const SFColorRGBA() const;
00142  
00144   friend bool operator== (const SFColor &r1, const SFColor &r2);
00146   friend bool operator!= (const SFColor &r1, const SFColor &r2);
00147 };
00148 
00149 
00151 class MFColor : public std::vector<SFColor>
00152 {
00153 public:
00155   MFColor(){};
00157   explicit MFColor(const SFString &s);
00158   operator const MFColorRGBA() const;
00159 };
00160 
00161 class X3DAbstractNode;
00163 typedef X3DAbstractNode *SFAbstractNode;
00165 typedef std::list<SFAbstractNode> MFAbstractNode;
00166 
00168 class SFVec2d
00169 {
00170 public:
00171   SFDouble x, y;
00173   SFVec2d();
00175   SFVec2d(SFDouble x, SFDouble y);
00177   explicit SFVec2d(const SFString &s);
00178 };
00179   
00181 class MFVec2d : public std::vector<SFVec2d>
00182 {
00183 public:
00185   MFVec2d(){};
00187   explicit MFVec2d(const SFString &s);
00188 };
00189   
00191 class SFVec2f
00192 {
00193 public:
00194   SFFloat x, y;
00196   SFVec2f();
00198   SFVec2f(SFFloat x, SFFloat y);
00200   explicit SFVec2f(const SFString &s);
00201 };
00202 
00204 class MFVec2f : public std::vector<SFVec2f>
00205 {
00206 public:
00208   MFVec2f(){};
00210   explicit MFVec2f(const SFString &s);
00211 };
00212 
00214 class SFVec3d
00215 {
00216 public:
00217   SFDouble x, y, z;
00219   SFVec3d();
00221   SFVec3d(SFDouble x, SFDouble y, SFDouble z);
00223   explicit SFVec3d(const SFString &s);    
00224 };
00225 
00227 class MFVec3d : public std::vector<SFVec3d>
00228 {
00229 public:
00231   MFVec3d(){};
00233   explicit MFVec3d(const SFString &s);
00234 };
00235 
00237 class MFVec3f : public std::vector<SFVec3f>
00238 {
00239 public:
00241   MFVec3f(){};
00243   explicit MFVec3f(size_type n, const SFVec3f &V = SFVec3f());
00245   explicit MFVec3f(const SFString &s);
00246 };
00247 
00249 class SFRotation
00250 {
00251 public:
00252   SFFloat x, y, z, angle;
00254   SFRotation(){};
00256   SFRotation(SFFloat x, SFFloat y, SFFloat z, SFFloat angle);
00258   explicit SFRotation(const SFString &s);
00259   
00261   friend bool operator== (const SFRotation &r1, const SFRotation &r2);
00263   friend bool operator!= (const SFRotation &r1, const SFRotation &r2);
00264 };
00265 
00266 
00268 class MFRotation : public std::vector<SFRotation>
00269 {
00270 public:
00272   MFRotation(){};
00274   explicit MFRotation(const SFString &s);
00275 };
00276 
00277 
00278 //constants
00279 static const double PI = 3.14159265358979323846;
00280 static const double radCoef = 180.0/PI;
00281 
00283 inline SFFloat radiansToDegrees(SFFloat alpha)
00284 {
00285   return radCoef*alpha;
00286 }
00287 
00288 #ifndef DOXYGEN
00289 
00290 struct eqSFString
00291 {
00292   inline bool operator()(const SFString &s1, const SFString &s2) const
00293   {
00294     return s1 == s2;
00295   }
00296 };
00297 
00298 struct ltSFString
00299 {
00300   bool operator()(const SFString &s1, const SFString &s2) const
00301   {
00302     return strcmp(s1, s2) < 0;
00303   }
00304 };
00305 
00306 }
00307 
00308 #endif
00309 
00310 namespace X3DTK {
00311 
00312 // other types
00313 class Type;
00314 class Component;
00315 class SceneGraph;
00316 class WalkingFunction;
00317 class VisitingFunctions;
00318 class EnterFunction;
00319 class WalkOnFunction;
00320 class LeaveFunction;
00321 
00322 /*class X3DComponentWalker;
00324 typedef void (X3DComponentWalker::* ptrToWalkingFunction)(SFAbstractNode) const;
00325 
00326 class X3DComponentVisitor;
00328 typedef void (X3DComponentVisitor::* ptrToEnterFunction)(SFAbstractNode) const;
00330 typedef bool (X3DComponentVisitor::* ptrToWalkOnFunction)(SFAbstractNode, SFAbstractNode) const;
00332 typedef void (X3DComponentVisitor::* ptrToLeaveFunction)(SFAbstractNode) const;
00333 */
00334 
00336 typedef std::map<SFString, Type *, ltSFString> MFType;
00337 
00339 typedef std::map<SFString, Component *, ltSFString> MFComponent;
00341 typedef std::map<SFString, SceneGraph *, ltSFString> MFSceneGraph;
00343 typedef std::map<SFString, WalkingFunction *, ltSFString> WalkingDict;
00345 typedef std::map<SFString, EnterFunction *, ltSFString> EnterDict;
00347 typedef std::map<SFString, WalkOnFunction *, ltSFString> WalkOnDict;
00349 typedef std::map<SFString, LeaveFunction *, ltSFString> LeaveDict;
00350 
00352 typedef std::vector<WalkingFunction *> WalkingArray;
00354 typedef std::vector<VisitingFunctions *> VisitingArray;
00355 
00357 std::ostream& operator<<(std::ostream& o, const X3DTK::MFString &ms);
00359 std::ostream& operator<<(std::ostream& o, const X3DTK::MFBool &mb);
00361 std::ostream& operator<<(std::ostream& o, const X3DTK::MFInt32 &mi);
00363 std::ostream& operator<<(std::ostream& o, const X3DTK::MFFloat &mf);
00365 std::ostream& operator<<(std::ostream& o, const X3DTK::MFDouble &md);
00367 std::ostream& operator<<(std::ostream& o, const X3DTK::SFColor &c);
00369 std::ostream& operator<<(std::ostream& o, const X3DTK::MFColor &mc);
00371 std::ostream& operator<<(std::ostream& o, const X3DTK::SFColorRGBA &c);
00373 std::ostream& operator<<(std::ostream& o, const X3DTK::MFColorRGBA &mc);
00375 std::ostream& operator<<(std::ostream& o, const X3DTK::SFVec2d &v);
00377 std::ostream& operator<<(std::ostream& o, const X3DTK::MFVec2d &mv);
00379 std::ostream& operator<<(std::ostream& o, const X3DTK::SFVec2f &v);
00381 std::ostream& operator<<(std::ostream& o, const X3DTK::MFVec2f &mv);
00383 std::ostream& operator<<(std::ostream& o, const X3DTK::SFVec3d &v);
00385 std::ostream& operator<<(std::ostream& o, const X3DTK::MFVec3d &mv);
00387 std::ostream& operator<<(std::ostream& o, const X3DTK::SFVec3f &v);
00389 std::ostream& operator<<(std::ostream& o, const X3DTK::MFVec3f &mv);
00391 std::ostream& operator<<(std::ostream& o, const X3DTK::SFPoint3f &v);
00393 std::ostream& operator<<(std::ostream& o, const X3DTK::SFRotation &r);
00395 std::ostream& operator<<(std::ostream& o, const X3DTK::MFRotation &mr);
00396 
00397 }
00398 
00399 #endif

Generated on Thu Oct 9 13:50:55 2003 for X3DToolKit by doxygen1.2.18