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 "Platform.h"
00009 #include "SFString.h"
00010 #include "SFVec3f.h"
00011 #include "SFVec2f.h"
00012 #include "SFPoint3f.h"
00013 #include "SFMatrix34f.h"
00014 
00015 #include <iostream>
00016 #include <string>
00017 #include <list>
00018 #include <vector>
00019 #include <map>
00020 
00021 namespace X3DTK {
00022 
00024 class MFString : public std::vector<SFString>
00025 {
00026 public:
00028   MFString(){};
00030   explicit MFString(const SFString &s);
00031 };
00032 
00034 typedef bool SFBool;
00035 
00037 class MFBool : public std::vector<SFBool>
00038 {
00039 public:
00041   MFBool(){};
00043   explicit MFBool(const SFString &s);
00044 };
00045 
00047 typedef int SFInt32;
00048 
00050 class MFInt32 : public std::vector<SFInt32>
00051 {
00052 public:
00054   MFInt32(){};
00056   explicit MFInt32(size_type n, const SFInt32 &V = SFInt32()); 
00058   explicit MFInt32(const SFString &s);
00059 };
00060 
00062 typedef float SFFloat;
00063 
00065 class MFFloat : public std::vector<SFFloat>
00066 {
00067 public:
00069   MFFloat(){};
00071   explicit MFFloat(size_type n, const SFFloat &V = SFFloat());
00073   explicit MFFloat(const SFString &s);
00074 };
00075 
00077 typedef double SFDouble;
00078 
00080 class MFDouble : public std::vector<SFDouble>
00081 {
00082 public:
00084   MFDouble(){};
00086   explicit MFDouble(const SFString &s);
00087 };
00088 
00090 class SFColorRGBA
00091 {
00092 public:
00094   SFFloat r;
00096   SFFloat g;
00098   SFFloat b;
00100   SFFloat a;
00102   SFColorRGBA(){};
00104   SFColorRGBA(SFFloat r, SFFloat g, SFFloat b, SFFloat a);
00106   explicit SFColorRGBA(const SFString &s);
00107   
00109   friend bool operator== (const SFColorRGBA &r1, const SFColorRGBA &r2);
00111   friend bool operator!= (const SFColorRGBA &r1, const SFColorRGBA &r2);
00112   
00114   static const SFColorRGBA null;
00115 };
00116 
00118 class MFColorRGBA : public std::vector<SFColorRGBA>
00119 {
00120 public:
00122   MFColorRGBA(){};
00124   MFColorRGBA(size_type n, const SFColorRGBA &C = SFColorRGBA());
00126   explicit MFColorRGBA(const SFString &s);
00127 };
00128 
00130 class SFColor
00131 {
00132 public:
00134   SFFloat r;
00136   SFFloat g;
00138   SFFloat b;
00140   SFColor(){};
00142   SFColor(SFFloat r, SFFloat g, SFFloat b);
00144   explicit SFColor(const SFString &s);
00146   operator const SFColorRGBA() const;
00147  
00149   friend bool operator== (const SFColor &r1, const SFColor &r2);
00151   friend bool operator!= (const SFColor &r1, const SFColor &r2);
00153   static const SFColor null;
00154 };
00155 
00156 
00158 class MFColor : public std::vector<SFColor>
00159 {
00160 public:
00162   MFColor(){};
00164   explicit MFColor(const SFString &s);
00165   operator const MFColorRGBA() const;
00166 };
00167 
00168 class X3DAbstractNode;
00170 typedef X3DAbstractNode *SFAbstractNode;
00172 typedef std::list<SFAbstractNode> MFAbstractNode;
00173 
00175 class SFVec2d
00176 {
00177 public:
00178   SFDouble x, y;
00180   SFVec2d();
00182   SFVec2d(SFDouble x, SFDouble y);
00184   explicit SFVec2d(const SFString &s);
00185 };
00186   
00188 class MFVec2d : public std::vector<SFVec2d>
00189 {
00190 public:
00192   MFVec2d(){};
00194   explicit MFVec2d(const SFString &s);
00195 };
00196   
00198 class MFVec2f : public std::vector<SFVec2f>
00199 {
00200 public:
00202   MFVec2f(){};
00204   explicit MFVec2f(size_type n, const SFVec2f &V = SFVec2f());
00206   explicit MFVec2f(const SFString &s);
00207 };
00208 
00210 class SFVec3d
00211 {
00212 public:
00213   SFDouble x, y, z;
00215   SFVec3d();
00217   SFVec3d(SFDouble x, SFDouble y, SFDouble z);
00219   explicit SFVec3d(const SFString &s);    
00220 };
00221 
00223 class MFVec3d : public std::vector<SFVec3d>
00224 {
00225 public:
00227   MFVec3d(){};
00229   explicit MFVec3d(const SFString &s);
00230 };
00231 
00233 class MFVec3f : public std::vector<SFVec3f>
00234 {
00235 public:
00237   MFVec3f(){};
00239   explicit MFVec3f(size_type n, const SFVec3f &V = SFVec3f());
00241   explicit MFVec3f(const SFString &s);
00242 };
00243 
00245 class SFRotation
00246 {
00247 public:
00248   SFFloat x, y, z, angle;
00250   SFRotation(){};
00252   SFRotation(SFFloat x, SFFloat y, SFFloat z, SFFloat angle);
00254   explicit SFRotation(const SFString &s);
00255   
00257   friend bool operator== (const SFRotation &r1, const SFRotation &r2);
00259   friend bool operator!= (const SFRotation &r1, const SFRotation &r2);
00260 };
00261 
00262 
00264 class MFRotation : public std::vector<SFRotation>
00265 {
00266 public:
00268   MFRotation(){};
00270   explicit MFRotation(const SFString &s);
00271 };
00272 
00273 
00274 //constants
00275 static const double PI = 3.14159265358979323846;
00276 static const double radCoef = 180.0/PI;
00277 
00279 inline SFFloat radiansToDegrees(SFFloat alpha)
00280 {
00281   return static_cast<SFFloat>(radCoef*alpha);
00282 }
00283 
00284 #ifndef DOXYGEN
00285 
00286 struct eqSFString
00287 {
00288   inline bool operator()(const SFString &s1, const SFString &s2) const
00289   {
00290     return s1 == s2;
00291   }
00292 };
00293 
00294 struct ltSFString
00295 {
00296   bool operator()(const SFString &s1, const SFString &s2) const
00297   {
00298     return strcmp(s1, s2) < 0;
00299   }
00300 };
00301 
00302 }
00303 
00304 #endif
00305 
00306 namespace X3DTK {
00307 
00308 // other types
00309 class SFType;
00310 class SFComponent;
00311 class SFSceneGraph;
00312 class WalkingFunction;
00313 class VisitingFunctions;
00314 class EnterFunction;
00315 class WalkOnFunction;
00316 class LeaveFunction;
00317 
00318 /*class X3DComponentWalker;
00320 typedef void (X3DComponentWalker::* ptrToWalkingFunction)(SFAbstractNode) const;
00321 
00322 class X3DComponentVisitor;
00324 typedef void (X3DComponentVisitor::* ptrToEnterFunction)(SFAbstractNode) const;
00326 typedef bool (X3DComponentVisitor::* ptrToWalkOnFunction)(SFAbstractNode, SFAbstractNode) const;
00328 typedef void (X3DComponentVisitor::* ptrToLeaveFunction)(SFAbstractNode) const;
00329 */
00330 
00332 typedef std::map<SFString, SFType *, ltSFString> MFType;
00333 
00335 typedef std::map<SFString, SFComponent *, ltSFString> MFComponent;
00337 typedef std::map<SFString, SFSceneGraph *, ltSFString> MFSceneGraph;
00339 typedef std::map<SFString, WalkingFunction *, ltSFString> WalkingDict;
00341 typedef std::map<SFString, EnterFunction *, ltSFString> EnterDict;
00343 typedef std::map<SFString, WalkOnFunction *, ltSFString> WalkOnDict;
00345 typedef std::map<SFString, LeaveFunction *, ltSFString> LeaveDict;
00346 
00348 typedef std::vector<WalkingFunction *> WalkingArray;
00350 typedef std::vector<VisitingFunctions *> VisitingArray;
00351 
00353 std::ostream& operator<<(std::ostream& o, const X3DTK::MFString &ms);
00355 std::ostream& operator<<(std::ostream& o, const X3DTK::MFBool &mb);
00357 std::ostream& operator<<(std::ostream& o, const X3DTK::MFInt32 &mi);
00359 std::ostream& operator<<(std::ostream& o, const X3DTK::MFFloat &mf);
00361 std::ostream& operator<<(std::ostream& o, const X3DTK::MFDouble &md);
00363 std::ostream& operator<<(std::ostream& o, const X3DTK::SFColor &c);
00365 std::ostream& operator<<(std::ostream& o, const X3DTK::MFColor &mc);
00367 std::ostream& operator<<(std::ostream& o, const X3DTK::SFColorRGBA &c);
00369 std::ostream& operator<<(std::ostream& o, const X3DTK::MFColorRGBA &mc);
00371 std::ostream& operator<<(std::ostream& o, const X3DTK::SFVec2d &v);
00373 std::ostream& operator<<(std::ostream& o, const X3DTK::MFVec2d &mv);
00375 std::ostream& operator<<(std::ostream& o, const X3DTK::SFVec2f &v);
00377 std::ostream& operator<<(std::ostream& o, const X3DTK::MFVec2f &mv);
00379 std::ostream& operator<<(std::ostream& o, const X3DTK::SFVec3d &v);
00381 std::ostream& operator<<(std::ostream& o, const X3DTK::MFVec3d &mv);
00383 std::ostream& operator<<(std::ostream& o, const X3DTK::SFVec3f &v);
00385 std::ostream& operator<<(std::ostream& o, const X3DTK::MFVec3f &mv);
00387 std::ostream& operator<<(std::ostream& o, const X3DTK::SFPoint3f &v);
00389 std::ostream& operator<<(std::ostream& o, const X3DTK::SFRotation &r);
00391 std::ostream& operator<<(std::ostream& o, const X3DTK::MFRotation &mr);
00393 std::ostream& operator<<(std::ostream& o, const SFMatrix34f &M);
00394 
00395 }
00396 
00397 #endif

Generated on Thu Dec 4 13:25:49 2003 for X3DToolKit by doxygen1.2.18