#include <openbabel/obiter.h>
Public Member Functions | |
| OBMolBondBFSIter () | |
| OBMolBondBFSIter (OBMol *mol, int StartIndex=0) | |
| OBMolBondBFSIter (OBMol &mol, int StartIndex=0) | |
| OBMolBondBFSIter (const OBMolBondBFSIter &ai) | |
| ~OBMolBondBFSIter () | |
| OBMolBondBFSIter & | operator= (const OBMolBondBFSIter &ai) |
| operator bool () const | |
| OBMolBondBFSIter & | operator++ () |
| OBMolBondBFSIter | operator++ (int) |
| OBBond * | operator-> () const |
| OBBond & | operator* () const |
| int | CurrentDepth () const |
Iterate over all bonds in an OBMol in a breadth-first search (BFS)
To facilitate iteration through all bonds in a molecule, without resorting to bond indexes (which will change in the future), a variety of iterator methods are provided.
This class provides a breadth-first search ordering of bonds. When one connected component is exhausted, the iterator will start at another until all bonds 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_BONDBFS_OF_MOL(a,m) for( OBMolBondBFSIter a(m); a; ++a )
Here is an example:
#include <openbabel/obiter.h> #include <openbabel/mol.h> OBMol mol; FOR_BONDBFS_OF_MOL(b, mol) { // 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 &*a }
| OBMolBondBFSIter | ( | ) | [inline] |
| OBMolBondBFSIter | ( | OBMol * | mol, |
| int | StartIndex = 0 |
||
| ) |
| OBMolBondBFSIter | ( | OBMol & | mol, |
| int | StartIndex = 0 |
||
| ) |
| OBMolBondBFSIter | ( | const OBMolBondBFSIter & | ai | ) |
| ~OBMolBondBFSIter | ( | ) | [inline] |
| OBMolBondBFSIter & operator= | ( | const OBMolBondBFSIter & | ai | ) |
| operator bool | ( | ) | const [inline] |
| OBMolBondBFSIter & operator++ | ( | ) |
Preincrement -- advance to the next atom in the BFS list and return.
Referenced by OBMolBondBFSIter::operator++().
| OBMolBondBFSIter operator++ | ( | int | ) |
Postincrement -- return the current atom and advance to the next atom.
| OBBond* operator-> | ( | ) | const [inline] |
| OBBond& operator* | ( | ) | const [inline] |
| int CurrentDepth | ( | ) | const |