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


C++ BitSet::get方法代码示例

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


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

示例1: main

int main(const int argc, const char** argv) {
	BitSet<24, char> bitset;

	bitset.set(14);
	std::cout << bitset.get(14) << "\n";
	bitset.debug_print();
	const size_t test_indices[] = {
		26, 155, 95, 9, 3, 183, 154, 130, 102, 103, 105, 19, 
		161, 190, 61, 162, 183, 11, 3, 88, 18, 155, 169, 73, 
		59, 58, 0, 105, 191, 140, 191, 91, 3, 4, 139, 176, 176, 
		180, 168, 16, 143, 96, 77, 38, 178, 189, 118, 109, 138, 
		69, 110, 102, 66, 85, 32, 190, 76, 66, 86, 40, 35, 104, 
		101, 89, 124, 27, 125, 46, 134, 96, 93, 161, 178, 83, 114, 
		128, 8, 55, 108, 167, 11, 184, 74, 164, 169, 101, 140, 31, 
		120, 167, 190, 85, 158, 118, 19, 63, 175, 155, 80, 58
	};
	
	for (const auto& test_idx: test_indices) {
		bitset.set(test_idx);
		bool ans = bitset.get(test_idx);
		if (!ans) {
			throw std::runtime_error("Failed test");
 		}
	}
	bitset.debug_print();

}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例2: dataChecked

	void ChunkManager::dataChecked(const BitSet & ok_chunks)
	{
		// go over all chunks at check each of them
		for (Uint32 i = 0;i < chunks.count();i++)
		{
			Chunk* c = chunks[i];
			if (ok_chunks.get(i) && !bitset.get(i))
			{
				// We think we do not hae a chunk, but we do have it
				bitset.set(i,true);
				todo.set(i,false);
				// the chunk must be on disk
				c->setStatus(Chunk::ON_DISK);
				tor.updateFilePercentage(i,bitset); 
			}
			else if (!ok_chunks.get(i) && bitset.get(i))
			{
				Out(SYS_DIO|LOG_IMPORTANT) << "Previously OK chunk " << i << " is corrupt !!!!!" << endl;
				// We think we have a chunk, but we don't
				bitset.set(i,false);
				todo.set(i,!only_seed_chunks.get(i) && !excluded_chunks.get(i));
				if (c->getStatus() == Chunk::ON_DISK)
				{
					c->setStatus(Chunk::NOT_DOWNLOADED);
					tor.updateFilePercentage(i,bitset);
				}
				else if (c->getStatus() == Chunk::MMAPPED || c->getStatus() == Chunk::BUFFERED)
				{
					resetChunk(i);
				}
				else
				{
					tor.updateFilePercentage(i,bitset);
				}
			}
		}
		recalc_chunks_left = true;
		try
		{
			saveIndexFile();
		}
		catch (bt::Error & err)
		{
			Out(SYS_DIO|LOG_DEBUG) << "Failed to save index file : " << err.toString() << endl;
		}
		catch (...)
		{
			Out(SYS_DIO|LOG_DEBUG) << "Failed to save index file : unkown exception" << endl;
		}
		chunksLeft();
		corrupted_count = 0;
	}
开发者ID:,项目名称:,代码行数:52,代码来源:

示例3: addInstrUsers

/**
 * helper - add the users of the Defs of a given
 * instruction to the passed worklist.
 *
 * This encapsulates several nontrivial pieces of logic:
 * 1. Skip use instructions that haven't been reached yet.
 * 2. Skip over dead arms of constant conditionals.
 * 3. Jump the call-site gap between block delims.
 *    (goto -> label, cond -> arm)
 * 4. When reaching a block the first time, mark all its instructions reached
 *    *and* enque them, because they could have been previously skipped.
 */
void SCCP::addInstrUsers(Instr* instr) {
    for (AllUsesRange u(instr); !u.empty(); u.popFront()) {
        Instr* use_instr = user(u.front());
        if (mark.get(use_instr->id))
            ssawork.add(use_instr);
    }
}
开发者ID:zhuzhonghua,项目名称:flash,代码行数:19,代码来源:hm-typeinference.cpp

示例4: decBitSet

	void ChunkCounter::decBitSet(const BitSet & bs)
	{
		for (Uint32 i = 0;i < cnt.size();i++)
		{
			if(bs.get(i))
				dec(i);
		}
	}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例5: incBitSet

	void ChunkCounter::incBitSet(const BitSet & bs)
	{
		for (Uint32 i = 0;i < cnt.size();i++)
		{
			if(bs.get(i))
				cnt[i]++;
		}
	}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例6: result

BitSet BitSet::operator+(const BitSet& that)
{
    BitSet result(*this);
    for (int i = 0; i < that.length(); ++i) {
        result.add(that.get(i));
    }
    return result;
}
开发者ID:vlad-shevchenko,项目名称:BitSet,代码行数:8,代码来源:bitset.cpp

示例7: orBitSet

	void BitSet::orBitSet(const BitSet & other)
	{
		Uint32 i = 0;
		while (i < num_bits)
		{
			bool val = get(i) || other.get(i);
			set(i,val);
			i++;
		}
	}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例8: add

 void add(T item) {
     if (members.get(item->id))
         return;
     Seq<T>* n = newnode(item);
     n->tail = 0;
     if (end)
         end->tail = n;
     else
         work = n;
     end = n;
 }
开发者ID:zhuzhonghua,项目名称:flash,代码行数:11,代码来源:hm-typeinference.cpp

示例9: updateCopyFromBitSet

void PVCopy::updateCopyFromBitSet(
    PVStructure &copyPVStructure,BitSet &bitSet,bool lockRecord)
{
    bool doAll = bitSet.get(0);
    if(lockRecord) pvRecord.lock();
    try {
        if(headNode->isStructure) {
            StructureNode *node = static_cast<StructureNode*>(headNode);
            updateStructureNodeFromBitSet(
                copyPVStructure,*node,bitSet,true,doAll);
        } else {
            RecordNode *node = static_cast<RecordNode*>(headNode);
            updateSubFieldFromBitSet(
                copyPVStructure,node->recordPVField,bitSet, true,doAll);
        }
        if(lockRecord) pvRecord.unlock();
    } catch(...) {
        if(lockRecord) pvRecord.unlock();
        throw;
    }
}
开发者ID:epics-base,项目名称:pvIOCCPP,代码行数:21,代码来源:pvCopy.cpp

示例10: path

void
CLuceneIndexWriter::deleteEntry(const string& entry,
        lucene::index::IndexReader* reader) {
    int deleted = 0;
    wstring path(utf8toucs2(entry));
{
    Term t(systemlocation(), path.c_str());
    deleted += reader->deleteDocuments(&t);
    // if no file was deleted, no more can be deleted
    if (deleted == 0) return;
}
{
    Term t(parentlocation(), path.c_str());
    deleted += reader->deleteDocuments(&t);

    // if we have only deleted one file up to now, we cannot delete more
    if (deleted < 2) return;
}
{
    // delete all deeper nested files
    wstring v = utf8toucs2(entry+"/");
    Term* t = _CLNEW Term(parentlocation(), v.c_str());
    PrefixFilter* filter = _CLNEW PrefixFilter(t);
    BitSet* b = filter->bits(reader);
    _CLDELETE(filter);
    _CLDECDELETE(t);
    int32_t size = b->size();
    for (int id = 0; id < size; ++id) {
        if (b->get(id) && !reader->isDeleted(id)) {
            reader->deleteDocument(id);
            deleted++;
        }
    }
    _CLDELETE(b);
}
}
开发者ID:dividedmind,项目名称:libstreamanalyzer,代码行数:36,代码来源:cluceneindexwriter.cpp

示例11: addBlock

/**
 * Enque the block.  If it is already visited, just enqueu it.
 * Otherwise, mark it reached and enque all the instructions in the block.
 */
void SCCP::addBlock(BlockStartInstr* block) {
    if (!mark.get(block->id))
        cfgwork.push(block);
    else
        ssawork.add(block);
}
开发者ID:zhuzhonghua,项目名称:flash,代码行数:10,代码来源:hm-typeinference.cpp


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