本文整理汇总了C++中Mol::beginAtoms方法的典型用法代码示例。如果您正苦于以下问题:C++ Mol::beginAtoms方法的具体用法?C++ Mol::beginAtoms怎么用?C++ Mol::beginAtoms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mol
的用法示例。
在下文中一共展示了Mol::beginAtoms方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testIssue263
void testIssue263() {
string smi = "c1ccccc1C";
#if 1
Mol *m = SmilesToMol(smi);
Mol::AtomIterator atomIt;
unsigned int idx = 0;
for (atomIt = m->beginAtoms(); atomIt != m->endAtoms(); ++atomIt) {
TEST_ASSERT((*atomIt)->getIdx() == idx);
idx++;
}
TEST_ASSERT(idx == 7);
Mol::BondIterator bondIt;
idx = 0;
for (bondIt = m->beginBonds(); bondIt != m->endBonds(); ++bondIt) {
CHECK_INVARIANT((*bondIt)->getIdx() == idx, "bad idx");
idx++;
}
CHECK_INVARIANT(idx == 7, "bad idx");
#endif
BOOST_LOG(rdInfoLog) << "testIssue263 done" << endl;
}
示例2: test1
void test1() {
string smi = "CCOC";
Mol *m = SmilesToMol(smi);
Mol::AtomIterator atIt;
unsigned int idx = 0;
for (atIt = m->beginAtoms(); atIt != m->endAtoms(); atIt++) {
CHECK_INVARIANT((*atIt)->getIdx() == idx, "bad idx");
idx++;
}
atIt = m->beginAtoms();
CHECK_INVARIANT((*(atIt + 2))->getIdx() == 2, "bad idx");
atIt = m->beginAtoms();
Mol::AtomIterator atIt2 = m->beginAtoms();
CHECK_INVARIANT(atIt == atIt2, "iterators don't compare equal");
atIt++;
CHECK_INVARIANT((*atIt)->getIdx() == 1, "bad idx");
atIt += 2;
CHECK_INVARIANT((*atIt)->getIdx() == 3, "bad idx");
atIt -= 1;
CHECK_INVARIANT((*atIt)->getIdx() == 2, "bad idx");
CHECK_INVARIANT(atIt != atIt2, "iterators don't compare different");
CHECK_INVARIANT(atIt2 < atIt, "iterator inequality failed");
CHECK_INVARIANT(atIt2 <= atIt, "iterator inequality failed");
CHECK_INVARIANT(atIt > atIt2, "iterator inequality failed");
CHECK_INVARIANT(atIt >= atIt2, "iterator inequality failed");
atIt--;
--atIt;
CHECK_INVARIANT((*atIt)->getIdx() == 0, "bad idx");
CHECK_INVARIANT(atIt == atIt2, "iterator inequality failed");
atIt++;
++atIt;
CHECK_INVARIANT((*atIt)->getIdx() == 2, "bad idx");
atIt = m->beginAtoms();
atIt = atIt + 2;
atIt = atIt - 2;
CHECK_INVARIANT((*atIt)->getIdx() == 0, "bad idx");
atIt2 = m->beginAtoms();
atIt2 += 2;
CHECK_INVARIANT(atIt2 - atIt == 2, "subtraction failed");
CHECK_INVARIANT(atIt - atIt2 == -2, "subtraction failed");
// past the end stuff
atIt2 = m->endAtoms();
atIt = m->beginAtoms() + 10;
CHECK_INVARIANT(atIt >= atIt2, "past-the-end failed");
// this is whack
atIt = m->beginAtoms();
atIt -= 10;
CHECK_INVARIANT(atIt >= atIt2, "past-the-end failed");
BOOST_LOG(rdInfoLog) << "test1 done" << endl;
};