OBAtomBondIter Class Reference

Iterate over all bonds on an OBAtom. More...

#include <obiter.h>

List of all members.

Public Member Functions

 OBAtomBondIter ()
 OBAtomBondIter (OBAtom *atm)
 OBAtomBondIter (OBAtom &atm)
 OBAtomBondIter (const OBAtomBondIter &bi)
OBAtomBondIter & operator= (const OBAtomBondIter &bi)
 operator bool () const
OBAtomBondIter operator++ (int)
OBBond * operator-> () const
OBBond & operator * () const


Detailed Description

Iterate over all bonds on an OBAtom.

To facilitate iteration through all bonds on an atom, without resorting to bond indexes (which may change in the future) or the OBAtom::BeginBond() and OBAtom::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_ATOM(b,p)     for( OBAtomBondIter     b(p); b; b++ )

Here is an example:

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

   OBAtom atom;
   unsigned int tripleBondCount;
   FOR_BONDS_OF_ATOM(b, atom)
   {
  // 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
      if (b->GetBO() == 3)
         tripleBondCount++;
   }


Constructor & Destructor Documentation

OBAtomBondIter (  )  [inline]

OBAtomBondIter ( OBAtom *  atm  ) 

OBAtomBondIter ( OBAtom &  atm  ) 

OBAtomBondIter ( const OBAtomBondIter &  bi  ) 


Member Function Documentation

OBAtomBondIter & operator= ( const OBAtomBondIter &  bi  ) 

operator bool (  )  const [inline]

OBAtomBondIter operator++ ( int   ) 

OBBond* operator-> (  )  const [inline]

OBBond& operator * (  )  const [inline]


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