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 
00022 
00023 namespace X3DTK {
00024 
00026 class MFString : public std::vector<SFString>
00027 {
00028 public:
00030   MFString(){};
00032   explicit MFString(const SFString &s);
00033 };
00034 
00036 typedef bool SFBool;
00037 
00039 class MFBool : public std::vector<SFBool>
00040 {
00041 public:
00043   MFBool(){};
00045   explicit MFBool(const SFString &s);
00046 };
00047 
00049 typedef int SFInt32;
00050 
00052 class MFInt32 : public std::vector<SFInt32>
00053 {
00054 public:
00056   MFInt32(){};
00058   explicit MFInt32(size_type n, const SFInt32 &V = SFInt32()); 
00060   explicit MFInt32(const SFString &s);
00061 };
00062 
00064 typedef float SFFloat;
00065 
00067 class MFFloat : public std::vector<SFFloat>
00068 {
00069 public:
00071   MFFloat(){};
00073   explicit MFFloat(size_type n, const SFFloat &V = SFFloat());
00075   explicit MFFloat(const SFString &s);
00076 };
00077 
00079 typedef double SFDouble;
00080 
00082 class MFDouble : public std::vector<SFDouble>
00083 {
00084 public:
00086   MFDouble(){};
00088   explicit MFDouble(const SFString &s);
00089 };
00090 
00092 class SFColorRGBA
00093 {
00094 public:
00096   SFFloat r;
00098   SFFloat g;
00100   SFFloat b;
00102   SFFloat a;
00104   SFColorRGBA(){};
00106   SFColorRGBA(SFFloat r, SFFloat g, SFFloat b, SFFloat a);
00108   explicit SFColorRGBA(const SFString &s);
00109   
00111   friend bool operator== (const SFColorRGBA &r1, const SFColorRGBA &r2);
00113   friend bool operator!= (const SFColorRGBA &r1, const SFColorRGBA &r2);
00114   
00116   static const SFColorRGBA null;
00117 };
00118 
00120 class MFColorRGBA : public std::vector<SFColorRGBA>
00121 {
00122 public:
00124   MFColorRGBA(){};
00126   MFColorRGBA(size_type n, const SFColorRGBA &C = SFColorRGBA());
00128   explicit MFColorRGBA(const SFString &s);
00129 };
00130 
00132 class SFColor
00133 {
00134 public:
00136   SFFloat r;
00138   SFFloat g;
00140   SFFloat b;
00142   SFColor(){};
00144   SFColor(SFFloat r, SFFloat g, SFFloat b);
00146   explicit SFColor(const SFString &s);
00148   operator const SFColorRGBA() const;
00149  
00151   friend bool operator== (const SFColor &r1, const SFColor &r2);
00153   friend bool operator!= (const SFColor &r1, const SFColor &r2);
00155   static const SFColor null;
00156 };
00157 
00158 
00160 class MFColor : public std::vector<SFColor>
00161 {
00162 public:
00164   MFColor(){};
00166   explicit MFColor(const SFString &s);
00167   operator const MFColorRGBA() const;
00168 };
00169 
00170 class X3DAbstractNode;
00172 typedef X3DAbstractNode *SFAbstractNode;
00174 typedef std::list<SFAbstractNode> MFAbstractNode;
00175 
00177 class SFVec2d
00178 {
00179 public:
00180   SFDouble x, y;
00182   SFVec2d();
00184   SFVec2d(SFDouble x, SFDouble y);
00186   explicit SFVec2d(const SFString &s);
00187 };
00188   
00190 class MFVec2d : public std::vector<SFVec2d>
00191 {
00192 public:
00194   MFVec2d(){};
00196   explicit MFVec2d(const SFString &s);
00197 };
00198   
00200 class MFVec2f : public std::vector<SFVec2f>
00201 {
00202 public:
00204   MFVec2f(){};
00206   explicit MFVec2f(size_type n, const SFVec2f &V = SFVec2f());
00208   explicit MFVec2f(const SFString &s);
00209 };
00210 
00212 class SFVec3d
00213 {
00214 public:
00215   SFDouble x, y, z;
00217   SFVec3d();
00219   SFVec3d(SFDouble x, SFDouble y, SFDouble z);
00221   explicit SFVec3d(const SFString &s);    
00222 };
00223 
00225 class MFVec3d : public std::vector<SFVec3d>
00226 {
00227 public:
00229   MFVec3d(){};
00231   explicit MFVec3d(const SFString &s);
00232 };
00233 
00235 class MFVec3f : public std::vector<SFVec3f>
00236 {
00237 public:
00239   MFVec3f(){};
00241   explicit MFVec3f(size_type n, const SFVec3f &V = SFVec3f());
00243   explicit MFVec3f(const SFString &s);
00244 };
00245 
00247 class SFRotation
00248 {
00249 public:
00250   SFFloat x, y, z, angle;
00252   SFRotation(){};
00254   SFRotation(SFFloat x, SFFloat y, SFFloat z, SFFloat angle);
00256   explicit SFRotation(const SFString &s);
00257   
00259   friend bool operator== (const SFRotation &r1, const SFRotation &r2);
00261   friend bool operator!= (const SFRotation &r1, const SFRotation &r2);
00262 };
00263 
00264 
00266 class MFRotation : public std::vector<SFRotation>
00267 {
00268 public:
00270   MFRotation(){};
00272   explicit MFRotation(const SFString &s);
00273 };
00274 
00275 
00276 //constants
00277 static const double PI = 3.14159265358979323846;
00278 static const double radCoef = 180.0/PI;
00279 
00281 inline SFFloat radiansToDegrees(SFFloat alpha)
00282 {
00283   return static_cast<SFFloat>(radCoef*alpha);
00284 }
00285 
00286 #ifndef DOXYGEN
00287 
00288 struct eqSFString
00289 {
00290   inline bool operator()(const SFString &s1, const SFString &s2) const
00291   {
00292     return s1 == s2;
00293   }
00294 };
00295 
00296 struct ltSFString
00297 {
00298   bool operator()(const SFString &s1, const SFString &s2) const
00299   {
00300     return strcmp(s1, s2) < 0;
00301   }
00302 };
00303 
00304 }
00305 
00306 #endif
00307 
00308 namespace X3DTK {
00309 
00310 // other types
00311 class SFType;
00312 class SFComponent;
00313 class SFSceneGraph;
00314 class WalkingFunction;
00315 class VisitingFunctions;
00316 class EnterFunction;
00317 class WalkOnFunction;
00318 class LeaveFunction;
00319 
00320 /*class X3DComponentWalker;
00322 typedef void (X3DComponentWalker::* ptrToWalkingFunction)(SFAbstractNode) const;
00323 
00324 class X3DComponentVisitor;
00326 typedef void (X3DComponentVisitor::* ptrToEnterFunction)(SFAbstractNode) const;
00328 typedef bool (X3DComponentVisitor::* ptrToWalkOnFunction)(SFAbstractNode, SFAbstractNode) const;
00330 typedef void (X3DComponentVisitor::* ptrToLeaveFunction)(SFAbstractNode) const;
00331 */
00332 
00334 typedef std::map<SFString, SFType *, ltSFString> MFType;
00335 
00337 typedef std::map<SFString, SFComponent *, ltSFString> MFComponent;
00339 typedef std::map<SFString, SFSceneGraph *, ltSFString> MFSceneGraph;
00341 typedef std::map<SFString, WalkingFunction *, ltSFString> WalkingDict;
00343 typedef std::map<SFString, EnterFunction *, ltSFString> EnterDict;
00345 typedef std::map<SFString, WalkOnFunction *, ltSFString> WalkOnDict;
00347 typedef std::map<SFString, LeaveFunction *, ltSFString> LeaveDict;
00348 
00350 typedef std::vector<WalkingFunction *> WalkingArray;
00352 typedef std::vector<VisitingFunctions *> VisitingArray;
00353 
00355 std::ostream& operator<<(std::ostream& o, const X3DTK::MFString &ms);
00357 std::ostream& operator<<(std::ostream& o, const X3DTK::MFBool &mb);
00359 std::ostream& operator<<(std::ostream& o, const X3DTK::MFInt32 &mi);
00361 std::ostream& operator<<(std::ostream& o, const X3DTK::MFFloat &mf);
00363 std::ostream& operator<<(std::ostream& o, const X3DTK::MFDouble &md);
00365 std::ostream& operator<<(std::ostream& o, const X3DTK::SFColor &c);
00367 std::ostream& operator<<(std::ostream& o, const X3DTK::MFColor &mc);
00369 std::ostream& operator<<(std::ostream& o, const X3DTK::SFColorRGBA &c);
00371 std::ostream& operator<<(std::ostream& o, const X3DTK::MFColorRGBA &mc);
00373 std::ostream& operator<<(std::ostream& o, const X3DTK::SFVec2d &v);
00375 std::ostream& operator<<(std::ostream& o, const X3DTK::MFVec2d &mv);
00377 std::ostream& operator<<(std::ostream& o, const X3DTK::SFVec2f &v);
00379 std::ostream& operator<<(std::ostream& o, const X3DTK::MFVec2f &mv);
00381 std::ostream& operator<<(std::ostream& o, const X3DTK::SFVec3d &v);
00383 std::ostream& operator<<(std::ostream& o, const X3DTK::MFVec3d &mv);
00385 std::ostream& operator<<(std::ostream& o, const X3DTK::SFVec3f &v);
00387 std::ostream& operator<<(std::ostream& o, const X3DTK::MFVec3f &mv);
00389 std::ostream& operator<<(std::ostream& o, const X3DTK::SFPoint3f &v);
00391 std::ostream& operator<<(std::ostream& o, const X3DTK::SFRotation &r);
00393 std::ostream& operator<<(std::ostream& o, const X3DTK::MFRotation &mr);
00395 std::ostream& operator<<(std::ostream& o, const SFMatrix34f &M);
00396 
00397 }
00398 
00399 #endif

Generated on Mon Jan 19 10:32:08 2004 for X3DToolKit by doxygen1.2.18