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