00001
00002
00003
00004
00005
00006 #ifndef __RD_LESSEQUALQUERY_H__
00007 #define __RD_LESSEQUALQUERY_H__
00008 #include "Query.h"
00009 #include "EqualityQuery.h"
00010
00011 namespace Queries {
00012
00013
00014 template <class MatchFuncArgType, class DataFuncArgType=MatchFuncArgType,
00015 bool needsConversion=false>
00016 class LessEqualQuery :
00017 public EqualityQuery<MatchFuncArgType, DataFuncArgType,needsConversion> {
00018
00019 public:
00020 LessEqualQuery() {this->d_tol = 0;};
00021
00022 explicit LessEqualQuery(DataFuncArgType what) {
00023 this->d_val = what;
00024 this->d_tol = 0;
00025 this->df_negate = false;
00026 };
00027
00028 LessEqualQuery(DataFuncArgType v,DataFuncArgType t) {
00029 this->d_val = v;
00030 this->d_tol = t;
00031 this->df_negate = false;
00032 };
00033
00034
00035 bool Match(const DataFuncArgType what) const {
00036 MatchFuncArgType mfArg = TypeConvert(what,Int2Type<needsConversion>());
00037 if( queryCmp(this->d_val,mfArg,this->d_tol) <= 0 ){
00038 if( this->getNegation() ) return false;
00039 else return true;
00040 } else {
00041 if( this->getNegation() ) return true;
00042 else return false;
00043 }
00044 };
00045
00046 Query<MatchFuncArgType,DataFuncArgType,needsConversion> *
00047 copy( ) const {
00048 LessEqualQuery<MatchFuncArgType,DataFuncArgType,needsConversion> *res =
00049 new LessEqualQuery<MatchFuncArgType,DataFuncArgType,needsConversion>();
00050 res->setNegation(this->getNegation());
00051 res->setVal(this->d_val);
00052 res->setTol(this->d_tol);
00053 res->setDataFunc(this->d_dataFunc);
00054 res->d_description = this->d_description;
00055 return res;
00056 };
00057 };
00058
00059 }
00060 #endif