OBMolBondIter Class Reference

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

#include <obiter.h>

List of all members.

Public Member Functions

 OBMolBondIter ()
 OBMolBondIter (OBMol *mol)
 OBMolBondIter (OBMol &mol)
 OBMolBondIter (const OBMolBondIter &bi)
OBMolBondIteroperator= (const OBMolBondIter &bi)
 operator bool () const
OBMolBondIter operator++ (int)
OBBondoperator-> () const
OBBondoperator * () const


Detailed Description

Iterate over all bonds in an OBMol.

To facilitate iteration through all bonds in a molecule, without resorting to bond indexes (which may change in the future) or the OBMol::BeginBond() and OBMol::NextBond() 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_BONDS_OF_MOL(b,m)     for( OBMolBondIter     b(m); b; b++ )

Here is an example:

   #include "obiter.h"
   #include "mol.h"

   OBMol mol;
   unsigned int bondOrderSum = 0;
   FOR_BONDS_OF_MOL(b, mol)
   {
  // The variable b behaves like OBBond* when used with -> and * but
  // but needs to be explicitly converted when appearing as a parameter
  // in a function call - use &*b
       bondOrderSum +=  b->GetBO();
   }


Constructor & Destructor Documentation

OBMolBondIter (  )  [inline]

OBMolBondIter ( OBMol mol  ) 

OBMolBondIter ( OBMol mol  ) 

OBMolBondIter ( const OBMolBondIter bi  ) 


Member Function Documentation

OBMolBondIter & operator= ( const OBMolBondIter bi  ) 

operator bool (  )  const [inline]

OBMolBondIter operator++ ( int   ) 

OBBond* operator-> (  )  const [inline]

OBBond& operator * (  )  const [inline]


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