#include <openbabel/obiter.h>
Public Member Functions | |
| OBAtomBondIter () | |
| OBAtomBondIter (OBAtom *atm) | |
| OBAtomBondIter (OBAtom &atm) | |
| OBAtomBondIter (const OBAtomBondIter &bi) | |
| ~OBAtomBondIter () | |
| OBAtomBondIter & | operator= (const OBAtomBondIter &bi) |
| operator bool () const | |
| OBAtomBondIter & | operator++ () |
| OBAtomBondIter | operator++ (int) |
| OBBond * | operator-> () const |
| OBBond & | operator * () const |
To facilitate iteration through all bonds on an atom, without resorting to bond indexes (which may change in the future) a variety of iterator classes and methods are provided.
This has been made significantly easier by a series of macros in the obiter.h header file:
\#define FOR_BONDS_OF_ATOM(b,p) for( OBAtomBondIter b(p); b; ++b )
Here is an example:
#include <openbabel/obiter.h> #include <openbabel/mol.h> OBAtom atom; unsigned int tripleBondCount; FOR_BONDS_OF_ATOM(b, atom) { // The variable b behaves like OBBond* when used with -> and * but // but needs to be explicitly converted when appearing as a parameter // in a function call - use &*b if (b->GetBO() == 3) tripleBondCount++; }
| OBAtomBondIter | ( | ) | [inline] |
| OBAtomBondIter | ( | OBAtom * | atm | ) |
| OBAtomBondIter | ( | OBAtom & | atm | ) |
| OBAtomBondIter | ( | const OBAtomBondIter & | bi | ) |
| ~OBAtomBondIter | ( | ) | [inline] |
| OBAtomBondIter & operator= | ( | const OBAtomBondIter & | bi | ) |
| operator bool | ( | ) | const [inline] |
| OBAtomBondIter & operator++ | ( | ) |
Preincrement -- advance to the next bond and return.
| OBAtomBondIter operator++ | ( | int | ) |
Postincrement -- return the current state and advance to the next bond.
| OBBond* operator-> | ( | ) | const [inline] |
| OBBond& operator * | ( | ) | const [inline] |