Loading...
Searching...
No Matches
OBMolRingIter Class Reference

`#include <openbabel/obiter.h>`

## Public Member Functions

| OBMolRingIter ()
| OBMolRingIter (OBMol *mol)
| OBMolRingIter (OBMol &mol)
| OBMolRingIter (const OBMolRingIter &ri)
| ~OBMolRingIter ()
OBMolRingIter & | operator= (const OBMolRingIter &ri)
| operator bool () const
OBMolRingIter & | operator++ ()
OBMolRingIter | operator++ (int)
OBRing * | operator-> () const
OBRing & | operator* () const

## Detailed Description

Iterate over all rings in an OBMol.

Since
  version 2.1

To facilitate iteration through all rings in a molecule, without resorting to ring indexes (which may change in the future) a variety of iterator classes and methods are provided. One word of warning is that these iterator methods automatically call OBMol::FindSSSR() which may involve a significant performance hit on large molecules.

Calling iterator classes has been made significantly easier by a series of macros in the obiter.h header file:

\#define FOR_RINGS_OF_MOL(r,m) for( OBMolRingIter r(m); r; ++r )
OpenBabel::OBMolRingIter::OBMolRingIter
OBMolRingIter()
Definition obiter.h:379
FOR_RINGS_OF_MOL
#define FOR_RINGS_OF_MOL(r, m)
Definition obiter.h:407

Here is an example:

#include <openbabel/obiter.h>
#include <openbabel/mol.h>
OpenBabel::OBMol mol;
FOR_RINGS_OF_MOL(r, mol)
{
// The variable r behaves like OBRing* when used with -> and * but
// but needs to be explicitly converted when appearing as a parameter
// in a function call - use &*r
}
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.

## Constructor & Destructor Documentation

## OBMolRingIter() [1/4]

OBMolRingIter | ( |  | ) |

inline

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

## OBMolRingIter() [2/4]

OBMolRingIter | ( | OBMol * | mol | ) |

## OBMolRingIter() [3/4]

OBMolRingIter | ( | OBMol & | mol | ) |

## OBMolRingIter() [4/4]

OBMolRingIter | ( | const OBMolRingIter & | ri | ) |

## ~OBMolRingIter()

~OBMolRingIter | ( |  | ) |

inline

## Member Function Documentation

## operator=()

OBMolRingIter & operator= | ( | const OBMolRingIter & | ri | ) |

## operator bool()

operator bool | ( |  | ) | const

inline

Returns
  Whether the iterator can advance (i.e., there are more rings)

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

OBMolRingIter & operator++ | ( |  | ) |

Preincrement – advance to the next ring (if any) and return.

Referenced by operator++().

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

OBMolRingIter operator++ | ( | int |  | ) |

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

## operator->()

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

inline

Returns
  A pointer to the current ring (if any)

## operator*()

OBRing & operator* | ( |  | ) | const

inline

Returns
  A reference to the current ring (if any)

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

- obiter.h
- obiter.cpp