11#ifndef RD_EQUALITYQUERY_H
12#define RD_EQUALITYQUERY_H
20template <
typename MatchFuncArgType,
21 typename DataFuncArgType = MatchFuncArgType,
22 bool needsConversion =
false>
24 :
public Query<MatchFuncArgType, DataFuncArgType, needsConversion> {
31 this->df_negate =
false;
38 this->df_negate =
false;
42 void setVal(MatchFuncArgType what) { this->d_val = what; }
44 const MatchFuncArgType
getVal()
const {
return this->d_val; }
47 void setTol(MatchFuncArgType what) { this->d_tol = what; }
49 const MatchFuncArgType
getTol()
const {
return this->d_tol; }
51 bool Match(
const DataFuncArgType what)
const override {
52 MatchFuncArgType mfArg =
54 if (
queryCmp(this->d_val, mfArg, this->d_tol) == 0) {
55 return !this->getNegation();
57 return this->getNegation();
75 std::ostringstream res;
76 res << this->getDescription();
77 res <<
" " << this->d_val;
78 if (this->getNegation()) {
a Query implementing ==: arguments must match a particular value (within an optional tolerance)
const MatchFuncArgType getVal() const
returns our target value
Query< MatchFuncArgType, DataFuncArgType, needsConversion > * copy() const override
returns a copy of this Query
EqualityQuery(MatchFuncArgType v)
constructs with our target value
bool Match(const DataFuncArgType what) const override
EqualityQuery(MatchFuncArgType v, MatchFuncArgType t)
constructs with our target value and a tolerance
void setTol(MatchFuncArgType what)
sets our tolerance
void setVal(MatchFuncArgType what)
sets our target value
const MatchFuncArgType getTol() const
returns out tolerance
std::string getFullDescription() const override
returns a fuller text description
class to allow integer values to pick templates
Base class for all queries.
void setDataFunc(MatchFuncArgType(*what)(DataFuncArgType))
sets our data function
void setNegation(bool what)
sets whether or not we are negated
std::string d_description
#define RDKIT_QUERY_EXPORT
int queryCmp(const T1 v1, const T2 v2, const T1 tol)