Public Member Functions

OBMolRingIter Class Reference

Iterate over all rings in an OBMol. More...

#include <openbabel/obiter.h>

List of all members.

Public Member Functions

 OBMolRingIter ()
 OBMolRingIter (OBMol *mol)
 OBMolRingIter (OBMol &mol)
 OBMolRingIter (const OBMolRingIter &ri)
 ~OBMolRingIter ()
OBMolRingIteroperator= (const OBMolRingIter &ri)
 operator bool () const
OBMolRingIteroperator++ ()
OBMolRingIter operator++ (int)
OBRingoperator-> () const
OBRingoperator* () 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 )

Here is an example:

      #include <openbabel/obiter.h>
      #include <openbabel/mol.h>

      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

      }

Constructor & Destructor Documentation

OBMolRingIter (  ) [inline]
OBMolRingIter ( OBMol mol )
OBMolRingIter ( OBMol mol )
OBMolRingIter ( const OBMolRingIter ri )
~OBMolRingIter (  ) [inline]

Member Function Documentation

OBMolRingIter & operator= ( const OBMolRingIter ri )
operator bool (  ) const [inline]
Returns:
Whether the iterator can advance (i.e., there are more rings)
OBMolRingIter & operator++ (  )

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

Referenced by OBMolRingIter::operator++().

OBMolRingIter operator++ ( int   )

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

OBRing* operator-> (  ) const [inline]
Returns:
A pointer to the current ring (if any)
OBRing& operator* (  ) const [inline]
Returns:
A reference to the current ring (if any)

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines