当前位置: 首页>>代码示例>>C++>>正文


C++ Mol::endAtoms方法代码示例

本文整理汇总了C++中Mol::endAtoms方法的典型用法代码示例。如果您正苦于以下问题:C++ Mol::endAtoms方法的具体用法?C++ Mol::endAtoms怎么用?C++ Mol::endAtoms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mol的用法示例。


在下文中一共展示了Mol::endAtoms方法的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;
}
开发者ID:connorcoley,项目名称:rdkit,代码行数:23,代码来源:itertest.cpp

示例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;
};
开发者ID:connorcoley,项目名称:rdkit,代码行数:62,代码来源:itertest.cpp


注:本文中的Mol::endAtoms方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。