4.156 OEWriteMolecule

void OEWriteMolecule(oemolostream &ofs, OEMCMolBase &mol)
void OEWriteMolecule(oemolostream &ofs, OEQMolBase &mol)
void OEWriteMolecule(oemolostream &ofs, OEMolBase &mol)
void OEWriteMolecule(oemolostream &ofs, OEMol &mol)
void OEWriteMolecule(oemolostream &ofs, OEQMol &mol)
void OEWriteMolecule(oemolostream &ofs, OEGraphMol &mol)

The OEChem OEWriteMolecule function provides a high-level file format writer, for multiple file formats. This function is build on top of OEChem's low-level file format writers, but unlike them, it may modify the molecule by automatically invoking the appropriate perception routines (aromaticity, atom typing, chirality perception, residue perception, etc...) that are required by the selected file format. This greatly simplifies the task of writing molecules to a stream, but may provide less functionality that calling the lower-level functions directly.

This function writes the molecule specified by mol, to the output molstream ofs. This function is synonymous with the « operator of the oemolostream.

The file format written is controlled by the format field of the output molstream, which may be set and retrieved using the methods oemolstreambase::SetFormat and oemolstreambase::GetFormat respectively.

Additionally, the OEWriteMolecule function provides some level of control over the processing applied to a molecule prior to writing using OEChem's file format flavor mechanism. Each output molecule stream maintains an independent ``flavor'' value for each output file format that can be specified by oemolstreambase::SetFormat. These ``flavors'' are unsigned integer values that are the combination of bit patterns specified by the OEOFlavor namespace. The interpretation of each bit in a flavor depends upon the output file format to which it refers, and enables or disables processing associated with writing that output file format.

is an output file format (as specified by the oemolstreambase::SetFormat and oemolstreambase::GetFormat methods), the task Write the specified molecule, mol, to the output molstream