23 template <
class MatchFuncArgType,
class DataFuncArgType = MatchFuncArgType,
24 bool needsConversion =
false>
26 :
public Query<MatchFuncArgType, DataFuncArgType, needsConversion> {
30 SetQuery() :
Query<MatchFuncArgType, DataFuncArgType, needsConversion>() {}
33 void insert(
const MatchFuncArgType what) {
34 if (d_set.find(what) == this->d_set.end()) this->d_set.insert(what);
38 void clear() { this->d_set.clear(); }
40 bool Match(
const DataFuncArgType what)
const override {
41 MatchFuncArgType mfArg =
43 return (this->d_set.find(mfArg) != this->d_set.end()) ^ this->getNegation();
51 typename std::set<MatchFuncArgType>::const_iterator i;
52 for (i = this->d_set.begin(); i != this->d_set.end(); ++i) {
61 typename CONTAINER_TYPE::const_iterator
beginSet()
const {
64 typename CONTAINER_TYPE::const_iterator
endSet()
const {
return d_set.end(); }
65 unsigned int size()
const {
return rdcast<unsigned int>(d_set.size()); }
68 std::ostringstream res;
69 res << this->getDescription() <<
" val";
70 if (this->getNegation())
74 std::copy(d_set.begin(), d_set.end(),
75 std::ostream_iterator<MatchFuncArgType>(res,
", "));
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
a Query implementing a set: arguments must one of a set of values
CONTAINER_TYPE::const_iterator beginSet() const
void clear()
clears our set
std::set< MatchFuncArgType > CONTAINER_TYPE
void insert(const MatchFuncArgType what)
insert an entry into our set
unsigned int size() const
Query< MatchFuncArgType, DataFuncArgType, needsConversion > * copy() const override
returns a copy of this Query
bool Match(const DataFuncArgType what) const override
CONTAINER_TYPE::const_iterator endSet() const
std::string getFullDescription() const override
returns a fuller text description
#define RDKIT_QUERY_EXPORT