OEWriteConstMolecule

unsigned OEWriteConstMolecule(oemolostream &ofs, const OEGraphMol &mol)
unsigned OEWriteConstMolecule(oemolostream &ofs, const OEMol &mol)
unsigned OEWriteConstMolecule(oemolostream &ofs, const OEQMol &mol)

unsigned OEWriteConstMolecule(oemolostream &ofs, const OEMolBase &mol)
unsigned OEWriteConstMolecule(oemolostream &ofs, const OEMCMolBase &mol
unsigned OEWriteConstMolecule(oemolostream &ofs, const OEQMolBase &mol)

These functions provide high-level file format writers for multiple file formats. These functions are built on top of OEChem TK’s low-level file format writers. If needed, these functions will make a copy of the molecule in order to automatically invoke the appropriate perception routines (aromaticity, atom typing, chirality perception, residue perception, etc…) as required by the selected file format. This greatly simplifies the task of writing molecules to a stream, but may provide less control than calling the lower-level functions directly.

Since these functions may make a copy of the molecule they’ll generally be slower than the analogous OEWriteMolecule functions, which modify the molecule directly.

All of the overloads of OEWriteConstMolecule functions return an error code from the OEWriteMolReturnCode namespace. A return code of 0 or OEWriteMolReturnCode::Success indicates the write had no problems.

ofs

The output stream into which the molecule will be written.

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

Additionally, the OEWriteConstMolecule functions provide some level of control over the processing applied to a molecule prior to writing using OEChem TK’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::SetFlavor. 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.

mol

The molecule that is written into the stream.

See also