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

#include <openbabel/obiter.h>

Public Member Functions

 OBAtomBondIter ()
 
 OBAtomBondIter (OBAtom *atm)
 
 OBAtomBondIter (OBAtom &atm)
 
 OBAtomBondIter (const OBAtomBondIter &bi)
 
 ~OBAtomBondIter ()
 
OBAtomBondIteroperator= (const OBAtomBondIter &bi)
 
 operator bool () const
 
OBAtomBondIteroperator++ ()
 
OBAtomBondIter operator++ (int)
 
OBBondoperator-> () const
 
OBBondoperator* () const
 

Detailed Description

Iterate over all bonds on an OBAtom.

To facilitate iteration through all bonds on an atom, without resorting to bond indexes (which may change in the future) a variety of iterator classes and methods are provided.

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

\#define FOR_BONDS_OF_ATOM(b,p) for( OBAtomBondIter b(p); b; ++b )

Here is an example:

#include <openbabel/mol.h>
unsigned int tripleBondCount;
{
// 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 &*b
if (b->GetBondOrder() == 3)
tripleBondCount++;
}

Constructor & Destructor Documentation

◆ OBAtomBondIter() [1/4]

OBAtomBondIter ( )
inline

◆ OBAtomBondIter() [2/4]

OBAtomBondIter ( OBAtom atm)

◆ OBAtomBondIter() [3/4]

OBAtomBondIter ( OBAtom atm)

◆ OBAtomBondIter() [4/4]

OBAtomBondIter ( const OBAtomBondIter bi)

◆ ~OBAtomBondIter()

~OBAtomBondIter ( )
inline

Member Function Documentation

◆ operator=()

OBAtomBondIter & operator= ( const OBAtomBondIter bi)

◆ operator bool()

operator bool ( ) const
inline
Returns
Whether the iterator can still advance (i.e., visit more bonds)

◆ operator++() [1/2]

OBAtomBondIter & operator++ ( )

Preincrement – advance to the next bond and return.

◆ operator++() [2/2]

OBAtomBondIter operator++ ( int  )

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

◆ operator->()

OBBond* operator-> ( ) const
inline
Returns
a pointer to the current bond

◆ operator*()

OBBond& operator* ( ) const
inline
Returns
a reference to the current bond

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