 |
RDKit
Open-source cheminformatics and machine learning.
|
Go to the documentation of this file.
11 #ifndef __RD_SETQUERY_H__
12 #define __RD_SETQUERY_H__
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);
40 bool Match(
const DataFuncArgType what)
const {
41 MatchFuncArgType mfArg =
50 typename std::set<MatchFuncArgType>::const_iterator i;
51 for (i = this->
d_set.begin(); i != this->d_set.end(); ++i) {
59 typename CONTAINER_TYPE::const_iterator
beginSet()
const {
62 typename CONTAINER_TYPE::const_iterator
endSet()
const {
65 unsigned int size()
const {
return rdcast<unsigned int>(
d_set.size()); };
68 std::ostringstream res;
75 std::ostream_iterator<MatchFuncArgType>(res,
", "));
CONTAINER_TYPE::const_iterator endSet() const
void setNegation(bool what)
sets whether or not we are negated
std::set< MatchFuncArgType > CONTAINER_TYPE
MatchFuncArgType(* d_dataFunc)(MatchFuncArgType)
void insert(const MatchFuncArgType what)
insert an entry into our set
Query< MatchFuncArgType, DataFuncArgType, needsConversion > * copy() const
void clear()
clears our set
std::string d_description
CONTAINER_TYPE::const_iterator beginSet() const
void setDataFunc(MatchFuncArgType(*what)(MatchFuncArgType))
sets our data function
bool getNegation() const
returns whether or not we are negated
class to allow integer values to pick templates
bool Match(const DataFuncArgType what) const
MatchFuncArgType TypeConvert(MatchFuncArgType what, Int2Type< false >) const
calls our dataFunc (if it's set) on what and returns the result, otherwise returns what
std::string getFullDescription() const
a Query implementing a set: arguments must one of a set of values
Base class for all queries.
const std::string & getDescription() const
returns our text description
unsigned int size() const