Wm4TTuple.inl

Go to the documentation of this file.
00001 // Wild Magic Source Code
00002 // David Eberly
00003 // http://www.geometrictools.com
00004 // Copyright (c) 1998-2007
00005 //
00006 // This library is free software; you can redistribute it and/or modify it
00007 // under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation; either version 2.1 of the License, or (at
00009 // your option) any later version.  The license is available for reading at
00010 // either of the locations:
00011 //     http://www.gnu.org/copyleft/lgpl.html
00012 //     http://www.geometrictools.com/License/WildMagicLicense.pdf
00013 // The license applies to versions 0 through 4 of Wild Magic.
00014 //
00015 // Version: 4.0.0 (2006/06/28)
00016 
00017 namespace Wm4
00018 {
00019 //----------------------------------------------------------------------------
00020 template <int DIMENSION, class TYPE>
00021 TTuple<DIMENSION,TYPE>::TTuple ()
00022 {
00023     // Uninitialized for native data.  Initialized for class data as long as
00024     // TYPE's default constructor initializes its own data.
00025 }
00026 //----------------------------------------------------------------------------
00027 template <int DIMENSION, class TYPE>
00028 TTuple<DIMENSION,TYPE>::~TTuple ()
00029 {
00030 }
00031 //----------------------------------------------------------------------------
00032 template <int DIMENSION, class TYPE>
00033 TTuple<DIMENSION,TYPE>::TTuple (const TTuple& rkT)
00034 {
00035     for (int i = 0; i < DIMENSION; i++)
00036     {
00037         m_atTuple[i] = rkT.m_atTuple[i];
00038     }
00039 }
00040 //----------------------------------------------------------------------------
00041 template <int DIMENSION, class TYPE>
00042 TTuple<DIMENSION,TYPE>::operator const TYPE* () const
00043 {
00044     return m_atTuple;
00045 }
00046 //----------------------------------------------------------------------------
00047 template <int DIMENSION, class TYPE>
00048 TTuple<DIMENSION,TYPE>::operator TYPE* ()
00049 {
00050     return m_atTuple;
00051 }
00052 //----------------------------------------------------------------------------
00053 template <int DIMENSION, class TYPE>
00054 TYPE TTuple<DIMENSION,TYPE>::operator[] (int i) const
00055 {
00056     assert(0 <= i && i < DIMENSION);
00057     return m_atTuple[i];
00058 }
00059 //----------------------------------------------------------------------------
00060 template <int DIMENSION, class TYPE>
00061 TYPE& TTuple<DIMENSION,TYPE>::operator[] (int i)
00062 {
00063     assert(0 <= i && i < DIMENSION);
00064     return m_atTuple[i];
00065 }
00066 //----------------------------------------------------------------------------
00067 template <int DIMENSION, class TYPE>
00068 TTuple<DIMENSION,TYPE>& TTuple<DIMENSION,TYPE>::operator= (const TTuple& rkT)
00069 {
00070     for (int i = 0; i < DIMENSION; i++)
00071     {
00072         m_atTuple[i] = rkT.m_atTuple[i];
00073     }
00074     return *this;
00075 }
00076 //----------------------------------------------------------------------------
00077 template <int DIMENSION, class TYPE>
00078 bool TTuple<DIMENSION,TYPE>::operator== (const TTuple& rkT) const
00079 {
00080     const size_t uiSize = DIMENSION*sizeof(TYPE);
00081     return memcmp(m_atTuple,rkT.m_atTuple,uiSize) == 0;
00082 }
00083 //----------------------------------------------------------------------------
00084 template <int DIMENSION, class TYPE>
00085 bool TTuple<DIMENSION,TYPE>::operator!= (const TTuple& rkT) const
00086 {
00087     const size_t uiSize = DIMENSION*sizeof(TYPE);
00088     return memcmp(m_atTuple,rkT.m_atTuple,uiSize) != 0;
00089 }
00090 //----------------------------------------------------------------------------
00091 template <int DIMENSION, class TYPE>
00092 bool TTuple<DIMENSION,TYPE>::operator< (const TTuple& rkT) const
00093 {
00094     const size_t uiSize = DIMENSION*sizeof(TYPE);
00095     return memcmp(m_atTuple,rkT.m_atTuple,uiSize) < 0;
00096 }
00097 //----------------------------------------------------------------------------
00098 template <int DIMENSION, class TYPE>
00099 bool TTuple<DIMENSION,TYPE>::operator<= (const TTuple& rkT) const
00100 {
00101     const size_t uiSize = DIMENSION*sizeof(TYPE);
00102     return memcmp(m_atTuple,rkT.m_atTuple,uiSize) <= 0;
00103 }
00104 //----------------------------------------------------------------------------
00105 template <int DIMENSION, class TYPE>
00106 bool TTuple<DIMENSION,TYPE>::operator> (const TTuple& rkT) const
00107 {
00108     const size_t uiSize = DIMENSION*sizeof(TYPE);
00109     return memcmp(m_atTuple,rkT.m_atTuple,uiSize) > 0;
00110 }
00111 //----------------------------------------------------------------------------
00112 template <int DIMENSION, class TYPE>
00113 bool TTuple<DIMENSION,TYPE>::operator>= (const TTuple& rkT) const
00114 {
00115     const size_t uiSize = DIMENSION*sizeof(TYPE);
00116     return memcmp(m_atTuple,rkT.m_atTuple,uiSize) >= 0;
00117 }
00118 //----------------------------------------------------------------------------
00119 } //namespace Wm4

Generated on Wed Nov 23 19:01:10 2011 for FreeCAD by  doxygen 1.6.1