RDKit: RDKit::QueryBond Class Reference

| RDKit Open-source cheminformatics and machine learning.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Attributes | List of all members
RDKit::QueryBond Class Reference

Class for storing Bond queries. More...

`#include <QueryBond.h>`

Inheritance diagram for RDKit::QueryBond:

## Public Types
typedef Queries::Query< int, Bond const *, true > | QUERYBOND_QUERY
Public Types inherited from RDKit::Bond
enum | BondType { UNSPECIFIED = 0, SINGLE, DOUBLE, TRIPLE, QUADRUPLE, QUINTUPLE, HEXTUPLE, ONEANDAHALF, TWOANDAHALF, THREEANDAHALF, FOURANDAHALF, FIVEANDAHALF, AROMATIC, IONIC, HYDROGEN, THREECENTER, DATIVEONE, DATIVE, DATIVEL, DATIVER, OTHER, ZERO }
| the type of Bond More...
enum | BondDir { NONE = 0, BEGINWEDGE, BEGINDASH, ENDDOWNRIGHT, ENDUPRIGHT, EITHERDOUBLE, UNKNOWN }
| the bond's direction (for chirality) More...
enum | BondStereo { STEREONONE = 0, STEREOANY, STEREOZ, STEREOE, STEREOCIS, STEREOTRANS }
| the nature of the bond's stereochem (for cis/trans) More...
typedef boost::shared_ptr< Bond > | BOND_SPTR
typedef Queries::Query< int, Bond const *, true > | QUERYBOND_QUERY

## Public Member Functions
| QueryBond ()
| QueryBond (BondType bT)
| initialize with a particular bond order More...
| QueryBond (const Bond &other)
| initialize from a bond More...
| QueryBond (const QueryBond &other)
| ~QueryBond ()
virtual Bond * | copy () const
| returns a copy of this query, owned by the caller More...
QueryBond & | operator= (const QueryBond &other)
void | setBondType (BondType bT)
| sets the BondType of this query: More...
void | setBondDir (BondDir bD)
| sets the BondDir of this query: More...
bool | Match (const Bond::BOND_SPTR what) const
| returns true if we match Bond `what` More...
bool | Match (Bond const *what) const
bool | QueryMatch (QueryBond const *what) const
| returns true if our query details match those of QueryBond `what` More...
bool | hasQuery () const
QUERYBOND_QUERY * | getQuery () const
| returns our current query More...
void | setQuery (QUERYBOND_QUERY *what)
| replaces our current query with the value passed in More...
void | expandQuery (QUERYBOND_QUERY *what, Queries::CompositeQueryType how=Queries::COMPOSITE_AND, bool maintainOrder=true)
| expands our current query More...
Public Member Functions inherited from RDKit::Bond
| Bond ()
| Bond (BondType bT)
| construct with a particular BondType More...
| Bond (const Bond &other)
virtual | ~Bond ()
Bond & | operator= (const Bond &other)
BondType | getBondType () const
| returns our `bondType` More...
void | setBondType (BondType bT)
| sets our `bondType` More...
double | getBondTypeAsDouble () const
| returns our `bondType` as a double (e.g. SINGLE->1.0, AROMATIC->1.5, etc.) More...
double | getValenceContrib (const Atom *at) const
| returns our contribution to the explicit valence of an Atom More...
double | getValenceContrib (ATOM_SPTR at) const
void | setIsAromatic (bool what)
| sets our `isAromatic` flag More...
bool | getIsAromatic () const
| returns the status of our `isAromatic` flag More...
void | setIsConjugated (bool what)
| sets our `isConjugated` flag More...
bool | getIsConjugated () const
| returns the status of our `isConjugated` flag More...
ROMol & | getOwningMol () const
| returns a reference to the ROMol that owns this Bond More...
void | setOwningMol (ROMol *other)
| sets our owning molecule More...
void | setOwningMol (ROMol &other)
| sets our owning molecule More...
unsigned int | getIdx () const
| returns our index within the ROMol More...
void | setIdx (unsigned int index)
| sets our index within the ROMol More...
unsigned int | getBeginAtomIdx () const
| returns the index of our begin Atom More...
unsigned int | getEndAtomIdx () const
| returns the index of our end Atom More...
unsigned int | getOtherAtomIdx (unsigned int thisIdx) const
| given the index of one Atom, returns the index of the other More...
void | setBeginAtomIdx (unsigned int what)
| sets the index of our begin Atom More...
void | setEndAtomIdx (unsigned int what)
| sets the index of our end Atom More...
void | setBeginAtom (Atom *at)
| sets our begin Atom More...
void | setBeginAtom (ATOM_SPTR at)
void | setEndAtom (Atom *at)
| sets our end Atom More...
void | setEndAtom (ATOM_SPTR at)
Atom * | getBeginAtom () const
| returns a pointer to our begin Atom More...
Atom * | getEndAtom () const
| returns a pointer to our end Atom More...
Atom * | getOtherAtom (Atom const *what) const
| returns a pointer to the other Atom More...
void | setBondDir (BondDir what)
| sets our direction More...
BondDir | getBondDir () const
| returns our direction More...
void | setStereo (BondStereo what)
| sets our stereo code More...
BondStereo | getStereo () const
| returns our stereo code More...
void | setStereoAtoms (unsigned int bgnIdx, unsigned int endIdx)
| sets the atoms to be considered as reference points for bond stereo More...
const INT_VECT & | getStereoAtoms () const
| returns the indices of our stereo atoms More...
INT_VECT & | getStereoAtoms ()
void | updatePropertyCache (bool strict=true)
| calculates any of our lazy `properties` More...
Public Member Functions inherited from RDKit::RDProps
| RDProps ()
| RDProps (const RDProps &rhs)
RDProps & | operator= (const RDProps &rhs)
void | clear ()
const Dict & | getDict () const
| gets the underlying Dictionary More...
Dict & | getDict ()
STR_VECT | getPropList (bool includePrivate=true, bool includeComputed=true) const
| returns a list with the names of our `properties` More...
template<typename T >
void | setProp (const std::string &key, T val, bool computed=false) const
| sets a `property` value More...
template<typename T >
void | getProp (const std::string &key, T &res) const
| allows retrieval of a particular property value More...
template<typename T >
T | getProp (const std::string &key) const
template<typename T >
bool | getPropIfPresent (const std::string &key, T &res) const
bool | hasProp (const std::string &key) const
void | clearProp (const std::string &key) const
| clears the value of a `property` More...
void | clearComputedProps () const
| clears all of our `computed` `properties` More...
void | updateProps (const RDProps &source, bool preserveExisting=false)
| update the properties from another More...

## Protected Attributes
QUERYBOND_QUERY * | dp_query
Protected Attributes inherited from RDKit::Bond
bool | df_isAromatic
| sets our owning molecule More...
bool | df_isConjugated
boost::uint8_t | d_bondType
boost::uint8_t | d_dirTag
boost::uint8_t | d_stereo
atomindex_t | d_index
atomindex_t | d_beginAtomIdx
atomindex_t | d_endAtomIdx
ROMol * | dp_mol
INT_VECT * | dp_stereoAtoms
Protected Attributes inherited from RDKit::RDProps
Dict | dp_props

## Additional Inherited Members
Protected Member Functions inherited from RDKit::Bond
void | initBond ()

## Detailed Description

Class for storing Bond queries.

QueryBond objects are derived from Bond objects, so they can be added to molecules and the like, but they have much fancier querying capabilities.

Definition at line 27 of file QueryBond.h.

## Member Typedef Documentation

typedef Queries::Query<int, Bond const *, true> RDKit::QueryBond::QUERYBOND_QUERY

Definition at line 29 of file QueryBond.h.

## Constructor & Destructor Documentation

RDKit::QueryBond::QueryBond | ( |  | ) |
| inline

Definition at line 31 of file QueryBond.h.

RDKit::QueryBond::QueryBond | ( | BondType | bT | ) |
| explicit

initialize with a particular bond order

RDKit::QueryBond::QueryBond | ( | const Bond & | other | ) |
| inlineexplicit

initialize from a bond

Definition at line 35 of file QueryBond.h.

RDKit::QueryBond::QueryBond | ( | const QueryBond & | other | ) |
| inline

Definition at line 37 of file QueryBond.h.

References copy(), Match(), operator=(), QueryMatch(), setBondDir(), setBondType(), and ~QueryBond().

RDKit::QueryBond::~QueryBond | ( |  | ) |

Referenced by QueryBond().

## Member Function Documentation

virtual Bond* RDKit::QueryBond::copy | ( |  | ) | const
| virtual

returns a copy of this query, owned by the caller

Reimplemented from RDKit::Bond.

Referenced by QueryBond().

void RDKit::QueryBond::expandQuery | ( | QUERYBOND_QUERY * | what,
|  | Queries::CompositeQueryType | how = `Queries::COMPOSITE_AND`,
|  | bool | maintainOrder = `true`
| ) |  |
| virtual

expands our current query

Parameters

  what | the Queries::Query to be added
  how | the operator to be used in the expansion
  maintainOrder | (optional) flags whether the relative order of the queries needs to be maintained, if this is false, the order is reversed

Notes:

- `what` should probably be constructed using one of the functions defined in QueryOps.h
- the `maintainOrder` option can be useful because the combination operators short circuit when possible.

Reimplemented from RDKit::Bond.

Referenced by setQuery().

QUERYBOND_QUERY* RDKit::QueryBond::getQuery | ( |  | ) | const
| inlinevirtual

returns our current query

Reimplemented from RDKit::Bond.

Definition at line 64 of file QueryBond.h.

References dp_query.

bool RDKit::QueryBond::hasQuery | ( |  | ) | const
| inlinevirtual

Reimplemented from RDKit::Bond.

Definition at line 61 of file QueryBond.h.

References dp_query.

bool RDKit::QueryBond::Match | ( | const Bond::BOND_SPTR | what | ) | const
| virtual

returns true if we match Bond `what`

Reimplemented from RDKit::Bond.

Referenced by QueryBond().

bool RDKit::QueryBond::Match | ( | Bond const * | what | ) | const
| virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from RDKit::Bond.

QueryBond& RDKit::QueryBond::operator= | ( | const QueryBond & | other | ) |

Referenced by QueryBond().

bool RDKit::QueryBond::QueryMatch | ( | QueryBond const * | what | ) | const

returns true if our query details match those of QueryBond `what`

Referenced by QueryBond().

void RDKit::QueryBond::setBondDir | ( | BondDir | bD | ) |

sets the BondDir of this query:

Referenced by QueryBond().

void RDKit::QueryBond::setBondType | ( | BondType | bT | ) |

sets the BondType of this query:

Referenced by QueryBond().

void RDKit::QueryBond::setQuery | ( | QUERYBOND_QUERY * | what | ) |
| inlinevirtual

replaces our current query with the value passed in

Reimplemented from RDKit::Bond.

Definition at line 66 of file QueryBond.h.

References Queries::COMPOSITE_AND, dp_query, and expandQuery().

## Member Data Documentation

QUERYBOND_QUERY* RDKit::QueryBond::dp_query
| protected

Definition at line 92 of file QueryBond.h.

Referenced by getQuery(), hasQuery(), and setQuery().

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

- QueryBond.h