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


C++ UnsignedArray::item方法代码示例

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


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

示例1: init

    void init()
    {
        // prepare topology.

        unsigned rootNodes = container.queryJob().querySlaves();

        unsigned res = MERGE_GRANULARITY;

        sD = new MemoryBuffer[rootNodes];
        UnsignedArray nodes1, nodes2;
        UnsignedArray *currentLevel = &nodes1, *nextLevel = &nodes2;
        unsigned n = 0; while (n<rootNodes) currentLevel->append(n++);
        while (rootNodes > 1)
        {
            assertex(rootNodes);

            unsigned r = (rootNodes+(res-1))/res; // groups
            unsigned t = 0;
            n = 0;
            bool first = true;
            loop
            {
                if (first)
                {
                    first = false;
                    nextLevel->append(currentLevel->item(n));
                }
                else
                {
#ifdef _DEBUG
                    unsigned node = nextLevel->tos();
                    unsigned item = currentLevel->item(n);
                    ActPrintLog("Adding to node=%d, item=%d", node, item);
#endif
                    sD[nextLevel->tos()].append(currentLevel->item(n));
                }
                n++;
                if (n>=rootNodes) break;
                t += r;
                if (t>=rootNodes)
                {
                    t -= rootNodes;
                    first = true;
                }
            }
            
            assertex(sD[nextLevel->tos()].length()); // something must have been added
            n = 0;
            while (n<nextLevel->ordinality()) sD[nextLevel->item(n++)].append(0); // terminator
#ifdef _DEBUG
            ActPrintLog("EOL");
#endif
            rootNodes = nextLevel->ordinality();

            UnsignedArray *tmp = currentLevel;
            currentLevel = nextLevel;
            nextLevel = tmp;
            nextLevel->kill();
        }
    }
开发者ID:anandjun,项目名称:HPCC-Platform,代码行数:60,代码来源:thtopn.cpp

示例2: assert

NlpMatchPath::NlpMatchPath(const UnsignedArray & _ids, const UnsignedArray & _indices)
{
    assert(_ids.ordinality() == _indices.ordinality());
    ForEachItemIn(idx, _ids)
    {
        ids.append(_ids.item(idx));
        indices.append(_indices.item(idx));
    }
开发者ID:AsherBond,项目名称:HPCC-Platform,代码行数:8,代码来源:thorparse.cpp

示例3: tokens

MultiLexer::MultiLexer(const AsciiDfa & _tokens, const AsciiDfa & _skip, const UnsignedArray & _endTokenChars, unsigned _eofId) : tokens(_tokens), skip(_skip)
{
    eofId = _eofId;
    _clear(isEndToken);
    ForEachItemIn(idx, _endTokenChars)
    {
        unsigned next = _endTokenChars.item(idx);
        if (next < 256)
            isEndToken[next] = true;
    }
开发者ID:Josh-Googler,项目名称:HPCC-Platform,代码行数:10,代码来源:thortlex.cpp

示例4: match

bool CCronAtSchedule::match(UnsignedArray &a,unsigned v,unsigned &next)
{
    if (a.ordinality()==0) {
        next = v;
        return true;
    }
    ForEachItemIn(i,a) {
        unsigned n = a.item(i);
        if (n>=v) {
            next = n;
            return true;
        }
    }
开发者ID:RogerDev,项目名称:HPCC-Platform,代码行数:13,代码来源:jtime.cpp


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