RDCode: Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion > Class Template Reference

- Main Page
- Namespaces
- Classes
- Files
- Directories

- Class List
- Class Hierarchy
- Class Members

# Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion > Class Template Reference

Base class for all queries. More...

`#include <Query.h>`

Inheritance diagram for Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >:

List of all members.

## 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
bool | getNegation () const
| returns whether or not we are negated
void | setDescription (std::string &descr)
| sets our text description
void | setDescription (const char *descr)
std::string | getDescription () const
| returns our text description
void | setMatchFunc (bool(*what)(MatchFuncArgType))
| sets our match function
bool(* | getMatchFunc () const)(MatchFuncArgType)
| returns our match function:
void | setDataFunc (MatchFuncArgType(*what)(DataFuncArgType))
| sets our data function
MatchFuncArgType(* | getDataFunc () const)(DataFuncArgType)
| returns 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
## Protected Member Functions
MatchFuncArgType | TypeConvert (MatchFuncArgType what, Int2Type< false > d) const
| calls our `dataFunc` (if it's set) on `what` and returns the result, otherwise returns `what`
MatchFuncArgType | TypeConvert (DataFuncArgType what, Int2Type< true > d) const
| calls our `dataFunc` (which must be set) on `what` and returns the result
## Protected Attributes
std::string | d_description
CHILD_VECT | d_children
bool | df_negate
bool(* | d_matchFunc )(MatchFuncArgType)
MatchFuncArgType(* | d_dataFunc )(DataFuncArgType)

## Detailed Description

### template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>
class Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >

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`.

Definition at line 42 of file Query.h.

## Member Typedef Documentation

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

typedef boost::shared_ptr< Query<MatchFuncArgType, DataFuncArgType, needsConversion> > Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::CHILD_TYPE

Definition at line 44 of file Query.h.

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

typedef std::vector< CHILD_TYPE > Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::CHILD_VECT

Definition at line 45 of file Query.h.

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

typedef CHILD_VECT::iterator Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::CHILD_VECT_I

Definition at line 46 of file Query.h.

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

typedef CHILD_VECT::const_iterator Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::CHILD_VECT_CI

Definition at line 47 of file Query.h.

## Constructor & Destructor Documentation

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::Query | ( |  | ) | `[inline]`

Definition at line 49 of file Query.h.

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

virtual Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::~Query | ( |  | ) | `[inline, virtual]`

Definition at line 50 of file Query.h.

## Member Function Documentation

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

void Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::setNegation | ( | bool | what | ) | `[inline]`

sets whether or not we are negated

Definition at line 54 of file Query.h.

Referenced by Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::SetQuery< const int, RDKit::Atom *, true >::copy(), Queries::RangeQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), RDKit::RecursiveStructureQuery::copy(), RDKit::AtomRingQuery::copy(), Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::EqualityQuery< int, Atom const *, true >::copy(), and Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy().

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

bool Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::getNegation | ( |  | ) | const`[inline]`

returns whether or not we are negated

Definition at line 56 of file Query.h.

Referenced by RDKit::RecursiveStructureQuery::copy(), and RDKit::AtomRingQuery::copy().

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

void Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::setDescription | ( | std::string & | descr | ) | `[inline]`

sets our text description

Definition at line 59 of file Query.h.

Referenced by RDKit::AtomRingQuery::AtomRingQuery(), and RDKit::RecursiveStructureQuery::RecursiveStructureQuery().

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

void Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::setDescription | ( | const char * | descr | ) | `[inline]`

Definition at line 61 of file Query.h.

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

std::string Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::getDescription | ( |  | ) | const`[inline]`

returns our text description

Definition at line 63 of file Query.h.

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

void Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::setMatchFunc | ( | bool(*)(MatchFuncArgType) | what | ) | `[inline]`

sets our match function

Definition at line 66 of file Query.h.

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

bool(* Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::getMatchFunc | ( |  | ) | `[inline]`

returns our match function:

Definition at line 68 of file Query.h.

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

void Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::setDataFunc | ( | MatchFuncArgType(*)(DataFuncArgType) | what | ) | `[inline]`

sets our data function

Definition at line 70 of file Query.h.

Referenced by RDKit::AtomRingQuery::AtomRingQuery(), Queries::SetQuery< const int, RDKit::Atom *, true >::copy(), Queries::RangeQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::EqualityQuery< int, Atom const *, true >::copy(), and RDKit::RecursiveStructureQuery::RecursiveStructureQuery().

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

MatchFuncArgType(* Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::getDataFunc | ( |  | ) | `[inline]`

returns our data function:

Definition at line 72 of file Query.h.

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

void Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::addChild | ( | CHILD_TYPE | child | ) | `[inline]`

adds a child to our list of children

Definition at line 75 of file Query.h.

Referenced by Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::Query< const int, Atom *, needsConversion >::copy(), Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), and Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy().

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

CHILD_VECT_CI Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::beginChildren | ( |  | ) | const`[inline]`

returns an iterator for the beginning of our child vector

Definition at line 77 of file Query.h.

Referenced by Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::Query< const int, Atom *, needsConversion >::copy(), Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), and Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy().

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

CHILD_VECT_CI Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::endChildren | ( |  | ) | const`[inline]`

returns an iterator for the end of our child vector

Definition at line 79 of file Query.h.

Referenced by Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::Query< const int, Atom *, needsConversion >::copy(), Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::Match(), Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::Match(), and Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::Match().

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

virtual bool Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::Match | ( | const DataFuncArgType | arg | ) | const`[inline, virtual]`

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 >.

Definition at line 82 of file Query.h.

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

virtual Query<MatchFuncArgType,DataFuncArgType,needsConversion>* Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::copy | ( |  | ) | const`[inline, virtual]`

returns a copy of this Query

Notes:

- the caller is responsible for `delete`ing the result

Reimplemented in RDKit::AtomRingQuery, RDKit::RecursiveStructureQuery, 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 >, Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >, Queries::EqualityQuery< int, Atom const *, true >, and Queries::SetQuery< const int, RDKit::Atom *, true >.

Definition at line 98 of file Query.h.

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

MatchFuncArgType Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::TypeConvert | ( | MatchFuncArgType | what,
|  | Int2Type< false > | d |
| ) |  |  | const`[inline, protected]`

calls our `dataFunc` (if it's set) on `what` and returns the result, otherwise returns `what`

Definition at line 123 of file Query.h.

Referenced by Queries::SetQuery< const int, RDKit::Atom *, true >::Match(), Queries::RangeQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::Match(), RDKit::AtomRingQuery::Match(), Queries::Query< const int, Atom *, needsConversion >::Match(), Queries::LessQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::Match(), Queries::LessEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::Match(), Queries::GreaterQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::Match(), Queries::GreaterEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::Match(), and Queries::EqualityQuery< int, Atom const *, true >::Match().

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

MatchFuncArgType Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::TypeConvert | ( | DataFuncArgType | what,
|  | Int2Type< true > | d |
| ) |  |  | const`[inline, protected]`

calls our `dataFunc` (which must be set) on `what` and returns the result

Definition at line 133 of file Query.h.

## Member Data Documentation

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

std::string Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_description`[protected]`

Definition at line 112 of file Query.h.

Referenced by Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::SetQuery< const int, RDKit::Atom *, true >::copy(), Queries::RangeQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), RDKit::RecursiveStructureQuery::copy(), RDKit::AtomRingQuery::copy(), Queries::Query< const int, Atom *, needsConversion >::copy(), Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::LessEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::GreaterEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::EqualityQuery< int, Atom const *, true >::copy(), Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), Queries::Query< const int, Atom *, needsConversion >::getDescription(), and Queries::Query< const int, Atom *, needsConversion >::setDescription().

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

CHILD_VECT Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_children`[protected]`

Definition at line 116 of file Query.h.

Referenced by Queries::Query< const int, Atom *, needsConversion >::addChild(), Queries::Query< const int, Atom *, needsConversion >::beginChildren(), Queries::Query< const int, Atom *, needsConversion >::endChildren(), and Queries::Query< const int, Atom *, needsConversion >::~Query().

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

bool Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::df_negate`[protected]`

Definition at line 117 of file Query.h.

Referenced by Queries::AndQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::AndQuery(), Queries::Query< const int, Atom *, needsConversion >::copy(), Queries::EqualityQuery< int, Atom const *, true >::EqualityQuery(), Queries::Query< const int, Atom *, needsConversion >::getNegation(), Queries::GreaterEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::GreaterEqualQuery(), Queries::GreaterQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::GreaterQuery(), Queries::LessEqualQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::LessEqualQuery(), Queries::LessQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::LessQuery(), Queries::OrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::OrQuery(), Queries::RangeQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::RangeQuery(), Queries::Query< const int, Atom *, needsConversion >::setNegation(), and Queries::XOrQuery< MatchFuncArgType, DataFuncArgType, needsConversion >::XOrQuery().

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

bool(* Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_matchFunc)(MatchFuncArgType)`[protected]`

Referenced by Queries::Query< const int, Atom *, needsConversion >::copy(), Queries::Query< const int, Atom *, needsConversion >::getMatchFunc(), Queries::Query< const int, Atom *, needsConversion >::Match(), and Queries::Query< const int, Atom *, needsConversion >::setMatchFunc().

template<class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, bool needsConversion = false>

MatchFuncArgType(* Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::d_dataFunc)(DataFuncArgType)`[protected]`

Referenced by RDKit::AtomRingQuery::copy(), Queries::Query< const int, Atom *, needsConversion >::copy(), Queries::Query< const int, Atom *, needsConversion >::getDataFunc(), Queries::Query< const int, Atom *, needsConversion >::setDataFunc(), and Queries::Query< const int, Atom *, needsConversion >::TypeConvert().

The documentation for this class was generated from the following file:

- Query.h