OBResidueIter Class Reference

Iterate over all residues in an OBMol. More...

#include <obiter.h>

List of all members.

Public Member Functions

 OBResidueIter ()
 OBResidueIter (OBMol *mol)
 OBResidueIter (OBMol &mol)
 OBResidueIter (const OBResidueIter &ri)
OBResidueIteroperator= (const OBResidueIter &ri)
 operator bool () const
OBResidueIter operator++ (int)
OBResidueoperator-> () const
OBResidueoperator * () 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) or the OBMol::BeginResidue() and OBMol::NextResidue() 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_RESIDUES_OF_MOL(a,m)     for( OBResidueIter     a(m); a; a++ )

Here is an example:

   #include "obiter.h"
   #include "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
       ...
     }
   }


Constructor & Destructor Documentation

OBResidueIter (  )  [inline]

OBResidueIter ( OBMol mol  ) 

OBResidueIter ( OBMol mol  ) 

OBResidueIter ( const OBResidueIter ri  ) 


Member Function Documentation

OBResidueIter & operator= ( const OBResidueIter ri  ) 

operator bool (  )  const [inline]

OBResidueIter operator++ ( int   ) 

OBResidue* operator-> (  )  const [inline]

OBResidue& operator * (  )  const [inline]


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