Loading...
Searching...
No Matches
OBMolAngleIter Class Reference

`#include <openbabel/obiter.h>`

## Public Member Functions

| OBMolAngleIter ()
| OBMolAngleIter (OBMol *mol)
| OBMolAngleIter (OBMol &mol)
| OBMolAngleIter (const OBMolAngleIter &ai)
| ~OBMolAngleIter ()
OBMolAngleIter & | operator= (const OBMolAngleIter &ai)
| operator bool () const
OBMolAngleIter & | operator++ ()
std::vector< unsigned int > | operator* () const

## Detailed Description

Iterate over all angles in an OBMol.

Since
  version 2.1

To facilitate iteration through all angles in a molecule, without resorting to atom indexes (which will change in the future), a variety of iterator methods are provided.

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

\#define FOR_ANGLES_OF_MOL(a,m) for( OBMolAngleIter a(m); a; a++ )
OpenBabel::OBMolAngleIter::OBMolAngleIter
OBMolAngleIter()
Definition obiter.h:301
FOR_ANGLES_OF_MOL
#define FOR_ANGLES_OF_MOL(a, m)
Definition obiter.h:408

Here is an example:

#include <openbabel/obiter.h>
#include <openbabel/mol.h>
OpenBabel::OBMol mol;
OpenBabel::OBAtom *a, *b, *c;
double ang;
FOR_ANGLES_OF_MOL(angle, mol)
{
// The variable a behaves like OBAngle* when used with -> and * but
// but needs to be explicitly converted when appearing as a parameter
// in a function call - use &*a
b = _mol.GetAtom((*angle)[0] + 1);
a = _mol.GetAtom((*angle)[1] + 1);
c = _mol.GetAtom((*angle)[2] + 1);
ang = a->GetAngle(b->GetIdx(), c->GetIdx());
}
OpenBabel::OBAtom
Atom class.
Definition atom.h:72
OpenBabel::OBAtom::GetAngle
double GetAngle(int b, int c)
Definition atom.cpp:1151
OpenBabel::OBAtom::GetIdx
unsigned int GetIdx() const
Definition atom.h:189
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

## OBMolAngleIter() [1/4]

OBMolAngleIter | ( |  | ) |

inline

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

## OBMolAngleIter() [2/4]

OBMolAngleIter | ( | OBMol * | mol | ) |

## OBMolAngleIter() [3/4]

OBMolAngleIter | ( | OBMol & | mol | ) |

## OBMolAngleIter() [4/4]

OBMolAngleIter | ( | const OBMolAngleIter & | ai | ) |

## ~OBMolAngleIter()

~OBMolAngleIter | ( |  | ) |

inline

## Member Function Documentation

## operator=()

OBMolAngleIter & operator= | ( | const OBMolAngleIter & | ai | ) |

## operator bool()

operator bool | ( |  | ) | const

inline

Returns
  Whether the iterator can still advance (i.e., visit more angles)

## operator++()

OBMolAngleIter & operator++ | ( |  | ) |

Preincrement – advance to the next angle and return.

## operator*()

std::vector< unsigned int > operator* | ( |  | ) | const

inline

Returns
  A vector of three atom indexes specifying the angle

See also
  OBAtom::GetIdx()

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

- obiter.h
- obiter.cpp