![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 STAPsSkeleton.cpp 00003 ******************************************************************************/ 00007 /****************************************************************************** 00008 SUKITTI PUNAK (0x/0x/2011) 00009 UPDATE (0x/0x/2011) 00010 ******************************************************************************/ 00011 #include "STAPsSkeleton.hpp" 00012 // Using Inclusion Model (i.e. definitions are included in declarations) 00013 // (this name.cpp is included in name.hpp) 00014 // Each friend is defined directly inside its declaration. 00015 00016 BEGIN_NAMESPACE_TAPs 00017 //============================================================================= 00018 // Constructors 00019 //----------------------------------------------------------------------------- 00020 template <typename T> 00021 Skeleton<T>::Skeleton ( T x, T y, T z ) 00022 : m_tX( x ), m_tY( y ), m_tZ( z ) 00023 {} 00024 //----------------------------------------------------------------------------- 00025 template <typename T> 00026 Skeleton<T>::Skeleton ( T a[3] ) 00027 : m_tX( a[0] ), m_tY( a[1] ), m_tZ( a[2] ) 00028 {} 00029 //----------------------------------------------------------------------------- 00030 template <typename T> 00031 Skeleton<T>::Skeleton ( Skeleton<T> const &orig ) 00032 : m_tX( v.m_tX ), m_tY( v.m_tY ), m_tZ( v.m_tZ ) 00033 {} 00034 //----------------------------------------------------------------------------- 00035 template <typename T> 00036 Skeleton<T>::~Skeleton () 00037 {} 00038 //----------------------------------------------------------------------------- 00039 template <typename T> 00040 std::string Skeleton<T>::StrInfo () const 00041 { 00042 std::ostringstream ss; 00043 ss << "Skeleton<" << typeid(T).name() << ">"; 00044 ss << m_tX << ", " << m_tY << ", " << m_tZ; 00045 return ss.str(); 00046 } 00047 //----------------------------------------------------------------------------- 00048 //============================================================================= 00049 // Assignment Operator 00050 //----------------------------------------------------------------------------- 00051 template <typename T> 00052 Skeleton<T> & Skeleton<T>::operator= ( Skeleton<T> const &orig ) 00053 { 00054 m_tX = v.m_tX; 00055 m_tY = v.m_tY; 00056 m_tZ = v.m_tZ; 00057 return *this; 00058 } 00059 //============================================================================= 00060 // Comparison Operators 00061 //----------------------------------------------------------------------------- 00062 template <typename T> 00063 bool Skeleton<T>::operator== ( Skeleton<T> const &v ) const 00064 { return ( m_tX == v.m_tX && m_tY == v.m_tY && m_tZ == v.m_tZ ); } 00065 //----------------------------------------------------------------------------- 00066 template <typename T> 00067 bool Skeleton<T>::operator< ( Skeleton<T> const &v ) const 00068 { 00069 if ( m_tX > v.m_tX ) return false; 00070 if ( m_tY > v.m_tY ) return false; 00071 if ( m_tZ > v.m_tZ ) return false; 00072 if ( m_tX < v.m_tX ) return true; 00073 if ( m_tY < v.m_tY ) return true; 00074 if ( m_tZ < v.m_tZ ) return true; 00075 } 00076 //----------------------------------------------------------------------------- 00077 template <typename T> 00078 bool Skeleton<T>::operator<= ( Skeleton<T> const &v ) const 00079 { 00080 if ( m_tX > v.m_tX ) return false; 00081 if ( m_tY > v.m_tY ) return false; 00082 if ( m_tZ > v.m_tZ ) return false; 00083 return true; 00084 } 00085 //----------------------------------------------------------------------------- 00086 template <typename T> 00087 bool Skeleton<T>::operator> ( Skeleton<T> const &v ) const 00088 { 00089 if ( m_tX < v.m_tX ) return false; 00090 if ( m_tY < v.m_tY ) return false; 00091 if ( m_tZ < v.m_tZ ) return false; 00092 if ( m_tX > v.m_tX ) return true; 00093 if ( m_tY > v.m_tY ) return true; 00094 if ( m_tZ > v.m_tZ ) return true; 00095 } 00096 //----------------------------------------------------------------------------- 00097 template <typename T> 00098 bool Skeleton<T>::operator>= ( Skeleton<T> const &orig ) const 00099 { 00100 if ( m_tX < v.m_tX ) return false; 00101 if ( m_tY < v.m_tY ) return false; 00102 if ( m_tZ < v.m_tZ ) return false; 00103 return true; 00104 } 00105 //----------------------------------------------------------------------------- 00106 template <typename T> 00107 int Skeleton<T>::Dominate ( Skeleton<T> const &a, Skeleton<T> const &b ) 00108 { 00109 if ( a > b ) return 1; 00110 if ( a < b ) return -1; 00111 return 0; 00112 } 00113 //----------------------------------------------------------------------------- 00114 //============================================================================= 00115 00116 00117 //============================================================================= 00118 // OpenGL 00119 #if defined(__gl_h_) || defined(__GL_H__) 00120 template <typename T> 00121 void Skeleton<T>::Draw () const 00122 { 00123 } 00124 //----------------------------------------------------------------------------- 00125 #endif // OpenGL 00126 //============================================================================= 00127 00128 00129 //============================================================================= 00130 END_NAMESPACE_TAPs 00131 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00132 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----