#include <openbabel/obiter.h>
Public Member Functions | |
OBResidueIter () | |
OBResidueIter (OBMol *mol) | |
OBResidueIter (OBMol &mol) | |
OBResidueIter (const OBResidueIter &ri) | |
~OBResidueIter () | |
OBResidueIter & | operator= (const OBResidueIter &ri) |
operator bool () const | |
OBResidueIter & | operator++ () |
OBResidueIter | operator++ (int) |
OBResidue * | operator-> () const |
OBResidue & | operator* () const |
To facilitate iteration through all residues in a molecule, without resorting to residue 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_RESIDUES_OF_MOL(r,m) for( OBResidueIter r(m); r; ++r )
Here is an example:
#include <openbabel/obiter.h> #include <openbabel/mol.h> OBMol mol; 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) { // got a match, let's go to work ... } }
OBResidueIter | ( | ) | [inline] |
OBResidueIter | ( | OBMol * | mol | ) |
OBResidueIter | ( | OBMol & | mol | ) |
OBResidueIter | ( | const OBResidueIter & | ri | ) |
~OBResidueIter | ( | ) | [inline] |
OBResidueIter & operator= | ( | const OBResidueIter & | ri | ) |
operator bool | ( | ) | const [inline] |
OBResidueIter & operator++ | ( | ) |
OBResidueIter operator++ | ( | int | ) |
Postincrement -- return the current state and advance to the next residue.
OBResidue* operator-> | ( | ) | const [inline] |
OBResidue& operator* | ( | ) | const [inline] |