本文整理汇总了C++中CommandLine::GetUniformFiles方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandLine::GetUniformFiles方法的具体用法?C++ CommandLine::GetUniformFiles怎么用?C++ CommandLine::GetUniformFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandLine
的用法示例。
在下文中一共展示了CommandLine::GetUniformFiles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
Result Par2Creator::Process(const CommandLine &commandline)
{
// Get information from commandline
blocksize = commandline.GetBlockSize();
sourceblockcount = commandline.GetBlockCount();
const list<CommandLine::ExtraFile> extrafiles = commandline.GetExtraFiles();
sourcefilecount = (u32)extrafiles.size();
u32 redundancy = commandline.GetRedundancy();
recoveryfilecount = commandline.GetRecoveryFileCount();
firstrecoveryblock = commandline.GetFirstRecoveryBlock();
bool uniformfiles = commandline.GetUniformFiles();
string par2filename = commandline.GetParFilename();
size_t memorylimit = commandline.GetMemoryLimit();
// Compute block size from block count or vice versa depending on which was
// specified on the command line
if (!ComputeBlockSizeAndBlockCount(extrafiles))
return eInvalidCommandLineArguments;
// Determine how many recovery blocks to create based on the source block
// count and the requested level of redundancy.
if (!ComputeRecoveryBlockCount(redundancy))
return eInvalidCommandLineArguments;
// Determine how much recovery data can be computed on one pass
if (!CalculateProcessBlockSize(memorylimit))
return eLogicError;
// Determine how many recovery files to create.
if (!ComputeRecoveryFileCount())
return eInvalidCommandLineArguments;
// Display information.
cout << "Block size: " << blocksize << endl;
cout << "Source file count: " << sourcefilecount << endl;
cout << "Source block count: " << sourceblockcount << endl;
cout << "Redundancy: " << redundancy << '%' << endl;
cout << "Recovery block count: " << recoveryblockcount << endl;
cout << "Recovery file count: " << recoveryfilecount << endl;
cout << endl;
// Open all of the source files, compute the Hashes and CRC values, and store
// the results in the file verification and file description packets.
if (!OpenSourceFiles(extrafiles))
return eFileIOError;
// Create the main packet and determine the setid to use with all packets
if (!CreateMainPacket())
return eLogicError;
// Create the creator packet.
if (!CreateCreatorPacket())
return eLogicError;
// Initialise all of the source blocks ready to start reading data from the source files.
if (!CreateSourceBlocks())
return eLogicError;
// Create all of the output files and allocate all packets to appropriate file offets.
if (!InitialiseOutputFiles(uniformfiles, par2filename))
return eFileIOError;
if (recoveryblockcount > 0)
{
// Allocate memory buffers for reading and writing data to disk.
if (!AllocateBuffers())
return eMemoryError;
// Compute the Reed Solomon matrix
if (!ComputeRSMatrix())
return eLogicError;
// Set the total amount of data to be processed.
progress = 0;
totaldata = blocksize * sourceblockcount * recoveryblockcount;
// Start at an offset of 0 within a block.
u64 blockoffset = 0;
while (blockoffset < blocksize) // Continue until the end of the block.
{
// Work out how much data to process this time.
size_t blocklength = (size_t)min((u64)chunksize, blocksize-blockoffset);
// Read source data, process it through the RS matrix and write it to disk.
if (!ProcessData(blockoffset, blocklength))
return eFileIOError;
blockoffset += blocklength;
}
cout << "Writing recovery packets" << endl;
// Finish computation of the recovery packets and write the headers to disk.
if (!WriteRecoveryPacketHeaders())
return eFileIOError;
// Finish computing the full file hash values of the source files
if (!FinishFileHashComputation())
return eLogicError;
}
//.........这里部分代码省略.........