vtf-logo

composite_compare.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00008 #if !defined(__ads_composite_compare_h__)
00009 #define __ads_composite_compare_h__
00010 
00011 // If we are debugging the whole ads package.
00012 #if defined(DEBUG_ads) && !defined(DEBUG_composite_compare)
00013 #define DEBUG_composite_compare
00014 #endif
00015 
00016 #include "../array/FixedArray.h"
00017 
00018 #include <functional>
00019 
00020 BEGIN_NAMESPACE_ADS
00021   
00022 //-----------------------------------------------------------------------------
00024 // @{
00025 
00026 //
00027 // Comparisons for N-D numbers.
00028 //
00029 
00031 template <int N, typename PointType>
00032 bool 
00033 less_composite_fcn( const int n, const PointType& a,  const PointType& b );
00034 /* Defined in the .ipp file. */
00035 
00036 
00038 /* CONTINUE
00039 template <int N, typename T>
00040 bool 
00041 less_composite_fcn( int i, const FixedArray<N,T>* a, 
00042                     const FixedArray<N,T>* b );
00043 */
00044 
00046 template <int N, typename PointType>
00047 class less_composite :
00048   public std::binary_function<PointType, PointType, bool>
00049 {
00050 private:
00051 
00052   int _n;
00053 
00054 public:
00055 
00057   less_composite() :
00058     _n( -1 )
00059   {}
00060 
00062   void
00063   set( const int n )
00064   {
00065     _n = n;
00066   }
00067 
00069   bool 
00070   operator()( const PointType& a, const PointType& b ) const
00071   {
00072     return less_composite_fcn<N>( _n, a, b );
00073   }
00074 };
00075 
00076 /* CONTINUE: I don't know if I need this.
00077 template <class PointType>
00078 class less_composite<PointType*> :
00079   public std::binary_function<const PointType*, const PointType*, bool>
00080 {
00081 private:
00082 
00083   int _n;
00084 
00085 public:
00086 
00087   void
00088   set( int n )
00089   {
00090     _n = n;
00091   }
00092 
00093   bool 
00094   operator()( const PointType* a, const PointType* b ) 
00095   {
00096     return less_composite_fcn( _n, *a, *b );
00097   }
00098 };
00099 */
00100 
00101 //
00102 // Comparisons for 3-D numbers.
00103 //
00104 
00106 template <typename Pt3D>
00107 bool 
00108 xless_composite_compare( const Pt3D& a, const Pt3D& b );
00109 
00111 template <typename Pt3D>
00112 bool 
00113 yless_composite_compare( const Pt3D& a, const Pt3D& b );
00114 
00116 template <typename Pt3D>
00117 bool 
00118 zless_composite_compare( const Pt3D& a, const Pt3D& b );
00119 
00121 template <typename Pt3D>
00122 bool 
00123 less_composite_compare( int i, const Pt3D& a, const Pt3D& b );
00124 
00126 template <class PointType>
00127 struct xless_composite :
00128   public std::binary_function<PointType, PointType, bool>
00129 {
00131   bool 
00132   operator()( const PointType& a, const PointType& b ) {
00133     return xless_composite_compare( a, b );
00134   }
00135 };
00136 
00138 template <class PointType>
00139 struct yless_composite :
00140   public std::binary_function<PointType, PointType, bool>
00141 {
00143   bool 
00144   operator()( const PointType& a, const PointType& b ) {
00145     return yless_composite_compare( a, b );
00146   }
00147 };
00148 
00150 template <class PointType>
00151 struct zless_composite :
00152   public std::binary_function<PointType, PointType, bool>
00153 {
00155   bool 
00156   operator()( const PointType& a, const PointType& b ) {
00157     return zless_composite_compare( a, b );
00158   }
00159 };
00160 
00161 
00162 
00163 // CONTINUE
00164 //--------------------------------------------------------------------------
00165 #if 0
00167 template <typename T>
00168 bool 
00169 xless_composite_compare( const FixedArray<3,T>& a, 
00170                          const FixedArray<3,T>& b );
00171 
00173 template <typename T>
00174 bool 
00175 yless_composite_compare( const FixedArray<3,T>& a, 
00176                          const FixedArray<3,T>& b );
00177 
00179 template <typename T>
00180 bool 
00181 zless_composite_compare( const FixedArray<3,T>& a, 
00182                          const FixedArray<3,T>& b );
00183 
00184 
00186 template <typename T>
00187 bool 
00188 xless_composite_compare( const FixedArray<3,T>* a, 
00189                          const FixedArray<3,T>* b );
00190 
00192 template <typename T>
00193 bool 
00194 yless_composite_compare( const FixedArray<3,T>* a, 
00195                          const FixedArray<3,T>* b );
00196 
00198 template <typename T>
00199 bool 
00200 zless_composite_compare( const FixedArray<3,T>* a, 
00201                          const FixedArray<3,T>* b );
00202   
00204 template <typename T>
00205 bool 
00206 less_composite_compare( int i, const FixedArray<3,T>& a, 
00207                         const FixedArray<3,T>& b );
00208 
00210 template <typename T>
00211 bool 
00212 less_composite_compare( int i, const FixedArray<3,T>* a, 
00213                         const FixedArray<3,T>* b );
00214 
00215 
00216 template <class PointType>
00217 struct xless_composite :
00218   public std::binary_function<PointType, PointType, bool>
00219 {
00220   bool operator()( const PointType& a, const PointType& b ) {
00221     return xless_composite_compare( a, b );
00222   }
00223 };
00224 
00225 template <class PointType>
00226 struct xless_composite<PointType*> :
00227   public std::binary_function<const PointType*, 
00228                               const PointType*, bool>
00229 {
00230   bool operator()( const PointType* a, const PointType* b ) {
00231     return xless_composite_compare( a, b );
00232   }
00233 };
00234 
00235 
00236 template <class PointType>
00237 struct yless_composite :
00238   public std::binary_function<PointType, PointType, bool>
00239 {
00240   bool operator()( const PointType& a, const PointType& b ) {
00241     return yless_composite_compare( a, b );
00242   }
00243 };
00244 
00245 template <class PointType>
00246 struct yless_composite<PointType*> :
00247   public std::binary_function<const PointType*, const PointType*, bool>
00248 {
00249   bool operator()( const PointType* a, const PointType* b ) {
00250     return yless_composite_compare( a, b );
00251   }
00252 };
00253 
00254 
00255 template <class PointType>
00256 struct zless_composite :
00257   public std::binary_function<PointType, PointType, bool>
00258 {
00259   bool operator()( const PointType& a, const PointType& b ) {
00260     return zless_composite_compare( a, b );
00261   }
00262 };
00263 
00264   
00265 template <class PointType>
00266 struct zless_composite<PointType*> :
00267   public std::binary_function<const PointType*, 
00268                               const PointType*, bool>
00269 {
00270   bool operator()( const PointType* a, const PointType* b ) {
00271     return zless_composite_compare( a, b );
00272   }
00273 };
00274 //--------------------------------------------------------------------------
00275 #endif
00276 
00277 // @}
00278 
00279 END_NAMESPACE_ADS
00280 
00281 #define __ads_composite_compare_ipp__
00282 #include "composite_compare.ipp"
00283 #undef __ads_composite_compare_ipp__
00284 
00285 #endif

Generated on Fri Aug 24 12:55:23 2007 for Algorithms and Data Structures Package by  doxygen 1.4.7