本文整理汇总了C++中Obj::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj::get方法的具体用法?C++ Obj::get怎么用?C++ Obj::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj
的用法示例。
在下文中一共展示了Obj::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: match
bool AromaticityMatcher::match (int *core_sub, int *core_super)
{
// Check if detailed checking is necessary
bool needCheck = false;
for (int i = _query.edgeBegin(); i != _query.edgeEnd(); i = _query.edgeNext(i))
{
if (!_query.getBond(i).hasConstraint(QueryMolecule::BOND_ORDER))
continue;
if (_matching_edges_state[i] == AROMATIC && _query.getBondOrder(i) != BOND_AROMATIC)
{
needCheck = true;
break;
}
}
if (!needCheck)
return true;
// By our rules submolecule in the query, that maps on aromatic bonds in
// the target, must have aromatic bond configuration to match the target.
// To check this such submolecule from query molecule is extracted, then
// all bonds are marked as aromatic, and then dearomatizer tries to find
// aromatic bonds configuration with partially fixed bonds.
// 1. Extract query submolecule that maps on aromatic bonds. It is the same as in target.
// Set skip all additional informatio during copying
QS_DEF(Array<int>, mapping);
mapping.clear();
for (int v_idx = _query.vertexBegin();
v_idx < _query.vertexEnd();
v_idx = _query.vertexNext(v_idx))
{
int target_idx = core_sub[v_idx];
if (target_idx < 0)
continue;
mapping.push(target_idx);
}
QS_DEF(Array<int>, edges);
QS_DEF(Array<int>, base_edges_mask);
edges.clear();
base_edges_mask.clear_resize(_base.edgeEnd());
base_edges_mask.zerofill();
for (int e_idx = _query.edgeBegin();
e_idx < _query.edgeEnd();
e_idx = _query.edgeNext(e_idx))
{
const Edge &e = _query.getEdge(e_idx);
if (core_sub[e.beg] < 0 || core_sub[e.end] < 0)
continue;
int target_idx = _base.findEdgeIndex(core_sub[e.beg], core_sub[e.end]);
if (target_idx == -1)
throw Error("(AromaticityMatcher::match) target edge wasn't found");
edges.push(target_idx);
base_edges_mask[target_idx] = 1;
}
QS_DEF(Array<int>, inv_mapping);
_submolecule->makeEdgeSubmolecule(_base, mapping, edges, &inv_mapping, SKIP_ALL);
QS_DEF(Array<int>, external_conn);
external_conn.resize(_submolecule->vertexEnd());
external_conn.zerofill();
// Calculate external connectivity
for (int i = 0; i < mapping.size(); i++)
{
int base_idx = mapping[i];
const Vertex &v = _base.getVertex(base_idx);
int cur_external_conn = 0;
for (int ni = v.neiBegin(); ni != v.neiEnd(); ni = v.neiNext(ni))
{
int ni_edge = v.neiEdge(ni);
if (!base_edges_mask[ni_edge])
{
int bond_order_diff = _base.getBondOrder(ni_edge);
if (bond_order_diff == BOND_AROMATIC)
bond_order_diff = 1;
cur_external_conn += bond_order_diff;
}
}
external_conn[i] = cur_external_conn;
}
// 1b. Find bonds in aromatic rings in query and skip aromatic
// bonds that are not in cycles
QS_DEF(Array<int>, is_edge_in_aromatic_cycle);
is_edge_in_aromatic_cycle.clear_resize(_submolecule->edgeEnd());
is_edge_in_aromatic_cycle.zerofill();
// At first just mark aromatic bonds
for (int e_idx = _submolecule->edgeBegin();
e_idx < _submolecule->edgeEnd();
e_idx = _submolecule->edgeNext(e_idx))
{
if (_submolecule->getBondOrder(e_idx) == BOND_AROMATIC)
is_edge_in_aromatic_cycle[e_idx] = 1;
//.........这里部分代码省略.........