Loading...
Searching...
No Matches
GreaterEqualQuery.h
Go to the documentation of this file.
//
// Copyright (c) 2003-2020 Greg Landrum and Rational Discovery LLC
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
#include <RDGeneral/export.h>
#ifndef RD_GREATEREQUALQUERY_H
#define RD_GREATEREQUALQUERY_H
#include "Query.h"
#include "EqualityQuery.h"
namespace Queries {
//! \brief a Query implementing >= using a particular
//! value (and an optional tolerance)
template <class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType,
bool needsConversion = false>
class RDKIT_QUERY_EXPORT GreaterEqualQuery
: public EqualityQuery<MatchFuncArgType, DataFuncArgType, needsConversion> {
public:
GreaterEqualQuery() { this->d_tol = 0; }
//! constructs with our target value
explicit GreaterEqualQuery(DataFuncArgType what) {
this->d_val = what;
this->d_tol = 0;
this->df_negate = false;
}
//! constructs with our target value and a tolerance
GreaterEqualQuery(DataFuncArgType v, DataFuncArgType t) {
this->d_val = v;
this->d_tol = t;
this->df_negate = false;
}
bool Match(const DataFuncArgType what) const override {
MatchFuncArgType mfArg =
this->TypeConvert(what, Int2Type<needsConversion>());
if (queryCmp(this->d_val, mfArg, this->d_tol) >= 0) {
return !this->getNegation();
} else {
return this->getNegation();
}
}
Query<MatchFuncArgType, DataFuncArgType, needsConversion> *copy()
const override {
GreaterEqualQuery<MatchFuncArgType, DataFuncArgType, needsConversion> *res =
new GreaterEqualQuery<MatchFuncArgType, DataFuncArgType,
needsConversion>();
res->setVal(this->d_val);
res->setTol(this->d_tol);
res->setNegation(this->getNegation());
res->setDataFunc(this->d_dataFunc);
res->d_description = this->d_description;
res->d_queryType = this->d_queryType;
return res;
}
std::string getFullDescription() const override {
std::ostringstream res;
res << this->getDescription();
res << " " << this->d_val;
if (this->getNegation()) {
res << " ! >= ";
} else {
res << " >= ";
}
return res.str();
}
};
} // namespace Queries
#endif
EqualityQuery.h
Query.h
Queries::EqualityQuery
a Query implementing ==: arguments must match a particular value (within an optional tolerance)
Definition EqualityQuery.h:24
Queries::EqualityQuery::setTol
void setTol(MatchFuncArgType what)
sets our tolerance
Definition EqualityQuery.h:47
Queries::EqualityQuery::setVal
void setVal(MatchFuncArgType what)
sets our target value
Definition EqualityQuery.h:42
Queries::GreaterEqualQuery
a Query implementing >= using a particular value (and an optional tolerance)
Definition GreaterEqualQuery.h:22
Queries::GreaterEqualQuery::Match
bool Match(const DataFuncArgType what) const override
returns whether or not we match the argument
Definition GreaterEqualQuery.h:38
Queries::GreaterEqualQuery::getFullDescription
std::string getFullDescription() const override
returns a fuller text description
Definition GreaterEqualQuery.h:61
Queries::GreaterEqualQuery::GreaterEqualQuery
GreaterEqualQuery()
Definition GreaterEqualQuery.h:24
Queries::GreaterEqualQuery::GreaterEqualQuery
GreaterEqualQuery(DataFuncArgType what)
constructs with our target value
Definition GreaterEqualQuery.h:26
Queries::GreaterEqualQuery::GreaterEqualQuery
GreaterEqualQuery(DataFuncArgType v, DataFuncArgType t)
constructs with our target value and a tolerance
Definition GreaterEqualQuery.h:32
Queries::GreaterEqualQuery::copy
Query< MatchFuncArgType, DataFuncArgType, needsConversion > * copy() const override
returns a copy of this Query
Definition GreaterEqualQuery.h:47
Queries::Int2Type
class to allow integer values to pick templates
Definition Query.h:26
Queries::Query
Base class for all queries.
Definition Query.h:45
Queries::Query::d_queryType
std::string d_queryType
Definition Query.h:153
Queries::Query::setDataFunc
void setDataFunc(MatchFuncArgType(*what)(DataFuncArgType))
sets our data function
Definition Query.h:94
Queries::Query::setNegation
void setNegation(bool what)
sets whether or not we are negated
Definition Query.h:59
Queries::Query::d_description
std::string d_description
Definition Query.h:152
export.h
RDKIT_QUERY_EXPORT
#define RDKIT_QUERY_EXPORT
Definition export.h:629
Queries
Definition AndQuery.h:16
Queries::queryCmp
int queryCmp(const T1 v1, const T2 v2, const T1 tol)
Definition Query.h:197