本文整理汇总了C++中Obj::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj::clone方法的具体用法?C++ Obj::clone怎么用?C++ Obj::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj
的用法示例。
在下文中一共展示了Obj::clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveMoleculeIntoInchi
void IndigoInchi::saveMoleculeIntoInchi (Molecule &mol, Array<char> &inchi)
{
inchi_Input input;
QS_DEF(Array<inchi_Atom>, atoms);
QS_DEF(Array<inchi_Stereo0D>, stereo);
// Check if structure has aromatic bonds
bool has_aromatic = false;
for (int e = mol.edgeBegin(); e != mol.edgeEnd(); e = mol.edgeNext(e))
if (mol.getBondOrder(e) == BOND_AROMATIC)
{
has_aromatic = true;
break;
}
Molecule *target = &mol;
Obj<Molecule> dearom;
if (has_aromatic)
{
dearom.create();
dearom->clone(mol, 0, 0);
try
{
dearom->dearomatize();
}
catch (DearomatizationsGroups::Error &)
{
}
target = dearom.get();
}
generateInchiInput(*target, input, atoms, stereo);
inchi_Output output;
int ret = GetINCHI(&input, &output);
if (output.szMessage)
warning.readString(output.szMessage, true);
if (output.szLog)
log.readString(output.szLog, true);
if (output.szAuxInfo)
auxInfo.readString(output.szAuxInfo, true);
if (ret != inchi_Ret_OKAY && ret != inchi_Ret_WARNING)
{
// Construct error before dispoing inchi output to preserve error message
IndigoError error("Indigo-InChI: InChI generation failed: %s. Code: %d.", output.szMessage, ret);
FreeINCHI(&output);
throw error;
}
inchi.readString(output.szInChI, true);
FreeINCHI(&output);
}