23template <
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()) {
35 this->d_set.insert(what);
40 void clear() { this->d_set.clear(); }
42 bool Match(
const DataFuncArgType what)
const override {
43 MatchFuncArgType mfArg =
45 return (this->d_set.find(mfArg) != this->d_set.end()) ^ this->getNegation();
53 typename std::set<MatchFuncArgType>::const_iterator i;
54 for (i = this->d_set.begin(); i != this->d_set.end(); ++i) {
63 typename CONTAINER_TYPE::const_iterator
beginSet()
const {
66 typename CONTAINER_TYPE::const_iterator
endSet()
const {
return d_set.end(); }
67 unsigned int size()
const {
return rdcast<unsigned int>(d_set.size()); }
70 std::ostringstream res;
71 res << this->getDescription() <<
" val";
72 if (this->getNegation()) {
77 std::copy(d_set.begin(), d_set.end(),
78 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
Query< MatchFuncArgType, DataFuncArgType, needsConversion > * copy() const override
returns a copy of this Query
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
bool Match(const DataFuncArgType what) const override
returns whether or not we match the argument
CONTAINER_TYPE::const_iterator endSet() const
std::string getFullDescription() const override
returns a fuller text description
#define RDKIT_QUERY_EXPORT