#include <obiter.h>
Public Member Functions | |
OBResidueAtomIter () | |
OBResidueAtomIter (OBResidue *res) | |
OBResidueAtomIter (OBResidue &res) | |
OBResidueAtomIter (const OBResidueAtomIter &ri) | |
OBResidueAtomIter & | operator= (const OBResidueAtomIter &ri) |
operator bool () const | |
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) or the OBResidue::BeginAtom() and OBResidue::NextAtom() methods which may be deprecated in the future.
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 "obiter.h" #include "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 & operator= | ( | const OBResidueAtomIter & | ri | ) |
operator bool | ( | ) | const [inline] |
OBResidueAtomIter operator++ | ( | int | ) |
OBAtom* operator-> | ( | ) | const [inline] |
OBAtom& operator * | ( | ) | const [inline] |