Open Babel  3.0
Public Member Functions | List of all members
TautomerFunctor Class Referenceabstract

#include <tautomer.h>

Public Member Functions

virtual ~TautomerFunctor ()
 
virtual void operator() (OBMol *mol)=0
 

Detailed Description

Functor for tautomer enumeration algorithm. Subclass this class to write your own functor.

Example to write all tautomer smiles to std::cout:

class WriteSmilesFunctor : public TautomerFunctor
{
public:
WriteSmilesFunctor() : foundTautomer(false)
{
m_conv.SetOutFormat("can");
}
void operator()(OBMol *mol)
{
foundTautomer = true;
std::cout << m_conv.WriteString(mol);
}
bool foundTautomer;
private:
OBConversion m_conv;
};

This functor can be used in the following way:

OBMol mol;
...
WriteSmilesFunctor functor;
// write all tautomers to std::cout
EnumerateTautomers(mol, functor);
// write the original smiles if there are no tautomers found
if (!functor.foundTautomers) {
OBConversion conv;
conv.SetOutFormat("can");
std::cout << conv.WriteString(&mol);
}

Constructor & Destructor Documentation

◆ ~TautomerFunctor()

virtual ~TautomerFunctor ( )
inlinevirtual

Member Function Documentation

◆ operator()()

virtual void operator() ( OBMol mol)
pure virtual

This function is called every time a tautomer is discovered.


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