Open Babel
3.0
|
#include <openbabel/obiter.h>
Public Member Functions | |
OBMolAtomBFSIter () | |
OBMolAtomBFSIter (OBMol *mol, int StartIndex=1) | |
OBMolAtomBFSIter (OBMol &mol, int StartIndex=1) | |
OBMolAtomBFSIter (const OBMolAtomBFSIter &ai) | |
~OBMolAtomBFSIter () | |
OBMolAtomBFSIter & | operator= (const OBMolAtomBFSIter &ai) |
operator bool () const | |
OBMolAtomBFSIter & | operator++ () |
OBMolAtomBFSIter | operator++ (int) |
OBAtom * | operator-> () const |
OBAtom & | operator* () const |
int | CurrentDepth () const |
Iterate over all atoms in an OBMol in a breadth-first search (BFS)
To facilitate iteration through all atoms in a molecule, without resorting to atom indexes (which will change in the future), a variety of iterator methods are provided.
This class provides a breadth-first search ordering of atoms. When one connected component is exhausted, the iterator will start at another until all atoms are visited. No guarantee is made as to the ordering of iteration through connected components.
The iterator maintains an internal queue and list of visited atoms. As such it may not be appropriate for memory-constrained situations when iterating through large molecules.
Use of this iterator has been made significantly easier by a series of macros in the obiter.h header file:
Here is an example:
|
inline |
OBMolAtomBFSIter | ( | OBMol * | mol, |
int | StartIndex = 1 |
||
) |
OBMolAtomBFSIter | ( | OBMol & | mol, |
int | StartIndex = 1 |
||
) |
OBMolAtomBFSIter | ( | const OBMolAtomBFSIter & | ai | ) |
|
inline |
OBMolAtomBFSIter & operator= | ( | const OBMolAtomBFSIter & | ai | ) |
|
inline |
OBMolAtomBFSIter & operator++ | ( | ) |
Preincrement – advance to the next atom in the BFS list and return.
Referenced by OBMolAtomBFSIter::operator++().
OBMolAtomBFSIter operator++ | ( | int | ) |
Postincrement – return the current atom and advance to the next atom.
|
inline |
|
inline |
int CurrentDepth | ( | ) | const |