00001 00013 #ifndef Feature_H 00014 #define Feature_H 00015 00020 namespace puma2 { 00021 00037 template <class T> struct Feature { 00038 00042 int x; 00043 00047 int y; 00048 00053 T *val; 00054 inline Feature<T>& operator= (const Feature<T> & f); 00055 00060 inline bool operator== (const Feature<T> & f); 00061 inline bool operator!= (const Feature<T> & f); 00062 inline bool operator< (const Feature<T> & f); 00063 inline bool operator> (const Feature<T> & f); 00064 inline bool operator<= (const Feature<T> & f); 00065 inline bool operator>= (const Feature<T> & f); 00066 }; 00067 00068 template <class T> inline Feature<T>& Feature<T>::operator= ( 00069 const Feature<T> & f) 00070 { 00071 x = f.x; 00072 y = f.y; 00073 *val = *(f.val); 00074 return *this; 00075 } 00076 00077 template <class T> inline bool Feature<T>::operator== (const Feature<T> & f) 00078 { 00079 return (x == f.x) && 00080 (y == f.y) && 00081 (*val == *(f.val)); 00082 } 00083 00084 template <class T> inline bool Feature<T>::operator!= (const Feature<T> & f) 00085 { 00086 return !(*this == f); 00087 } 00088 00089 template <class T> inline bool Feature<T>::operator< (const Feature<T> & f) 00090 { 00091 return (*val < *(f.val)); 00092 } 00093 00094 template <class T> inline bool Feature<T>::operator> (const Feature<T> & f) 00095 { 00096 return (*(f.val) < *val ); 00097 } 00098 00099 template <class T> inline bool Feature<T>::operator<= (const Feature<T> & f) 00100 { 00101 return !(f < *this); 00102 } 00103 00104 template <class T> inline bool Feature<T>::operator>= (const Feature<T> & f) 00105 { 00106 return !(*this < f); 00107 } 00108 00109 } // end of namespace 00110 00111 #endif