Loading...
Searching...
No Matches
OBAtomAtomIter Class Reference

`#include <openbabel/obiter.h>`

## Public Member Functions

| OBAtomAtomIter ()
| OBAtomAtomIter (OBAtom *atm)
| OBAtomAtomIter (OBAtom &atm)
| OBAtomAtomIter (const OBAtomAtomIter &ai)
| ~OBAtomAtomIter ()
OBAtomAtomIter & | operator= (const OBAtomAtomIter &ai)
| operator bool () const
OBAtomAtomIter & | operator++ ()
OBAtomAtomIter | operator++ (int)
OBAtom * | operator-> () const
OBAtom & | operator* () const

## Detailed Description

Iterate over all neighboring atoms to an OBAtom.

To facilitate iteration through all neighbors of 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_NBORS_OF_ATOM(a,p) for( OBAtomAtomIter a(p); a; ++a )
OpenBabel::OBAtomAtomIter::OBAtomAtomIter
OBAtomAtomIter()
Definition obiter.h:196
FOR_NBORS_OF_ATOM
#define FOR_NBORS_OF_ATOM(a, p)
Definition obiter.h:400

Here is an example:

#include <openbabel/obiter.h>
#include <openbabel/mol.h>
OpenBabel::OBMol mol;
FOR_ATOMS_OF_MOL(a, mol)
{
// The variable a behaves like OBAtom* when used with -> and * but
// but needs to be explicitly converted when appearing as a parameter
// in a function call - use &*a
FOR_NBORS_OF_ATOM(b, &*a)
{
...
}
}
OpenBabel::OBMol
Molecule Class.
Definition mol.h:121
mol.h
Handle molecules. Declarations of OBMol, OBAtom, OBBond, OBResidue. (the main header for Open Babel).
obiter.h
STL-style iterators for Open Babel.
FOR_ATOMS_OF_MOL
#define FOR_ATOMS_OF_MOL(a, m)
Definition obiter.h:398

## Constructor & Destructor Documentation

## OBAtomAtomIter() [1/4]

OBAtomAtomIter | ( |  | ) |

inline

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

## OBAtomAtomIter() [2/4]

OBAtomAtomIter | ( | OBAtom * | atm | ) |

## OBAtomAtomIter() [3/4]

OBAtomAtomIter | ( | OBAtom & | atm | ) |

## OBAtomAtomIter() [4/4]

OBAtomAtomIter | ( | const OBAtomAtomIter & | ai | ) |

## ~OBAtomAtomIter()

~OBAtomAtomIter | ( |  | ) |

inline

## Member Function Documentation

## operator=()

OBAtomAtomIter & operator= | ( | const OBAtomAtomIter & | ai | ) |

## operator bool()

operator bool | ( |  | ) | const

inline

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

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

OBAtomAtomIter & operator++ | ( |  | ) |

Preincrement – advance to the next neighbor and return.

Referenced by operator++().

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

OBAtomAtomIter operator++ | ( | int |  | ) |

Postincrement – return the current neighbor and advance to the next.

## 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:

- obiter.h
- obiter.cpp