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 #ifndef WM4TTUPLE_H 00018 #define WM4TTUPLE_H 00019 00020 #include "Wm4FoundationLIB.h" 00021 #include "Wm4System.h" 00022 00023 // The class TYPE is either native data or is class data that has the 00024 // following member functions: 00025 // TYPE::TYPE () 00026 // TYPE::TYPE (const TYPE&); 00027 // TYPE& TYPE::operator= (const TYPE&) 00028 00029 namespace Wm4 00030 { 00031 00032 template <int DIMENSION, class TYPE> 00033 class TTuple 00034 { 00035 public: 00036 // Construction and destruction. The default constructor does not 00037 // initialize the tuple elements for native elements. The tuple elements 00038 // are initialized for class data whenever TYPE initializes during its 00039 // default construction. 00040 TTuple (); 00041 TTuple (const TTuple& rkT); 00042 ~TTuple (); 00043 00044 // coordinate access 00045 operator const TYPE* () const; 00046 operator TYPE* (); 00047 TYPE operator[] (int i) const; 00048 TYPE& operator[] (int i); 00049 00050 // assignment 00051 TTuple& operator= (const TTuple& rkT); 00052 00053 // Comparison. The inequalities make the comparisons using memcmp, thus 00054 // treating the tuple as an array of unsigned bytes. 00055 bool operator== (const TTuple& rkT) const; 00056 bool operator!= (const TTuple& rkT) const; 00057 bool operator< (const TTuple& rkT) const; 00058 bool operator<= (const TTuple& rkT) const; 00059 bool operator> (const TTuple& rkT) const; 00060 bool operator>= (const TTuple& rkT) const; 00061 00062 private: 00063 TYPE m_atTuple[DIMENSION]; 00064 }; 00065 00066 } 00067 00068 #include "Wm4TTuple.inl" 00069 00070 #endif