00001
00002
00003
00004
00005
00006 #ifndef __RD_LESSQUERY_H__
00007 #define __RD_LESSQUERY_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 LessQuery :
00017 public EqualityQuery<MatchFuncArgType, DataFuncArgType,needsConversion> {
00018
00019 public:
00020 LessQuery() { this->d_tol = 0;};
00021
00022 explicit LessQuery(DataFuncArgType v) {
00023 this->d_val = v;
00024 this->d_tol = 0;
00025 this->df_negate = false;
00026 };
00027
00028 LessQuery(DataFuncArgType v,DataFuncArgType t) {
00029 this->d_val = v;
00030 this->d_tol = t;
00031 this->df_negate = false;
00032 };
00033
00034 bool Match(const DataFuncArgType what) const {
00035 MatchFuncArgType mfArg = TypeConvert(what,Int2Type<needsConversion>());
00036 if( queryCmp(this->d_val,mfArg,this->d_tol) < 0 ){
00037 if( this->getNegation() ) return false;
00038 else return true;
00039 } else {
00040 if( this->getNegation() ) return true;
00041 else return false;
00042 }
00043 };
00044
00045 Query<MatchFuncArgType,DataFuncArgType,needsConversion> *
00046 copy( ) const {
00047 LessQuery<MatchFuncArgType,DataFuncArgType,needsConversion> *res =
00048 new LessQuery<MatchFuncArgType,DataFuncArgType,needsConversion>();
00049 res->setNegation(this->getNegation());
00050 res->setVal(this->d_val);
00051 res->setTol(this->d_tol);
00052 res->setDataFunc(this->d_dataFunc);
00053 res->d_description = this->d_description;
00054 return res;
00055 };
00056
00057 };
00058
00059 }
00060 #endif