OEMolRecord class is a subclass of
OERecord, with additional convenience
methods for handling molecules. All public methods from
OERecord are inherited. This class has
a “primary” molecule field, to which several convenience methods apply.
The default constructor initializes the record object to an empty record with no fields or values.
OEMolRecord(const OERecord &rhs)
Copy constructor. OEMolRecords can be constructed from OERecords, and vice versa, without any loss of data.
bool GetPrimaryMolField(const std::string defName="Molecule", OEFieldMeta meta=OEFieldMeta()) const
Retrieves the primary molecule field from the record. If no primary molecule field exists, this will return a field of type Types::Chem::Molecule with the name “Molecule”.
The name to be used for the molecule field if a primary molecule field doesn’t already exist ont he record.
An optional OEFieldMeta object specifying metadata for the field.
OEChem::OEMol GetMol(OEFieldBase field=OEFieldBase())
Retrieves a molecule from the record. If no field is specified, the record’s primary molecule is returned. If no primary molecule exists, an default-constructed (empty) OEMol is returned.
The field to retrieve the molecule from. If this is omitted, the record’s primary molecule will be returned.
bool HasMol(const OEFieldBase field=OEFieldBase())
Returns true if the record has a molecule in the specified field, or a primary molecule if no field is supplied.
The field to check for the presence of a molecule. If this is omitted, the record’s primary molecule will be used.
bool SetMol(const OEChem::OEMol &mol, OEFieldBase field=OEFieldBase(), OEFieldMeta meta=OEFieldMeta()) const
Sets a molecule on the record using the specified field. If no field is supplied, the primary molecule is set.
The molecule to be copied to the record.
The field to store the molecule on. If this is omitted, the molecule will be stored as the record’s primary molecule.
Optional metadata to store on the field.
OEChem::OEMol* GetMolPointer(OEFieldBase field=OEFieldBase())
Returns a pointer to the molecule from the specified field on the record, or to the primary molecule if no field is supplied. If no such molecule exists on the record, a null pointer is returned.
The field from which the molecule pointer is obtained. If this argument is omitted, a pointer to the primary molecule is returned.
This method will return a pointer to the actual molecule on the record, so any modifications to this molecule will affect the record contents. Accessing this pointer after the record has been destroyed will have undefined results.
bool SetMolReference(OEChem::OEMol &mol, OEFieldBase field=OEFieldBase(), OEFieldMeta meta=OEFieldMeta())
This method puts a pointer to the passed OEMol onto the record, in
the specified field. If no field is provided, the record’s primary
molecule is set. While the
OEMolRecord::SetMol method places
a copy of the passed molecule onto the record, this method avoids
creating a copy, and may in some cases improve performance.
The molecule to be placed on the record.
The field to store the molecule in. If this is omitted the molecule will be stored in the record’s primary molecule field.
Optional metadata to be stored on the field.
OERecord GetConfRecord(const OEChem::OEConfBase *conf) const
Returns a record for the provided conformer. OEMolRecord provides a mechanism for storing a record of data for each conformer. If the passed conformer doesn’t already have a record associated with it, this will return an empty OERecord.
The conformer the record will be associated with.
OERecord SetConfRecord(const OEChem::OEConfBase *conf, OERecord &childRecord)
This method associates data on a record with a conformer. The
conformer’s parent molecule must be stored in a field on the parent
record after this method is called, or stored using the
Otherwise, the conformer data will be lost during serialization.
A record containing data for the conformer.