![]() |
RDKit
Open-source cheminformatics and machine learning.
|
Base class for all queries. More...
#include <Query.h>
Public Types | |
| using | CHILD_TYPE = std::shared_ptr< Query< MatchFuncArgType, DataFuncArgType, needsConversion > > |
| using | CHILD_VECT = std::vector< CHILD_TYPE > |
| using | CHILD_VECT_I = typename CHILD_VECT::iterator |
| using | CHILD_VECT_CI = typename CHILD_VECT::const_iterator |
| using | MATCH_FUNC_ARG_TYPE = MatchFuncArgType |
| using | DATA_FUNC_ARG_TYPE = DataFuncArgType |
Public Member Functions | |
| Query () | |
| virtual | ~Query () |
| void | setNegation (bool what) |
| sets whether or not we are negated | |
| bool | getNegation () const |
| returns whether or not we are negated | |
| void | setDescription (const std::string &descr) |
| sets our text description | |
| void | setDescription (const char *descr) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| const std::string & | getDescription () const |
| returns our text description | |
| virtual std::string | getFullDescription () const |
| returns a fuller text description | |
| void | setTypeLabel (const std::string &typ) |
| sets our type label | |
| void | setTypeLabel (const char *typ) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| const std::string & | getTypeLabel () const |
| returns our text label. | |
| void | setMatchFunc (bool(*what)(MatchFuncArgType)) |
| sets our match function | |
| void | setDataFunc (MatchFuncArgType(*what)(DataFuncArgType)) |
| sets our data function | |
| void | addChild (CHILD_TYPE child) |
| adds a child to our list of children | |
| CHILD_VECT_CI | beginChildren () const |
| returns an iterator for the beginning of our child vector | |
| CHILD_VECT_CI | endChildren () const |
| returns an iterator for the end of our child vector | |
| virtual bool | Match (const DataFuncArgType arg) const |
| returns whether or not we match the argument | |
| virtual Query< MatchFuncArgType, DataFuncArgType, needsConversion > * | copy () const |
| returns a copy of this Query | |
Public Attributes | |
| bool(*)(MatchFuncArgType) | getMatchFunc () const |
| returns our match function: | |
| MatchFuncArgType(*)(DataFuncArgType) | getDataFunc () const |
| returns our data function: | |
Protected Member Functions | |
| MatchFuncArgType | TypeConvert (MatchFuncArgType what, Int2Type< false >) const |
calls our dataFunc (if it's set) on what and returns the result, otherwise returns what | |
| MatchFuncArgType | TypeConvert (DataFuncArgType what, Int2Type< true >) const |
Protected Attributes | ||
| MatchFuncArgType | d_val = 0 | |
| MatchFuncArgType | d_tol = 0 | |
| std::string | d_description = "" | |
| std::string | d_queryType = "" | |
| CHILD_VECT | d_children | |
| bool | df_negate {false} | |
| bool(* | d_matchFunc )(MatchFuncArgType) | |
| union { | ||
| MatchFuncArgType(* d_dataFunc )(DataFuncArgType) | ||
| MatchFuncArgType(* d_dataFuncSameType )(MatchFuncArgType) | ||
| }; | ||
Base class for all queries.
Query objects have one or two functions associated with them:
bool matchFunc(MatchFuncArgType other) returns true or false to indicate whether this query matches other. This is mandatory.MatchFuncArgType dataFunc(DataFuncArgType other) converts the argument other from DataFuncArgType to MatchFuncArgType. This is optional if DataFuncArgType is the same as (or implicitly convertible to) MatchFuncArgType. | using Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::CHILD_TYPE = std::shared_ptr< Query<MatchFuncArgType, DataFuncArgType, needsConversion> > |
| using Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::CHILD_VECT = std::vector<CHILD_TYPE> |
| using Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::CHILD_VECT_CI = typename CHILD_VECT::const_iterator |
| using Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::CHILD_VECT_I = typename CHILD_VECT::iterator |
| using Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::DATA_FUNC_ARG_TYPE = DataFuncArgType |
| using Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::MATCH_FUNC_ARG_TYPE = MatchFuncArgType |
|
inline |
|
inlinevirtual |
|
inline |
adds a child to our list of children
Definition at line 103 of file Query.h.
Referenced by Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), and Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy().
|
inline |
|
inlinevirtual |
returns a copy of this Query
Notes:
deleteing the result Reimplemented in RDKit::AtomRingQuery, RDKit::RecursiveStructureQuery, RDKit::HasPropQuery< TargetPtr >, RDKit::HasPropWithValueQuery< TargetPtr, T >, RDKit::HasPropWithValueQuery< TargetPtr, std::string >, RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >, Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::EqualityQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::EqualityQuery< int, ConstAtomPtr, true >, Queries::EqualityQuery< int, TargetPtr, true >, Queries::EqualityQuery< MatchFuncArgType, MatchFuncArgType, false >, Queries::GreaterEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::GreaterQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::LessEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::LessQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::RangeQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::SetQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::SetQuery< int, Atom const *, true >, and Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >.
Definition at line 131 of file Query.h.
References Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::addChild(), Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_dataFunc, Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_description, Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_matchFunc, Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_queryType, Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_tol, Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_val, and Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::df_negate.
Referenced by RDKit::QueryAtom::operator=(), RDKit::QueryAtom::QueryAtom(), and RDKit::QueryBond::QueryBond().
|
inline |
|
inline |
|
inlinevirtual |
returns a fuller text description
Reimplemented in Queries::EqualityQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::EqualityQuery< int, ConstAtomPtr, true >, Queries::EqualityQuery< int, TargetPtr, true >, Queries::EqualityQuery< MatchFuncArgType, MatchFuncArgType, false >, Queries::GreaterEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::GreaterQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::LessEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::LessQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::RangeQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::SetQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, and Queries::SetQuery< int, Atom const *, true >.
|
inline |
returns whether or not we are negated
Definition at line 61 of file Query.h.
Referenced by RDKit::HasPropQuery< TargetPtr >::copy(), RDKit::HasPropWithValueQuery< TargetPtr, T >::copy(), RDKit::HasPropWithValueQuery< TargetPtr, std::string >::copy(), RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >::copy(), RDKit::HasPropQuery< TargetPtr >::Match(), RDKit::HasPropWithValueQuery< TargetPtr, T >::Match(), RDKit::HasPropWithValueQuery< TargetPtr, std::string >::Match(), and RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >::Match().
|
inline |
|
inlinevirtual |
returns whether or not we match the argument
Reimplemented in Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::EqualityQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::GreaterEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::GreaterQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::LessEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::LessQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::RangeQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::SetQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, and Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >.
|
inline |
sets our data function
Definition at line 94 of file Query.h.
Referenced by Queries::EqualityQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::RangeQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::SetQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), RDKit::HasPropQuery< TargetPtr >::HasPropQuery(), RDKit::HasPropQuery< TargetPtr >::HasPropQuery(), RDKit::HasPropWithValueQuery< TargetPtr, T >::HasPropWithValueQuery(), RDKit::HasPropWithValueQuery< TargetPtr, std::string >::HasPropWithValueQuery(), RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >::HasPropWithValueQuery(), RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >::HasPropWithValueQuery(), RDKit::HasPropWithValueQuery< TargetPtr, T >::HasPropWithValueQuery(), and RDKit::HasPropWithValueQuery< TargetPtr, std::string >::HasPropWithValueQuery().
|
inline |
|
inline |
sets our text description
Definition at line 64 of file Query.h.
Referenced by RDKit::HasPropQuery< TargetPtr >::HasPropQuery(), RDKit::HasPropQuery< TargetPtr >::HasPropQuery(), RDKit::HasPropWithValueQuery< TargetPtr, T >::HasPropWithValueQuery(), RDKit::HasPropWithValueQuery< TargetPtr, std::string >::HasPropWithValueQuery(), RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >::HasPropWithValueQuery(), RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >::HasPropWithValueQuery(), RDKit::HasPropWithValueQuery< TargetPtr, T >::HasPropWithValueQuery(), and RDKit::HasPropWithValueQuery< TargetPtr, std::string >::HasPropWithValueQuery().
|
inline |
|
inline |
sets whether or not we are negated
Definition at line 59 of file Query.h.
Referenced by RDKit::AtomRingQuery::copy(), RDKit::RecursiveStructureQuery::copy(), Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::EqualityQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::RangeQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::SetQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), and Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy().
|
inline |
|
inline |
|
inlineprotected |
calls our dataFunc (which must be set) on what and returns the result
Definition at line 182 of file Query.h.
References PRECONDITION.
|
inlineprotected |
| union { ... } Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion > |
|
protected |
| MatchFuncArgType(* Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_dataFunc) (DataFuncArgType) |
Definition at line 164 of file Query.h.
Referenced by Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), and RDKit::AtomRingQuery::copy().
| MatchFuncArgType(* Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_dataFuncSameType) (MatchFuncArgType) |
|
protected |
Definition at line 152 of file Query.h.
Referenced by Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), RDKit::AtomRingQuery::copy(), RDKit::RecursiveStructureQuery::copy(), RDKit::HasPropQuery< TargetPtr >::copy(), RDKit::HasPropWithValueQuery< TargetPtr, T >::copy(), RDKit::HasPropWithValueQuery< TargetPtr, std::string >::copy(), RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >::copy(), Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::EqualityQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::RangeQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::SetQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), and Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy().
|
protected |
Definition at line 156 of file Query.h.
Referenced by Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::copy().
|
protected |
Definition at line 153 of file Query.h.
Referenced by Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::EqualityQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::RangeQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::SetQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), and Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy().
|
protected |
Definition at line 151 of file Query.h.
Referenced by Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::copy().
|
protected |
Definition at line 150 of file Query.h.
Referenced by Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::copy().
|
protected |
Definition at line 155 of file Query.h.
Referenced by Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::copy().
|
inline |
|
inline |