Open Babel  3.0
Public Member Functions | List of all members
OBMolAngleIter Class Reference

#include <openbabel/obiter.h>

Public Member Functions

 OBMolAngleIter ()
 
 OBMolAngleIter (OBMol *mol)
 
 OBMolAngleIter (OBMol &mol)
 
 OBMolAngleIter (const OBMolAngleIter &ai)
 
 ~OBMolAngleIter ()
 
OBMolAngleIteroperator= (const OBMolAngleIter &ai)
 
 operator bool () const
 
OBMolAngleIteroperator++ ()
 
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++ )

Here is an example:

#include <openbabel/mol.h>
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());
}

Constructor & Destructor Documentation

◆ OBMolAngleIter() [1/4]

OBMolAngleIter ( )
inline

◆ 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: