#include <openbabel/obiter.h>
Public Member Functions | |
OBResidueAtomIter () | |
OBResidueAtomIter (OBResidue *res) | |
OBResidueAtomIter (OBResidue &res) | |
OBResidueAtomIter (const OBResidueAtomIter &ri) | |
~OBResidueAtomIter () | |
OBResidueAtomIter & | operator= (const OBResidueAtomIter &ri) |
operator bool () const | |
OBResidueAtomIter & | operator++ () |
OBResidueAtomIter | operator++ (int) |
OBAtom * | operator-> () const |
OBAtom & | operator * () const |
To facilitate iteration through all atoms in a residue, without resorting to atom 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_ATOMS_OF_RESIDUE(a,r) for( OBResidueAtomIter a(r); a; ++a )
Here is an example:
#include <openbabel/obiter.h> #include <openbabel/mol.h> OBMol mol; double residueMass = 0.0; FOR_RESIDUES_OF_MOL(r, mol) { // The variable r behaves like OBResidue* when used with -> and * but // but needs to be explicitly converted when appearing as a parameter // in a function call - use &*r if (r->GetName() == resname && r->GetNum() == rnum) { FOR_ATOMS_OF_RESIDUE(a, &*r) { residueMass += a->GetMass(); } } }
OBResidueAtomIter | ( | ) | [inline] |
OBResidueAtomIter | ( | OBResidue * | res | ) |
OBResidueAtomIter | ( | OBResidue & | res | ) |
OBResidueAtomIter | ( | const OBResidueAtomIter & | ri | ) |
~OBResidueAtomIter | ( | ) | [inline] |
OBResidueAtomIter & operator= | ( | const OBResidueAtomIter & | ri | ) |
operator bool | ( | ) | const [inline] |
OBResidueAtomIter & operator++ | ( | ) |
Preincrement -- advance to the next atom (if any) and return.
OBResidueAtomIter operator++ | ( | int | ) |
Postincrement -- return the current state and advance to the next atom (if any).
OBAtom* operator-> | ( | ) | const [inline] |
OBAtom& operator * | ( | ) | const [inline] |