#include <openbabel/obiter.h>
Public Member Functions | |
OBMolAtomBFSIter () | |
OBMolAtomBFSIter (OBMol *mol) | |
OBMolAtomBFSIter (OBMol &mol) | |
OBMolAtomBFSIter (const OBMolAtomBFSIter &ai) | |
~OBMolAtomBFSIter () | |
OBMolAtomBFSIter & | operator= (const OBMolAtomBFSIter &ai) |
operator bool () const | |
OBMolAtomBFSIter & | operator++ () |
OBMolAtomBFSIter | operator++ (int) |
OBAtom * | operator-> () const |
OBAtom & | operator * () const |
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:
\#define FOR_BFS_OF_MOL(a,m) for( OBMolAtomBFSIter a(m); a; ++a )
Here is an example:
#include <openbabel/obiter.h> #include <openbabel/mol.h> OBMol mol; FOR_BFS_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 }
OBMolAtomBFSIter | ( | ) | [inline] |
OBMolAtomBFSIter | ( | OBMol * | mol | ) |
OBMolAtomBFSIter | ( | OBMol & | mol | ) |
OBMolAtomBFSIter | ( | const OBMolAtomBFSIter & | ai | ) |
~OBMolAtomBFSIter | ( | ) | [inline] |
OBMolAtomBFSIter & operator= | ( | const OBMolAtomBFSIter & | ai | ) |
operator bool | ( | ) | const [inline] |
OBMolAtomBFSIter & operator++ | ( | ) |
Preincrement -- advance to the next atom in the BFS list and return.
OBMolAtomBFSIter operator++ | ( | int | ) |
Postincrement -- return the current atom and advance to the next atom.
OBAtom* operator-> | ( | ) | const [inline] |
OBAtom& operator * | ( | ) | const [inline] |