Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

X3DBaseTypes.h

Go to the documentation of this file.
00001 #ifndef X3DTK_X3DBASETYPES_H
00002 #define X3DTK_X3DBASETYPES_H
00003 
00004 #include "Platform.h"
00005 #include "SFString.h"
00006 #include "SFVec3f.h"
00007 #include "SFVec2f.h"
00008 #include "SFPoint3f.h"
00009 #include "SFPoint2f.h"
00010 #include "SFMatrix34f.h"
00011 
00012 #include <iostream>
00013 #include <string>
00014 #include <list>
00015 #include <vector>
00016 #include <map>
00017 
00019 
00020 namespace X3DTK {
00021 
00028 class MFString : public std::vector<SFString>
00029 {
00030 public:
00032   MFString() {};
00034   explicit MFString(const SFString &s);
00035 };
00036 
00042 typedef bool SFBool;
00043 
00050 class MFBool : public std::vector<SFBool>
00051 {
00052 public:
00054   MFBool(){};
00056   explicit MFBool(const SFString &s);
00057 };
00058 
00064 typedef int SFInt32;
00065 
00072 class MFInt32 : public std::vector<SFInt32>
00073 {
00074 public:
00076   MFInt32(){};
00078   explicit MFInt32(size_type n, const SFInt32 &V = SFInt32()); 
00080   explicit MFInt32(const SFString &s);
00081 };
00082 
00088 typedef float SFFloat;
00089 
00096 class MFFloat : public std::vector<SFFloat>
00097 {
00098 public:
00100   MFFloat(){};
00102   explicit MFFloat(size_type n, const SFFloat &V = SFFloat());
00104   explicit MFFloat(const SFString &s);
00105 };
00106 
00112 typedef double SFDouble;
00113 
00120 class MFDouble : public std::vector<SFDouble>
00121 {
00122 public:
00124   MFDouble(){};
00126   explicit MFDouble(const SFString &s);
00127 };
00128 
00129 class SFColor;
00130 
00136 class SFColorRGBA
00137 {
00138 public:
00140   SFFloat r;
00142   SFFloat g;
00144   SFFloat b;
00146   SFFloat a;
00148   SFColorRGBA(){};
00150   SFColorRGBA(const SFColor &color);
00152   SFColorRGBA(SFFloat r, SFFloat g, SFFloat b, SFFloat a);
00154   explicit SFColorRGBA(const SFString &s);
00156   inline float *f_data() {return &r;};
00158   inline const float *f_data() const {return &r;};
00160   inline operator float *() {return &r;};
00162   inline operator const float *() const {return &r;};
00163  
00165   friend bool operator== (const SFColorRGBA &r1, const SFColorRGBA &r2);
00167   friend bool operator!= (const SFColorRGBA &r1, const SFColorRGBA &r2);
00168   
00170   static const SFColorRGBA null;
00171 };
00172 
00179 class MFColorRGBA : public std::vector<SFColorRGBA>
00180 {
00181 public:
00183   MFColorRGBA(){};
00185   MFColorRGBA(size_type n, const SFColorRGBA &C = SFColorRGBA());
00187   explicit MFColorRGBA(const SFString &s);
00188 };
00189 
00196 class SFColor
00197 {
00198 public:
00200   SFFloat r;
00202   SFFloat g;
00204   SFFloat b;
00206   SFColor(){};
00208   SFColor(SFFloat r, SFFloat g, SFFloat b);
00210   explicit SFColor(const SFString &s);
00212   inline float *f_data() {return &r;};
00214   inline const float *f_data() const {return &r;};
00216   inline operator float *() {return &r;};
00218   inline operator const float *() const {return &r;};
00219  
00221   friend bool operator== (const SFColor &r1, const SFColor &r2);
00223   friend bool operator!= (const SFColor &r1, const SFColor &r2);
00225   static const SFColor null;
00226 };
00227 
00234 class MFColor : public std::vector<SFColor>
00235 {
00236 public:
00238   MFColor(){};
00240   explicit MFColor(const SFString &s);
00242   operator const MFColorRGBA() const;
00243 };
00244 
00245 class X3DAbstractNode;
00246 
00252 typedef X3DAbstractNode *SFAbstractNode;
00253 
00260 typedef std::list<X3DAbstractNode *> MFAbstractNode;
00261 
00267 class SFVec2d
00268 {
00269 public:
00270   SFDouble x, y;
00272   SFVec2d();
00274   SFVec2d(SFDouble x, SFDouble y);
00276   explicit SFVec2d(const SFString &s);
00277 };
00278   
00285 class MFVec2d : public std::vector<SFVec2d>
00286 {
00287 public:
00289   MFVec2d(){};
00291   explicit MFVec2d(const SFString &s);
00292 };
00293   
00300 class MFVec2f : public std::vector<SFVec2f>
00301 {
00302 public:
00304   MFVec2f(){};
00306   explicit MFVec2f(size_type n, const SFVec2f &V = SFVec2f());
00308   explicit MFVec2f(const SFString &s);
00309 };
00310 
00317 class MFPoint2f : public std::vector<SFPoint2f>
00318 {
00319 public:
00321   MFPoint2f(){};
00323   explicit MFPoint2f(size_type n, const SFPoint2f &V = SFPoint2f());
00325   explicit MFPoint2f(const SFString &s);
00326 };
00327 
00333 class SFVec3d
00334 {
00335 public:
00336   SFDouble x, y, z;
00338   SFVec3d();
00340   SFVec3d(SFDouble x, SFDouble y, SFDouble z);
00342   explicit SFVec3d(const SFString &s);    
00343 };
00344 
00351 class MFVec3d : public std::vector<SFVec3d>
00352 {
00353 public:
00355   MFVec3d(){};
00357   explicit MFVec3d(const SFString &s);
00358 };
00359 
00366 class MFVec3f : public std::vector<SFVec3f>
00367 {
00368 public:
00370   MFVec3f(){};
00372   explicit MFVec3f(size_type n, const SFVec3f &V = SFVec3f());
00374   explicit MFVec3f(const SFString &s);
00375 };
00376 
00383 class MFPoint3f : public std::vector<SFPoint3f>
00384 {
00385 public:
00387   MFPoint3f(){};
00389   explicit MFPoint3f(size_type n, const SFPoint3f &V = SFPoint3f());
00391   explicit MFPoint3f(const SFString &s);
00392 };
00393 
00400 class SFRotation
00401 {
00402 public:
00403   SFFloat x, y, z, angle;
00405   SFRotation(){};
00407   SFRotation(SFFloat x, SFFloat y, SFFloat z, SFFloat angle);
00409   explicit SFRotation(const SFString &s);
00410   
00412   friend bool operator== (const SFRotation &r1, const SFRotation &r2);
00414   friend bool operator!= (const SFRotation &r1, const SFRotation &r2);
00415 };
00416 
00417 
00424 class MFRotation : public std::vector<SFRotation>
00425 {
00426 public:
00428   MFRotation(){};
00430   explicit MFRotation(const SFString &s);
00431 };
00432 
00438 static const double PI = 3.14159265358979323846;
00439 
00445 static const double radCoef = 180.0/PI;
00446 
00453 inline SFFloat radiansToDegrees(SFFloat alpha)
00454 {
00455   return static_cast<SFFloat>(radCoef*alpha);
00456 }
00457 
00458 }
00459 
00460 #ifndef DOXYGEN
00461 
00462 namespace X3DTK {
00463 
00464 struct eqSFString
00465 {
00466   inline bool operator()(const SFString &s1, const SFString &s2) const
00467   {
00468     return s1 == s2;
00469   }
00470 };
00471 
00472 struct ltSFString
00473 {
00474   bool operator()(const SFString &s1, const SFString &s2) const
00475   {
00476     return strcmp(s1, s2) < 0;
00477   }
00478 };
00479 
00480 }
00481 
00482 #endif
00483 
00484 namespace X3DTK {
00485 
00486 // other types
00487 class SFType;
00488 class SFComponent;
00489 class SFSceneGraph;
00490 class WalkFunction;
00491 class VisitingFunctions;
00492 class EnterFunction;
00493 class WalkOnFunction;
00494 class CreationFunction;
00495 class LeaveFunction;
00496 
00503 typedef std::map<SFString, SFType *, ltSFString> MFType;
00504 
00511 typedef std::map<SFString, SFComponent *, ltSFString> MFComponent;
00512 
00519 typedef std::map<SFString, SFSceneGraph *, ltSFString> MFSceneGraph;
00520 
00526 typedef std::map<SFString, WalkFunction *, ltSFString> WalkingDict;
00527 
00533 typedef std::map<SFString, EnterFunction *, ltSFString> EnterDict;
00534 
00540 typedef std::map<SFString, WalkOnFunction *, ltSFString> WalkOnDict;
00541 
00547 typedef std::map<SFString, LeaveFunction *, ltSFString> LeaveDict;
00548 
00554 typedef std::map<SFString, CreationFunction *, ltSFString> CreationDict;
00555 
00556 
00563 typedef std::vector<WalkFunction *> WalkingArray;
00564 
00571 typedef std::vector<VisitingFunctions *> VisitingArray;
00572 
00574 std::ostream& operator<<(std::ostream& o, const MFString &ms);
00576 std::ostream& operator<<(std::ostream& o, const MFBool &mb);
00578 std::ostream& operator<<(std::ostream& o, const MFInt32 &mi);
00580 std::ostream& operator<<(std::ostream& o, const MFFloat &mf);
00582 std::ostream& operator<<(std::ostream& o, const MFDouble &md);
00584 std::ostream& operator<<(std::ostream& o, const SFColor &c);
00586 std::ostream& operator<<(std::ostream& o, const MFColor &mc);
00588 std::ostream& operator<<(std::ostream& o, const SFColorRGBA &c);
00590 std::ostream& operator<<(std::ostream& o, const MFColorRGBA &mc);
00592 std::ostream& operator<<(std::ostream& o, const SFVec2d &v);
00594 std::ostream& operator<<(std::ostream& o, const MFVec2d &mv);
00596 std::ostream& operator<<(std::ostream& o, const SFVec2f &v);
00598 std::ostream& operator<<(std::ostream& o, const MFVec2f &mv);
00600 std::ostream& operator<<(std::ostream& o, const SFVec3d &v);
00602 std::ostream& operator<<(std::ostream& o, const MFVec3d &mv);
00604 std::ostream& operator<<(std::ostream& o, const SFVec3f &v);
00606 std::ostream& operator<<(std::ostream& o, const MFVec3f &mv);
00608 std::ostream& operator<<(std::ostream& o, const SFPoint3f &v);
00610 std::ostream& operator<<(std::ostream& o, const SFRotation &r);
00612 std::ostream& operator<<(std::ostream& o, const MFRotation &mr);
00614 std::ostream& operator<<(std::ostream& o, const SFMatrix34f &M);
00615 
00616 }
00617 
00618 #endif

Generated on Thu Jun 3 10:12:11 2004 for X3DToolKit by doxygen 1.3.6