Generated vec4

//generated on Mon Oct 31 22:02:37 2016

#ifndef VEC4_H
#define VEC4_H





//============================
// vec4
//============================
template <typename T>
struct vec4
 {
      inline vec4();
      inline explicit vec4(const T &xyzw);
      inline explicit vec4(const T *begin);
      inline vec4(const T &xv, const T &yv, const T &zv, const T &wv);
      inline vec4(const vec4<T> &that);
      inline vec4(const T (&xy)[2], const T (&zw)[2]);
      inline vec4(const T (&xy)[2], const T &z, const T &w);
      inline vec4(const T (&xyz)[3], const T &w);
      inline vec4(const T (&that)[4]);


      inline T &x();
      inline const T &x() const;
      inline void setX(const T &x);
      inline T &y();
      inline const T &y() const;
      inline void setY(const T &y);
      inline T &z();
      inline const T &z() const;
      inline void setZ(const T &z);
      inline T &w();
      inline const T &w() const;
      inline void setW(const T &w);

      inline unsigned int count() const;
      inline T &operator[](unsigned int i);
      inline const T &operator[](unsigned int i) const;

      inline T *begin();
      inline const T *begin() const;
      inline T *end();
      inline const T *end() const;

      inline vec4<T> &operator++();
      inline vec4<T> operator++(int);
      inline vec4<T> &operator--();
      inline vec4<T> operator--(int);


      inline vec4<T> &operator=(const vec4<T> &xyzw);
      inline vec4<T> operator+(const vec4<T> &xyzw) const;
      inline vec4<T> &operator+=(const vec4<T> &xyzw);
      inline vec4<T> operator-(const vec4<T> &xyzw) const;
      inline vec4<T> &operator-=(const vec4<T> &xyzw);
      inline vec4<T> operator*(const vec4<T> &xyzw) const;
      inline vec4<T> &operator*=(const vec4<T> &xyzw);
      inline vec4<T> operator/(const vec4<T> &xyzw) const;
      inline vec4<T> &operator/=(const vec4<T> &xyzw);
      inline vec4<T> operator%(const vec4<T> &xyzw) const;
      inline vec4<T> &operator%=(const vec4<T> &xyzw);
      inline bool operator<(const vec4<T> &xyzw) const;
      inline bool operator<=(const vec4<T> &xyzw) const;
      inline bool operator>(const vec4<T> &xyzw) const;
      inline bool operator>=(const vec4<T> &xyzw) const;
      inline bool operator==(const vec4<T> &xyzw) const;
      inline bool operator!=(const vec4<T> &xyzw) const;
      inline vec4<T> operator<<(const vec4<T> &xyzw) const;
      inline vec4<T> &operator<<=(const vec4<T> &xyzw);
      inline vec4<T> operator>>(const vec4<T> &xyzw) const;
      inline vec4<T> &operator>>=(const vec4<T> &xyzw);
      inline vec4<T> operator|(const vec4<T> &xyzw) const;
      inline vec4<T> &operator|=(const vec4<T> &xyzw);
      inline vec4<T> operator^(const vec4<T> &xyzw) const;
      inline vec4<T> &operator^=(const vec4<T> &xyzw);
      inline vec4<T> operator&(const vec4<T> &xyzw) const;
      inline vec4<T> operator&=(const vec4<T> &xyzw) const;
      inline bool operator||(const vec4<T> &xyzw) const;


      inline vec4<T> operator*(const T &xyzw) const;
      inline vec4<T> &operator*=(const T &xyzw);
      inline vec4<T> operator/(const T &xyzw) const;
      inline vec4<T> &operator/=(const T &xyzw);
      inline vec4<T> operator%(const T &xyzw) const;
      inline vec4<T> &operator%=(const T &xyzw);

      inline vec4<T> operator-() const;
      inline vec4<T> operator+() const;
      inline bool operator!() const;


      inline T (&xy)[2]();
      inline const T (&xy)[2]() const;
      inline void setXY(const T (&them)[2]);
      inline T (&xyz)[3]();
      inline const T (&xyz)[3]() const;
      inline void setXYZ(const T (&them)[3]);
      inline T (&xyzw)[4]();
      inline const T (&xyzw)[4]() const;
      inline void setXYZW(const T (&them)[4]);
      inline T (&array)[4]();
      inline const T (&array)[4]() const;
      inline operator T (&)[4]();
      inline operator const T (&)[4]() const;

      template <typename T1>
      inline vec4<T1> to();


   private:
      T xv;
      T yv;
      T zv;
      T wv;
 };


















template <typename T>
T &vec4<T>::x()
   { return xv; }

template <typename T>
const T &vec4<T>::x() const
   { return xv; }

template <typename T>
void vec4<T>::setX(const T &x)
   { xv=x; }

template <typename T>
T &vec4<T>::y()
   { return yv; }

template <typename T>
const T &vec4<T>::y() const
   { return yv; }

template <typename T>
void vec4<T>::setY(const T &y)
   { yv=y; }

template <typename T>
T &vec4<T>::z()
   { return zv; }

template <typename T>
const T &vec4<T>::z() const
   { return zv; }

template <typename T>
void vec4<T>::setZ(const T &z)
   { zv=z; }

template <typename T>
T &vec4<T>::w()
   { return wv; }

template <typename T>
const T &vec4<T>::w() const
   { return wv; }

template <typename T>
void vec4<T>::setW(const T &w)
   { wv=w; }

template <typename T>
vec4<T>::vec4()
 :xv(0),
  yv(0),
  zv(0),
  wv(0)
   {
   }


template <typename T>
vec4<T>::vec4(const T &xyzw)
 :xv(xyzw),
  yv(xyzw),
  zv(xyzw),
  wv(xyzw)
   {
   }


template <typename T>
vec4<T>::vec4(const T *begin)
 :xv(begin[0]),
  yv(begin[1]),
  zv(begin[2]),
  wv(begin[3])
   {
   }


template <typename T>
vec4<T>::vec4(const T &xv, const T &yv, const T &zv, const T &wv)
 :xv(xv),
  yv(yv),
  zv(zv),
  wv(wv)
   {
   }


template <typename T>
vec4<T>::vec4(const vec4<T> &that)
 :xv(that.xv),
  yv(that.yv),
  zv(that.zv),
  wv(that.wv)
   {
   }


template <typename T>
vec4<T>::vec4(const T (&xy)[2], const T (&zw)[2])
 :xv(xy[0]),
  yv(xy[1]),
  zv(zw[0]),
  wv(zw[1])
   {
   }

template <typename T>
T *vec4<T>::begin()
   { return &xv; }

template <typename T>
const T *vec4<T>::begin() const
   { return &xv; }

template <typename T>
unsigned int vec4<T>::count() const
   { return 4; }

template <typename T>
T *vec4<T>::end()
   { return begin()+count(); }

template <typename T>
const T *vec4<T>::end() const
   { return begin()+count(); }

template <typename T>
T &vec4<T>::operator[](unsigned int i)
   {
      J_ASSERT(i<count(), "Index out of range!");
      return *(begin()+i);
   }

template <typename T>
const T &vec4<T>::operator[](unsigned int i) const
   {
      J_ASSERT(i<count(), "Index out of range!");
      return *(begin()+i);
   }

template <typename T>
vec4<T> &vec4<T>::operator++()
   {
      ++xv;
      ++yv;
      ++zv;
      ++wv;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator++(int)
   { return vec4<T>(xv++, yv++, zv++, wv++); }

template <typename T>
vec4<T> &vec4<T>::operator--()
   {
      --xv;
      --yv;
      --zv;
      --wv;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator--(int)
   { return vec4<T>(xv--, yv--, zv--, wv--); }

template <typename T>
vec4<T> &vec4<T>::operator=(const vec4<T> &xyzw)
   {
      xv=xyzw.xv;
      yv=xyzw.yv;
      zv=xyzw.zv;
      wv=xyzw.wv;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator+(const vec4<T> &xyzw) const
   { return vec4<T>(xv+xyzw.xv, yv+xyzw.yv, zv+xyzw.zv, wv+xyzw.wv); }

template <typename T>
vec4<T> &vec4<T>::operator+=(const vec4<T> &xyzw)
   {
      xv+=xyzw.xv;
      yv+=xyzw.yv;
      zv+=xyzw.zv;
      wv+=xyzw.wv;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator-(const vec4<T> &xyzw) const
   { return vec4<T>(xv-xyzw.xv, yv-xyzw.yv, zv-xyzw.zv, wv-xyzw.wv); }

template <typename T>
vec4<T> &vec4<T>::operator-=(const vec4<T> &xyzw)
   {
      xv-=xyzw.xv;
      yv-=xyzw.yv;
      zv-=xyzw.zv;
      wv-=xyzw.wv;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator*(const vec4<T> &xyzw) const
   { return vec4<T>(xv*xyzw.xv, yv*xyzw.yv, zv*xyzw.zv, wv*xyzw.wv); }

template <typename T>
vec4<T> &vec4<T>::operator*=(const vec4<T> &xyzw)
   {
      xv*=xyzw.xv;
      yv*=xyzw.yv;
      zv*=xyzw.zv;
      wv*=xyzw.wv;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator/(const vec4<T> &xyzw) const
   { return vec4<T>(xv/xyzw.xv, yv/xyzw.yv, zv/xyzw.zv, wv/xyzw.wv); }

template <typename T>
vec4<T> &vec4<T>::operator/=(const vec4<T> &xyzw)
   {
      xv/=xyzw.xv;
      yv/=xyzw.yv;
      zv/=xyzw.zv;
      wv/=xyzw.wv;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator%(const vec4<T> &xyzw) const
   { return vec4<T>(xv%xyzw.xv, yv%xyzw.yv, zv%xyzw.zv, wv%xyzw.wv); }

template <typename T>
vec4<T> &vec4<T>::operator%=(const vec4<T> &xyzw)
   {
      xv%=xyzw.xv;
      yv%=xyzw.yv;
      zv%=xyzw.zv;
      wv%=xyzw.wv;
      return *this;
   }

template <typename T>
bool vec4<T>::operator<(const vec4<T> &xyzw) const
   { return (xv<xyzw.xv) && (yv<xyzw.yv) && (zv<xyzw.zv) && (wv<xyzw.wv); }

template <typename T>
bool vec4<T>::operator<=(const vec4<T> &xyzw) const
   { return (xv<=xyzw.xv) && (yv<=xyzw.yv) && (zv<=xyzw.zv) && (wv<=xyzw.wv); }

template <typename T>
bool vec4<T>::operator>(const vec4<T> &xyzw) const
   { return (xv>xyzw.xv) && (yv>xyzw.yv) && (zv>xyzw.zv) && (wv>xyzw.wv); }

template <typename T>
bool vec4<T>::operator>=(const vec4<T> &xyzw) const
   { return (xv>=xyzw.xv) && (yv>=xyzw.yv) && (zv>=xyzw.zv) && (wv>=xyzw.wv); }

template <typename T>
bool vec4<T>::operator==(const vec4<T> &xyzw) const
   { return (xv==xyzw.xv) && (yv==xyzw.yv) && (zv==xyzw.zv) && (wv==xyzw.wv); }

template <typename T>
bool vec4<T>::operator!=(const vec4<T> &xyzw) const
   { return (xv!=xyzw.xv) || (yv!=xyzw.yv) || (zv!=xyzw.zv) || (wv!=xyzw.wv); }

template <typename T>
vec4<T> vec4<T>::operator<<(const vec4<T> &xyzw) const
   { return vec4<T>(xv<<xyzw.xv, yv<<xyzw.yv, zv<<xyzw.zv, wv<<xyzw.wv); }

template <typename T>
vec4<T> &vec4<T>::operator<<=(const vec4<T> &xyzw)
   {
      xv<<=xyzw.xv;
      yv<<=xyzw.yv;
      zv<<=xyzw.zv;
      wv<<=xyzw.wv;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator>>(const vec4<T> &xyzw) const
   { return vec4<T>(xv>>xyzw.xv, yv>>xyzw.yv, zv>>xyzw.zv, wv>>xyzw.wv); }

template <typename T>
vec4<T> &vec4<T>::operator>>=(const vec4<T> &xyzw)
   {
      xv>>=xyzw.xv;
      yv>>=xyzw.yv;
      zv>>=xyzw.zv;
      wv>>=xyzw.wv;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator|(const vec4<T> &xyzw) const
   { return vec4<T>(xv|xyzw.xv, yv|xyzw.yv, zv|xyzw.zv, wv|xyzw.wv); }

template <typename T>
vec4<T> &vec4<T>::operator|=(const vec4<T> &xyzw)
   {
      xv|=xyzw.xv;
      yv|=xyzw.yv;
      zv|=xyzw.zv;
      wv|=xyzw.wv;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator^(const vec4<T> &xyzw) const
   { return vec4<T>(xv^xyzw.xv, yv^xyzw.yv, zv^xyzw.zv, wv^xyzw.wv); }

template <typename T>
vec4<T> &vec4<T>::operator^=(const vec4<T> &xyzw)
   {
      xv^=xyzw.xv;
      yv^=xyzw.yv;
      zv^=xyzw.zv;
      wv^=xyzw.wv;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator&(const vec4<T> &xyzw) const
   { return vec4<T>(xv&xyzw.xv, yv&xyzw.yv, zv&xyzw.zv, wv&xyzw.wv); }

template <typename T>
vec4<T> vec4<T>::operator&=(const vec4<T> &xyzw) const
   { return vec4<T>(xv&=xyzw.xv, yv&=xyzw.yv, zv&=xyzw.zv, wv&=xyzw.wv); }

template <typename T>
bool vec4<T>::operator||(const vec4<T> &xyzw) const
   { return (xv||xyzw.xv) || (yv||xyzw.yv) || (zv||xyzw.zv) || (wv||xyzw.wv); }

template <typename T>
vec4<T> vec4<T>::operator*(const T &xyzw) const
   { return vec4<T>(xv*xyzw, yv*xyzw, zv*xyzw, wv*xyzw); }

template <typename T>
vec4<T> &vec4<T>::operator*=(const T &xyzw)
   {
      xv*=xyzw;
      yv*=xyzw;
      zv*=xyzw;
      wv*=xyzw;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator/(const T &xyzw) const
   { return vec4<T>(xv/xyzw, yv/xyzw, zv/xyzw, wv/xyzw); }

template <typename T>
vec4<T> &vec4<T>::operator/=(const T &xyzw)
   {
      xv/=xyzw;
      yv/=xyzw;
      zv/=xyzw;
      wv/=xyzw;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator%(const T &xyzw) const
   { return vec4<T>(xv%xyzw, yv%xyzw, zv%xyzw, wv%xyzw); }

template <typename T>
vec4<T> &vec4<T>::operator%=(const T &xyzw)
   {
      xv%=xyzw;
      yv%=xyzw;
      zv%=xyzw;
      wv%=xyzw;
      return *this;
   }

template <typename T>
vec4<T> vec4<T>::operator-() const
   { return vec4<T>(-xv, -yv, -zv, -wv); }

template <typename T>
vec4<T> vec4<T>::operator+() const
   { return vec4<T>(+xv, +yv, +zv, +wv); }

template <typename T>
bool vec4<T>::operator!() const
   { return (!xv) && (!yv) && (!zv) && (!wv); }

template <typename T>
T (&vec4<T>::xy)[2]()
   { return *reinterpret_cast<T (*)[2]>(begin()); }

template <typename T>
const T (&vec4<T>::xy)[2]() const
   { return *reinterpret_cast<const T (*)[2]>(begin()); }

template <typename T>
void vec4<T>::setXY(const T (&them)[2])
   { memcpy(xy(), them, sizeof(T[2])); }

template <typename T>
vec4<T>::vec4(const T (&xy)[2], const T &z, const T &w)
 :vec4(xy[0], xy[1], z, w)
   {
   }

template <typename T>
T (&vec4<T>::xyz)[3]()
   { return *reinterpret_cast<T (*)[3]>(begin()); }

template <typename T>
const T (&vec4<T>::xyz)[3]() const
   { return *reinterpret_cast<const T (*)[3]>(begin()); }

template <typename T>
void vec4<T>::setXYZ(const T (&them)[3])
   { memcpy(xyz(), them, sizeof(T[3])); }

template <typename T>
vec4<T>::vec4(const T (&xyz)[3], const T &w)
 :vec4(xyz[0], xyz[1], xyz[2], w)
   {
   }

template <typename T>
T (&vec4<T>::xyzw)[4]()
   { return *reinterpret_cast<T (*)[4]>(begin()); }

template <typename T>
const T (&vec4<T>::xyzw)[4]() const
   { return *reinterpret_cast<const T (*)[4]>(begin()); }

template <typename T>
void vec4<T>::setXYZW(const T (&them)[4])
   { memcpy(xyzw(), them, sizeof(T[4])); }

template <typename T>
T (&vec4<T>::array)[4]()
   { return *reinterpret_cast<T (*)[4]>(begin()); }

template <typename T>
const T (&vec4<T>::array)[4]() const
   { return *reinterpret_cast<const T (*)[4]>(begin()); }

template <typename T>
vec4<T>::operator T (&)[4]()
   { return array(); }

template <typename T>
vec4<T>::operator const T (&)[4]() const
   { return array(); }

template <typename T, typename T1>
vec4<T1> vec4<T>::to()
   { return vec4<T1>(static_cast<T1>(xv), static_cast<T1>(yv), static_cast<T1>(zv), static_cast<T1>(wv)); }

template <typename T>
vec4<T>::vec4(const T (&that)[4])
 :xv(that[0]),
  yv(that[1]),
  zv(that[2]),
  wv(that[3])
   {
   }

#endif  // VEC4_H

//this header was generated in 7 milliseconds

No comments:

Post a Comment

Pages