Loading...
Searching...
No Matches
OBResidueIter Class Reference

`#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

## Detailed Description

Iterate over all residues in an OBMol.

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 )
OpenBabel::OBResidueIter::OBResidueIter
OBResidueIter()
Definition obiter.h:248
FOR_RESIDUES_OF_MOL
#define FOR_RESIDUES_OF_MOL(r, m)
Definition obiter.h:402

Here is an example:

#include <openbabel/obiter.h>
#include <openbabel/mol.h>
OpenBabel::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
...
}
}
OpenBabel::OBMol
Molecule Class.
Definition mol.h:121
mol.h
Handle molecules. Declarations of OBMol, OBAtom, OBBond, OBResidue. (the main header for Open Babel).
obiter.h
STL-style iterators for Open Babel.

## Constructor & Destructor Documentation

## OBResidueIter() [1/4]

OBResidueIter | ( |  | ) |

inline

Referenced by OBResidueIter(), operator++(), operator++(), and operator=().

## OBResidueIter() [2/4]

OBResidueIter | ( | OBMol * | mol | ) |

## OBResidueIter() [3/4]

OBResidueIter | ( | OBMol & | mol | ) |

## OBResidueIter() [4/4]

OBResidueIter | ( | const OBResidueIter & | ri | ) |

## ~OBResidueIter()

~OBResidueIter | ( |  | ) |

inline

## Member Function Documentation

## operator=()

OBResidueIter & operator= | ( | const OBResidueIter & | ri | ) |

## operator bool()

operator bool | ( |  | ) | const

inline

Returns
  Whether the iterator can still advance (i.e., visit more residues)

## operator++() [1/2]

OBResidueIter & operator++ | ( |  | ) |

Preincrement – advance to the next residue and return.

Referenced by operator++().

## operator++() [2/2]

OBResidueIter operator++ | ( | int |  | ) |

Postincrement – return the current state and advance to the next residue.

## operator->()

OBResidue * operator-> | ( |  | ) | const

inline

Returns
  a pointer to the current residue

## operator*()

OBResidue & operator* | ( |  | ) | const

inline

Returns
  a reference to the current residue

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

- obiter.h
- obiter.cpp