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


C++ ErrorHandler::IsError方法代码示例

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


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

示例1: Process

bool DsrcCompressorMT::Process(const InputParameters &args_)
{
	IFastqStreamReader* fileReader = NULL;
	DsrcFileWriter* fileWriter = NULL;

	// make reusable
	//
	FastqDataPool* fastqPool = NULL;
	FastqDataQueue* fastqQueue = NULL;
	DsrcDataPool* dsrcPool = NULL;
	DsrcDataQueue* dsrcQueue = NULL;
	ErrorHandler* errorHandler = NULL;
	//
	//

	FastqReader* dataReader = NULL;
	DsrcWriter* dataWriter = NULL;

	FastqDatasetType datasetType;
	CompressionSettings compSettings = GetCompressionSettings(args_);

	try
	{
		if (args_.useFastqStdIo)
			fileReader = new FastqStdIoReader();
		else
			fileReader = new FastqFileReader(args_.inputFilename);

		fileWriter = new DsrcFileWriter();
		fileWriter->StartCompress(args_.outputFilename);

		const uint32 partNum = (args_.fastqBufferSizeMB < 128) ? args_.threadNum * 4 : args_.threadNum * 2;
		fastqPool = new FastqDataPool(partNum, args_.fastqBufferSizeMB << 20);		// maxPart, bufferPartSize
		fastqQueue = new FastqDataQueue(partNum, 1);								// maxPart, threadCount

		dsrcPool = new DsrcDataPool(partNum, args_.fastqBufferSizeMB << 20);
		dsrcQueue = new DsrcDataQueue(partNum, args_.threadNum);

		if (args_.calculateCrc32)
			errorHandler = new MultithreadedErrorHandler();
		else
			errorHandler = new ErrorHandler();

		dataReader = new FastqReader(*fileReader, *fastqQueue, *fastqPool, *errorHandler);
		dataWriter = new DsrcWriter(*fileWriter, *dsrcQueue, *dsrcPool, *errorHandler);

		// analyze file
		//
		const bool findQOffset = args_.qualityOffset == fq::FastqDatasetType::AutoQualityOffset;
		if (!findQOffset)
			datasetType.qualityOffset = args_.qualityOffset;

		if (!dataReader->AnalyzeFirstChunk(datasetType, findQOffset))
		{
			throw DsrcException("Error analyzing FASTQ dataset");
		}

		fileWriter->SetDatasetType(datasetType);
		fileWriter->SetCompressionSettings(compSettings);
	}
	catch (const std::runtime_error& e_)
	{
		AddError(e_.what());
	}

	if (!IsError())
	{
		const uint32 threadsNum = args_.threadNum;

		// launch threads
		//
		th::thread readerThread(th::ref(*dataReader));

		std::vector<DsrcCompressor*> operators;
		operators.resize(threadsNum);

#ifdef USE_BOOST_THREAD
		boost::thread_group opThreadGroup;		// why C++11 does not have thread_group? ://

		for (uint32 i = 0; i < threadsNum; ++i)
		{
			operators[i] = new DsrcCompressor(*fastqQueue, *fastqPool, *dsrcQueue, *dsrcPool, *errorHandler, datasetType, compSettings);
			opThreadGroup.create_thread(th::ref(*operators[i]));
		}

		(*dataWriter)();			// main thread works as writer

		readerThread.join();
		opThreadGroup.join_all();

#else
		std::vector<th::thread> opThreadGroup;

		for (uint32 i = 0; i < threadsNum; ++i)
		{
			operators[i] = new DsrcCompressor(*fastqQueue, *fastqPool, *dsrcQueue, *dsrcPool, *errorHandler, datasetType, compSettings);
			opThreadGroup.push_back(th::thread(th::ref(*operators[i])));
		}

		(*dataWriter)();
//.........这里部分代码省略.........
开发者ID:ahnan4arch,项目名称:dsrc,代码行数:101,代码来源:DsrcOperator.cpp


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