Subsections

 
5.2 Functor API

typedef OESystem::OEUnaryFunction<OEChem::OEMolBase,bool,true,false>
                                                      OEMolFunctionBase;

class OETyperMolFunction : public OEMolFunctionBase
{
public:
  OETyperMolFunction(OEChem::oemolostream &ofp, bool arom,
                      bool ct=false, unsigned int max = 0);
  void Reset();
  bool operator () (const OEChem::OEMolBase &inmol);
  base_type *CreateCopy() const;
};

class OETautomerMolFunction : public OEMolFunctionBase
{
public:
  OETautomerMolFunction(OEChem::oemolostream &ofp, bool arom,
                      bool ct=false, unsigned int max = 0, bool mostAro = false);
  unsigned int GetCount() const;
  const OEChem::OEMolBase& GetMolecule() const;
  void Reset();
  bool operator () (const OEChem::OEMolBase &inmol);
  base_type *CreateCopy() const;
};

 
5.2.1 OEMolFunctionBase

This is a simple typedef of a specific type of OEUnaryFunction. The first two template arguments indicate that an OEMolFunctionBase will have an operator() that takes an OEChem::OEMolBase as an argument and will return boolean value. The final two template arguments indicate that the OEChem::OEMolBase argument will be const but that the operator() function will not be const respectively. For more information on OEUnaryFunctions, please see the OESystem documentation.

 
5.2.2 OETyperMolFunction and OETautomerMolFunction

Currently these two example OEMolFunctionBases are similar, however it is expected that they will diverge more over time. They share the same first four arguments. The first argument is the oemolstream where the enumerated molecules will be placed. The second argument is a boolean indicating whether aromaticity should be calculated for the enumerated structure. The third argument is a boolean indicating whether the enumerated states should only be counted (rather than actually listed). The fourth argument is an unsigned int indicating the maximum number of states that should be enumerated for any single input molecule. The final argument for OETautomerMolFunction states whether a '-reasonable' type calculation is being setup and only the most aromatic tautomer should be stored. After the calculation, the most aromatic tautomer can be retrieved using GetMolecule. When using the same OETautomerMolFunction for multiple tautomer runs, remember to call Reset in between each one.

Each class has a Reset() function that can be called to reset the output counter.