XdkWrl: sfvec2f.h Source File

Home | Hierarchy | Members | Alphabetical | Related Pages

# sfvec2f.h

Go to the documentation of this file.

    00001 #ifndef XDKWRL_SFVEC2F_H
    00002 #define XDKWRL_SFVEC2F_H
    00003
    00004 #include <xdkwrl/config.h>
    00005 #include <xdkwrl/fieldtypes.h>
    00006 #include <iostream>
    00007
    00008 namespace wrl
    00009 {
    00010   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    00011   // Interface of  SFVec2f
    00012   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    00013   /*! \ingroup fieldtypes
    00014    *
    00015    * Represents a 2 coordinates (X,Y) vector. Below is included the
    00016    * documentation for this field type from the ISO standard.
    00017    * \htmlinclude sfvec2f.html
    00018    */
    00019   class XDKWRL_EXPORT SFVec2f
    00020   {
    00021   public:
    00022     inline SFVec2f();
    00023     inline SFVec2f(const float* c);
    00024     inline SFVec2f(const float x,const float y);
    00025     inline operator const float*() const;
    00026     inline operator float*();
    00027     inline float x() const;
    00028     inline float y() const;
    00029     inline void setXY(const float x,const float y);
    00030     inline void setX(const float);
    00031     inline void setY(const float);
    00032     static inline const char* typeName();
    00033     static inline FieldTypeId typeId();
    00034     inline bool operator==(const SFVec2f& c) const;
    00035     friend std::ostream& operator<<(std::ostream& s,const SFVec2f& f);
    00036   protected:
    00037   private:
    00038     float x_;
    00039     float y_;
    00040   };
    00041   //************************************************************
    00042   // Implementation of SFVec2f
    00043   //************************************************************
    00044   inline
    00045   SFVec2f::SFVec2f()
    00046     : x_(0.0f),y_(0.0f)
    00047   {
    00048   }
    00049   inline
    00050   SFVec2f::SFVec2f(const float* c)
    00051     : x_(c[0]),y_(c[1])
    00052   {
    00053   }
    00054   inline
    00055   SFVec2f::SFVec2f(const float x,const float y)
    00056     : x_(x),y_(y)
    00057   {
    00058   }
    00059   inline
    00060   SFVec2f::operator const float*() const
    00061   {
    00062     return &x_;
    00063   }
    00064   inline
    00065   SFVec2f::operator float*()
    00066   {
    00067     return &x_;
    00068   }
    00069   inline float
    00070   SFVec2f::x() const
    00071   {
    00072     return x_;
    00073   }
    00074   inline float
    00075   SFVec2f::y() const
    00076   {
    00077     return y_;
    00078   }
    00079   inline void
    00080   SFVec2f::setX(const float x)
    00081   {
    00082     x_ = x;
    00083   }
    00084   inline void
    00085   SFVec2f::setY(const float y)
    00086   {
    00087     y_ = y;
    00088   }
    00089   inline void
    00090   SFVec2f::setXY(const float x,const float y)
    00091   {
    00092     x_ = x;
    00093     y_ = y;
    00094   }
    00095   inline bool
    00096   SFVec2f::operator==(const SFVec2f& c) const
    00097   {
    00098     return x_ == c.x_ && y_ == c.y_;
    00099   }
    00100   inline const char*
    00101   SFVec2f::typeName()
    00102   {
    00103     return "SFVec2f";
    00104   }
    00105   inline FieldTypeId
    00106   SFVec2f::typeId()
    00107   {
    00108     return sfVec2f;
    00109   }
    00110 };
    00111
    00112 #endif // XDKWRL_SFVEC2F_H

Generated on 5 Jan 2007 with version 1.5.1. |