Open Babel  3.0
Public Member Functions | List of all members
OBResidueAtomIter Class Reference

#include <openbabel/obiter.h>

Public Member Functions

 OBResidueAtomIter ()
 
 OBResidueAtomIter (OBResidue *res)
 
 OBResidueAtomIter (OBResidue &res)
 
 OBResidueAtomIter (const OBResidueAtomIter &ri)
 
 ~OBResidueAtomIter ()
 
OBResidueAtomIteroperator= (const OBResidueAtomIter &ri)
 
 operator bool () const
 
OBResidueAtomIteroperator++ ()
 
OBResidueAtomIter operator++ (int)
 
OBAtomoperator-> () const
 
OBAtomoperator* () const
 

Detailed Description

Iterate over all atoms in an OBResidue.

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/mol.h>
double residueMass = 0.0;
{
// 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)
{
{
residueMass += a->GetMass();
}
}
}

Constructor & Destructor Documentation

◆ OBResidueAtomIter() [1/4]

OBResidueAtomIter ( )
inline

◆ OBResidueAtomIter() [2/4]

◆ OBResidueAtomIter() [3/4]

◆ OBResidueAtomIter() [4/4]

◆ ~OBResidueAtomIter()

~OBResidueAtomIter ( )
inline

Member Function Documentation

◆ operator=()

OBResidueAtomIter & operator= ( const OBResidueAtomIter ri)

◆ operator bool()

operator bool ( ) const
inline
Returns
Whether the iterator can still advance (i.e., visit more atoms in this residue)

◆ operator++() [1/2]

OBResidueAtomIter & operator++ ( )

Preincrement – advance to the next atom (if any) and return.

Referenced by OBResidueAtomIter::operator++().

◆ operator++() [2/2]

OBResidueAtomIter operator++ ( int  )

Postincrement – return the current state and advance to the next atom (if any)

◆ operator->()

OBAtom* operator-> ( ) const
inline
Returns
a pointer to the current atom

◆ operator*()

OBAtom& operator* ( ) const
inline
Returns
a reference to the current atom

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