00001
00002
00008 #if !defined(__ads_compare_handle_h__)
00009 #define __ads_compare_handle_h__
00010
00011 #include "../defs.h"
00012
00013 #include <functional>
00014
00015 BEGIN_NAMESPACE_ADS
00016
00017
00019
00020
00022 template<typename Handle>
00023 struct EqualToByHandle :
00024 public std::binary_function<Handle,Handle,bool> {
00025 private:
00026 typedef std::binary_function<Handle,Handle,bool> Base;
00027 public:
00029 typedef typename Base::result_type result_type;
00031 typedef typename Base::first_argument_type first_argument_type;
00033 typedef typename Base::second_argument_type second_argument_type;
00034
00036 result_type
00037 operator()(const first_argument_type x, const second_argument_type y) const {
00038 return *x == *y;
00039 }
00040 };
00041
00043
00048 template<typename Handle>
00049 inline
00050 EqualToByHandle<Handle>
00051 constructEqualToByHandle() {
00052 return EqualToByHandle<Handle>();
00053 }
00054
00055
00057 template<typename Handle>
00058 struct NotEqualToByHandle :
00059 public std::binary_function<Handle,Handle,bool> {
00060 private:
00061 typedef std::binary_function<Handle,Handle,bool> Base;
00062 public:
00064 typedef typename Base::result_type result_type;
00066 typedef typename Base::first_argument_type first_argument_type;
00068 typedef typename Base::second_argument_type second_argument_type;
00069
00071 result_type
00072 operator()(const first_argument_type x, const second_argument_type y) const {
00073 return *x != *y;
00074 }
00075 };
00076
00078
00083 template<typename Handle>
00084 inline
00085 NotEqualToByHandle<Handle>
00086 constructNotEqualToByHandle() {
00087 return NotEqualToByHandle<Handle>();
00088 }
00089
00090
00092 template<typename Handle>
00093 struct GreaterByHandle :
00094 public std::binary_function<Handle,Handle,bool> {
00095 private:
00096 typedef std::binary_function<Handle,Handle,bool> Base;
00097 public:
00099 typedef typename Base::result_type result_type;
00101 typedef typename Base::first_argument_type first_argument_type;
00103 typedef typename Base::second_argument_type second_argument_type;
00104
00106 result_type
00107 operator()(const first_argument_type x, const second_argument_type y) const {
00108 return *x > *y;
00109 }
00110 };
00111
00113
00118 template<typename Handle>
00119 inline
00120 GreaterByHandle<Handle>
00121 constructGreaterByHandle() {
00122 return GreaterByHandle<Handle>();
00123 }
00124
00125
00127 template<typename Handle>
00128 struct LessByHandle :
00129 public std::binary_function<Handle,Handle,bool> {
00130 private:
00131 typedef std::binary_function<Handle,Handle,bool> Base;
00132 public:
00134 typedef typename Base::result_type result_type;
00136 typedef typename Base::first_argument_type first_argument_type;
00138 typedef typename Base::second_argument_type second_argument_type;
00139
00141 result_type
00142 operator()(const first_argument_type x, const second_argument_type y) const {
00143 return *x < *y;
00144 }
00145 };
00146
00148
00153 template<typename Handle>
00154 inline
00155 LessByHandle<Handle>
00156 constructLessByHandle() {
00157 return LessByHandle<Handle>();
00158 }
00159
00160
00162 template<typename Handle>
00163 struct GreaterEqualByHandle :
00164 public std::binary_function<Handle,Handle,bool> {
00165 private:
00166 typedef std::binary_function<Handle,Handle,bool> Base;
00167 public:
00169 typedef typename Base::result_type result_type;
00171 typedef typename Base::first_argument_type first_argument_type;
00173 typedef typename Base::second_argument_type second_argument_type;
00174
00176 result_type
00177 operator()(const first_argument_type x, const second_argument_type y) const {
00178 return *x >= *y;
00179 }
00180 };
00181
00183
00188 template<typename Handle>
00189 inline
00190 GreaterEqualByHandle<Handle>
00191 constructGreaterEqualByHandle() {
00192 return GreaterEqualByHandle<Handle>();
00193 }
00194
00195
00197 template<typename Handle>
00198 struct LessEqualByHandle :
00199 public std::binary_function<Handle,Handle,bool> {
00200 private:
00201 typedef std::binary_function<Handle,Handle,bool> Base;
00202 public:
00204 typedef typename Base::result_type result_type;
00206 typedef typename Base::first_argument_type first_argument_type;
00208 typedef typename Base::second_argument_type second_argument_type;
00209
00211 result_type
00212 operator()(const first_argument_type x, const second_argument_type y) const {
00213 return *x <= *y;
00214 }
00215 };
00216
00218
00223 template<typename Handle>
00224 inline
00225 LessEqualByHandle<Handle>
00226 constructLessEqualByHandle() {
00227 return LessEqualByHandle<Handle>();
00228 }
00229
00230
00231
00232
00233
00234
00235
00237 template<typename Handle>
00238 struct EqualToByHandleHandle :
00239 public std::binary_function<Handle,Handle,bool> {
00240 private:
00241 typedef std::binary_function<Handle,Handle,bool> Base;
00242 public:
00244 typedef typename Base::result_type result_type;
00246 typedef typename Base::first_argument_type first_argument_type;
00248 typedef typename Base::second_argument_type second_argument_type;
00249
00251 result_type
00252 operator()(const first_argument_type x, const second_argument_type y) const {
00253 return **x == **y;
00254 }
00255 };
00256
00258
00263 template<typename Handle>
00264 inline
00265 EqualToByHandleHandle<Handle>
00266 constructEqualToByHandleHandle() {
00267 return EqualToByHandleHandle<Handle>();
00268 }
00269
00270
00272 template<typename Handle>
00273 struct NotEqualToByHandleHandle :
00274 public std::binary_function<Handle,Handle,bool> {
00275 private:
00276 typedef std::binary_function<Handle,Handle,bool> Base;
00277 public:
00279 typedef typename Base::result_type result_type;
00281 typedef typename Base::first_argument_type first_argument_type;
00283 typedef typename Base::second_argument_type second_argument_type;
00284
00286 result_type
00287 operator()(const first_argument_type x, const second_argument_type y) const {
00288 return **x != **y;
00289 }
00290 };
00291
00293
00298 template<typename Handle>
00299 inline
00300 NotEqualToByHandleHandle<Handle>
00301 constructNotEqualToByHandleHandle() {
00302 return NotEqualToByHandleHandle<Handle>();
00303 }
00304
00305
00307 template<typename Handle>
00308 struct GreaterByHandleHandle :
00309 public std::binary_function<Handle,Handle,bool> {
00310 private:
00311 typedef std::binary_function<Handle,Handle,bool> Base;
00312 public:
00314 typedef typename Base::result_type result_type;
00316 typedef typename Base::first_argument_type first_argument_type;
00318 typedef typename Base::second_argument_type second_argument_type;
00319
00321 result_type
00322 operator()(const first_argument_type x, const second_argument_type y) const {
00323 return **x > **y;
00324 }
00325 };
00326
00328
00333 template<typename Handle>
00334 inline
00335 GreaterByHandleHandle<Handle>
00336 constructGreaterByHandleHandle() {
00337 return GreaterByHandleHandle<Handle>();
00338 }
00339
00340
00342 template<typename Handle>
00343 struct LessByHandleHandle :
00344 public std::binary_function<Handle,Handle,bool> {
00345 private:
00346 typedef std::binary_function<Handle,Handle,bool> Base;
00347 public:
00349 typedef typename Base::result_type result_type;
00351 typedef typename Base::first_argument_type first_argument_type;
00353 typedef typename Base::second_argument_type second_argument_type;
00354
00356 result_type
00357 operator()(const first_argument_type x, const second_argument_type y) const {
00358 return **x < **y;
00359 }
00360 };
00361
00363
00368 template<typename Handle>
00369 inline
00370 LessByHandleHandle<Handle>
00371 constructLessByHandleHandle() {
00372 return LessByHandleHandle<Handle>();
00373 }
00374
00375
00377 template<typename Handle>
00378 struct GreaterEqualByHandleHandle :
00379 public std::binary_function<Handle,Handle,bool> {
00380 private:
00381 typedef std::binary_function<Handle,Handle,bool> Base;
00382 public:
00384 typedef typename Base::result_type result_type;
00386 typedef typename Base::first_argument_type first_argument_type;
00388 typedef typename Base::second_argument_type second_argument_type;
00389
00391 result_type
00392 operator()(const first_argument_type x, const second_argument_type y) const {
00393 return **x >= **y;
00394 }
00395 };
00396
00398
00403 template<typename Handle>
00404 inline
00405 GreaterEqualByHandleHandle<Handle>
00406 constructGreaterEqualByHandleHandle() {
00407 return GreaterEqualByHandleHandle<Handle>();
00408 }
00409
00410
00412 template<typename Handle>
00413 struct LessEqualByHandleHandle :
00414 public std::binary_function<Handle,Handle,bool> {
00415 private:
00416 typedef std::binary_function<Handle,Handle,bool> Base;
00417 public:
00419 typedef typename Base::result_type result_type;
00421 typedef typename Base::first_argument_type first_argument_type;
00423 typedef typename Base::second_argument_type second_argument_type;
00424
00426 result_type
00427 operator()(const first_argument_type x, const second_argument_type y) const {
00428 return **x <= **y;
00429 }
00430 };
00431
00433
00438 template<typename Handle>
00439 inline
00440 LessEqualByHandleHandle<Handle>
00441 constructLessEqualByHandleHandle() {
00442 return LessEqualByHandleHandle<Handle>();
00443 }
00444
00445
00446
00447 END_NAMESPACE_ADS
00448
00449 #endif