本文整理汇总了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)();
//.........这里部分代码省略.........