Loading...
Searching...
No Matches
OBAtomBondIter Class Reference

`#include <openbabel/obiter.h>`

## Public Member Functions

| OBAtomBondIter ()
| OBAtomBondIter (OBAtom *atm)
| OBAtomBondIter (OBAtom &atm)
| OBAtomBondIter (const OBAtomBondIter &bi)
| ~OBAtomBondIter ()
OBAtomBondIter & | operator= (const OBAtomBondIter &bi)
| operator bool () const
OBAtomBondIter & | operator++ ()
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) 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_BONDS_OF_ATOM(b,p) for( OBAtomBondIter b(p); b; ++b )
OpenBabel::OBAtomBondIter::OBAtomBondIter
OBAtomBondIter()
Definition obiter.h:222
FOR_BONDS_OF_ATOM
#define FOR_BONDS_OF_ATOM(b, p)
Definition obiter.h:401

Here is an example:

#include <openbabel/obiter.h>
#include <openbabel/mol.h>
OpenBabel::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->GetBondOrder() == 3)
tripleBondCount++;
}
OpenBabel::OBAtom
Atom class.
Definition atom.h:72
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

## OBAtomBondIter() [1/4]

OBAtomBondIter | ( |  | ) |

inline

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

## OBAtomBondIter() [2/4]

OBAtomBondIter | ( | OBAtom * | atm | ) |

## OBAtomBondIter() [3/4]

OBAtomBondIter | ( | OBAtom & | atm | ) |

## OBAtomBondIter() [4/4]

OBAtomBondIter | ( | const OBAtomBondIter & | bi | ) |

## ~OBAtomBondIter()

~OBAtomBondIter | ( |  | ) |

inline

## Member Function Documentation

## operator=()

OBAtomBondIter & operator= | ( | const OBAtomBondIter & | bi | ) |

## operator bool()

operator bool | ( |  | ) | const

inline

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

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

OBAtomBondIter & operator++ | ( |  | ) |

Preincrement – advance to the next bond and return.

Referenced by operator++().

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

OBAtomBondIter operator++ | ( | int |  | ) |

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

## operator->()

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

inline

Returns
  a pointer to the current bond

## operator*()

OBBond & operator* | ( |  | ) | const

inline

Returns
  a reference to the current bond

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

- obiter.h
- obiter.cpp