OEChem also provides a mechanism for reusing an OEMolBase
. For
example, when processing multiple sequentially molecules in a database,
instead of requiring a new molecule to be allocated and destroyed for each
entry, the OEMolBase::Clear
method can be used to reset a molecule
to its initial (empty) state.
The following program demonstrates calling the Clear()
method of
our molecule. Note that the Clear()
in the example below is not
required as the molecule is already initialized by the implicit constructor.
The code below does demonstrate that the OEMol
behaves like an
OEMolBase
allowing it to be used with any of OEChem's
OEMolBase
methods or functions.
#include "oechem.h" using namespace OEChem; int main() { OEMol mol; mol.Clear(); return 0; }