本文整理汇总了C++中ATOM_EQUALS_QUERY::getNegation方法的典型用法代码示例。如果您正苦于以下问题:C++ ATOM_EQUALS_QUERY::getNegation方法的具体用法?C++ ATOM_EQUALS_QUERY::getNegation怎么用?C++ ATOM_EQUALS_QUERY::getNegation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ATOM_EQUALS_QUERY
的用法示例。
在下文中一共展示了ATOM_EQUALS_QUERY::getNegation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAtomSmarts
std::string GetAtomSmarts(const QueryAtom *qatom) {
PRECONDITION(qatom, "bad atom");
std::string res;
bool needParen = false;
// BOOST_LOG(rdInfoLog)<<"Atom: " <<qatom->getIdx()<<std::endl;
if (!qatom->hasQuery()) {
res = getNonQueryAtomSmarts(qatom);
// BOOST_LOG(rdInfoLog)<<"\tno query:" <<res;
return res;
}
QueryAtom::QUERYATOM_QUERY *query = qatom->getQuery();
// describeQuery(query);
PRECONDITION(query, "atom has no query");
std::string descrip = qatom->getQuery()->getDescription();
if (descrip == "") {
// we have simple atom - just generate the smiles and return
res = SmilesWrite::GetAtomSmiles(qatom);
if (res[0] == '[') {
// chop the brackets off, we'll put them back on later:
needParen = true;
res = res.substr(1, res.size() - 2);
}
} else if ((descrip == "AtomOr") || (descrip == "AtomAnd")) {
// we have a composite query
needParen = true;
res = _recurseGetSmarts(query, query->getNegation());
if (res.length() == 1) { // single atom symbol we don't need parens
needParen = false;
}
} else if (descrip == "RecursiveStructure") {
// it's a bare recursive structure query:
res = getRecursiveStructureQuerySmarts(query);
needParen = true;
} else { // we have a simple smarts
ATOM_EQUALS_QUERY *tquery =
static_cast<ATOM_EQUALS_QUERY *>(qatom->getQuery());
res = getAtomSmartsSimple(tquery, needParen);
if (tquery->getNegation()) {
res = "!" + res;
}
}
std::string mapNum;
if (qatom->getPropIfPresent(common_properties::molAtomMapNumber, mapNum)) {
needParen = true;
res += ":" + mapNum;
}
if (needParen) {
res = "[" + res + "]";
}
return res;
}