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


C++ BottomSegmentIteratorPtr::atEnd方法代码示例

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


在下文中一共展示了BottomSegmentIteratorPtr::atEnd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createCallBack

void TopSegmentIsGapTest::createCallBack(Alignment *alignment) {
    size_t numSequences = 3;
    vector<Sequence::Info> seqVec(numSequences);

    BottomSegmentIteratorPtr bi;
    BottomSegmentStruct bs;
    TopSegmentIteratorPtr ti;
    TopSegmentStruct ts;

    Genome *parent1 = alignment->addRootGenome("parent1");
    Genome *child1 = alignment->addLeafGenome("child1", "parent1", 1);

    // set up two genomes.  each with three sequences.  each sequence
    // with 5 segments of length two.  start with segment i in parent
    // aligned with segment i in child.
    for (size_t i = 0; i < numSequences; ++i) {
        string name = "Sequence" + std::to_string(i);
        seqVec[i] = Sequence::Info(name, 10, 5, 5);
    }
    parent1->setDimensions(seqVec);
    child1->setDimensions(seqVec);

    for (bi = parent1->getBottomSegmentIterator(); not bi->atEnd(); bi->toRight()) {
        bs.set(bi->getBottomSegment()->getArrayIndex() * 2, 2);
        bs._children.clear();
        bs._children.push_back(pair<hal_size_t, bool>(bi->getBottomSegment()->getArrayIndex(), false));
        bs.applyTo(bi);
    }

    for (ti = child1->getTopSegmentIterator(); not ti->atEnd(); ti->toRight()) {
        ts.set(ti->getTopSegment()->getArrayIndex() * 2, 2, ti->getTopSegment()->getArrayIndex());
        ts.applyTo(ti);
    }

    // insertion in middle (8th top segment)

    bi = parent1->getBottomSegmentIterator(8);
    ti = child1->getTopSegmentIterator(8);
    assert(bi->getBottomSegment()->getChildIndex(0) == 8 && ti->getTopSegment()->getParentIndex() == 8);
    bi->getBottomSegment()->setChildIndex(0, 9);
    ti->getTopSegment()->setParentIndex(NULL_INDEX);
    ti->toRight();
    ti->getTopSegment()->setParentIndex(8);

    // insertion at begining (10th top segment)

    bi = parent1->getBottomSegmentIterator(10);
    ti = child1->getTopSegmentIterator(10);
    assert(bi->getBottomSegment()->getChildIndex(0) == 10 && ti->getTopSegment()->getParentIndex() == 10);
    bi->getBottomSegment()->setChildIndex(0, 11);
    ti->getTopSegment()->setParentIndex(NULL_INDEX);
    ti->toRight();
    ti->getTopSegment()->setParentIndex(10);

    // just having a null parent is not enough for an insertion
    bi = parent1->getBottomSegmentIterator(2);
    ti = child1->getTopSegmentIterator(2);
    assert(bi->getBottomSegment()->getChildIndex(0) == 2 && ti->getTopSegment()->getParentIndex() == 2);
    ti->getTopSegment()->setParentIndex(NULL_INDEX);
}
开发者ID:glennhickey,项目名称:hal,代码行数:60,代码来源:halTopSegmentTest.cpp


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