![]() |
RDKit
Open-source cheminformatics and machine learning.
|
Base class for all queries. More...
#include <Query.h>
Public Types | |
typedef boost::shared_ptr< Query< MatchFuncArgType, DataFuncArgType, needsConversion > > | CHILD_TYPE |
typedef std::vector< CHILD_TYPE > | CHILD_VECT |
typedef CHILD_VECT::iterator | CHILD_VECT_I |
typedef CHILD_VECT::const_iterator | CHILD_VECT_CI |
Public Member Functions | |
Query () | |
virtual | ~Query () |
void | setNegation (bool what) |
sets whether or not we are negated More... | |
bool | getNegation () const |
returns whether or not we are negated More... | |
void | setDescription (const std::string &descr) |
sets our text description More... | |
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. More... | |
const std::string & | getDescription () const |
returns our text description More... | |
virtual std::string | getFullDescription () const |
returns a fuller text description More... | |
void | setMatchFunc (bool(*what)(MatchFuncArgType)) |
sets our match function More... | |
void | setDataFunc (MatchFuncArgType(*what)(DataFuncArgType)) |
sets our data function More... | |
void | addChild (CHILD_TYPE child) |
adds a child to our list of children More... | |
CHILD_VECT_CI | beginChildren () const |
returns an iterator for the beginning of our child vector More... | |
CHILD_VECT_CI | endChildren () const |
returns an iterator for the end of our child vector More... | |
virtual bool | Match (const DataFuncArgType arg) const |
returns whether or not we match the argument More... | |
virtual Query< MatchFuncArgType, DataFuncArgType, needsConversion > * | copy () const |
returns a copy of this Query More... | |
Public Attributes | |
bool(*)(MatchFuncArgType) | getMatchFunc () const |
returns our match function: More... | |
MatchFuncArgType(*)(DataFuncArgType) | getDataFunc () const |
returns our data function: More... | |
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 More... | |
MatchFuncArgType | TypeConvert (DataFuncArgType what, Int2Type< true >) const |
calls our dataFunc (which must be set) on what and returns the More... | |
Protected Attributes | |
MatchFuncArgType | d_val = 0 |
MatchFuncArgType | d_tol = 0 |
std::string | d_description |
CHILD_VECT | d_children |
bool | df_negate |
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
. typedef boost::shared_ptr< Query<MatchFuncArgType, DataFuncArgType, needsConversion> > Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::CHILD_TYPE |
typedef std::vector<CHILD_TYPE> Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::CHILD_VECT |
typedef CHILD_VECT::const_iterator Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::CHILD_VECT_CI |
typedef CHILD_VECT::iterator Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::CHILD_VECT_I |
|
inline |
|
inlinevirtual |
|
inline |
adds a child to our list of children
Definition at line 101 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, needsConversion >::copy().
|
inline |
returns an iterator for the beginning of our child vector
Definition at line 103 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, needsConversion >::copy(), and RDKit::detail::qhelper().
|
inlinevirtual |
returns a copy of this Query
Notes:
delete
ing the result Reimplemented in Queries::EqualityQuery< MatchFuncArgType, MatchFuncArgType, false >, Queries::EqualityQuery< int, ConstAtomPtr, true >, Queries::EqualityQuery< int, TargetPtr, true >, and Queries::SetQuery< int, Atom const *, true >.
Definition at line 127 of file Query.h.
Referenced by RDKit::QueryAtom::operator=(), and RDKit::QueryAtom::QueryAtom().
|
inline |
returns an iterator for the end of our child vector
Definition at line 105 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, needsConversion >::copy(), and RDKit::detail::qhelper().
|
inline |
returns our text description
Definition at line 76 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, needsConversion >::getFullDescription().
|
inlinevirtual |
returns a fuller text description
Reimplemented in Queries::EqualityQuery< MatchFuncArgType, MatchFuncArgType, false >, Queries::EqualityQuery< int, ConstAtomPtr, true >, Queries::EqualityQuery< int, TargetPtr, true >, and Queries::SetQuery< int, Atom const *, true >.
Definition at line 78 of file Query.h.
Referenced by RDKit::detail::qhelper().
|
inline |
returns whether or not we are negated
Definition at line 65 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, needsConversion >::getFullDescription(), and Queries::Query< int, TargetPtr, needsConversion >::Match().
|
inlinevirtual |
returns whether or not we match the argument
Reimplemented in RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >, RDKit::HasPropWithValueQuery< TargetPtr, std::string >, RDKit::HasPropWithValueQuery< TargetPtr, T >, RDKit::HasPropQuery< TargetPtr >, Queries::EqualityQuery< int, TargetPtr, true >, Queries::EqualityQuery< MatchFuncArgType, MatchFuncArgType, false >, Queries::EqualityQuery< int, ConstAtomPtr, true >, and Queries::SetQuery< int, Atom const *, true >.
|
inline |
sets our data function
Definition at line 92 of file Query.h.
Referenced by RDKit::makeAtomRangeQuery().
|
inline |
|
inline |
sets our text description
Definition at line 68 of file Query.h.
Referenced by RDKit::makeAtomRangeQuery().
|
inline |
|
inline |
sets whether or not we are negated
Definition at line 63 of file Query.h.
Referenced by RDKit::AtomRingQuery::copy(), RDKit::RecursiveStructureQuery::copy(), RDKit::HasPropQuery< TargetPtr >::copy(), RDKit::HasPropWithValueQuery< TargetPtr, T >::copy(), RDKit::HasPropWithValueQuery< TargetPtr, std::string >::copy(), and RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >::copy().
|
inlineprotected |
|
inlineprotected |
calls our dataFunc
(if it's set) on what
and returns the result, otherwise returns what
Definition at line 163 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, needsConversion >::Match().
union { ... } |
|
protected |
Definition at line 148 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, needsConversion >::addChild(), Queries::Query< int, TargetPtr, needsConversion >::beginChildren(), Queries::Query< int, TargetPtr, needsConversion >::endChildren(), and Queries::Query< int, TargetPtr, needsConversion >::~Query().
MatchFuncArgType(* Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_dataFunc) (DataFuncArgType) |
MatchFuncArgType(* Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_dataFuncSameType) (MatchFuncArgType) |
Definition at line 159 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, needsConversion >::TypeConvert().
|
protected |
Definition at line 147 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, 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::Query< int, TargetPtr, needsConversion >::getDescription(), and Queries::Query< int, TargetPtr, needsConversion >::setDescription().
|
protected |
Definition at line 150 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, needsConversion >::copy(), Queries::Query< int, TargetPtr, needsConversion >::Match(), and Queries::Query< int, TargetPtr, needsConversion >::setMatchFunc().
|
protected |
Definition at line 146 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, needsConversion >::copy().
|
protected |
Definition at line 145 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, needsConversion >::copy().
|
protected |
Definition at line 149 of file Query.h.
Referenced by Queries::Query< int, TargetPtr, needsConversion >::copy(), Queries::Query< int, TargetPtr, needsConversion >::getNegation(), and Queries::Query< int, TargetPtr, needsConversion >::setNegation().
|
inline |
|
inline |