本文整理汇总了C++中ArgumentParser::getIntArgumentOrReturnDefault方法的典型用法代码示例。如果您正苦于以下问题:C++ ArgumentParser::getIntArgumentOrReturnDefault方法的具体用法?C++ ArgumentParser::getIntArgumentOrReturnDefault怎么用?C++ ArgumentParser::getIntArgumentOrReturnDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArgumentParser
的用法示例。
在下文中一共展示了ArgumentParser::getIntArgumentOrReturnDefault方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
std::vector<Argument> arguments = createArguments();
ArgumentParser argumentParser;
try {
argumentParser.parse(argc, argv, arguments);
} catch(const GeneralException& exception) {
std::cout << exception.what() << std::endl;
showUsage(arguments);
return -1;
}
if (argumentParser.isArgumentPresent('h')) {
showUsage(arguments);
return 0;
}
if (!areAllMandatoryArgumentsPresent(argumentParser)) {
showUsage(arguments);
return -1;
}
try {
FractalParser parser;
FractalParams params = parser.readFractal(argumentParser.getStringArgument('f'));
Database* database;
int hardwareConcurrency = std::thread::hardware_concurrency();
if (hardwareConcurrency == 0) {
hardwareConcurrency = 1;
}
int numberOfThreads = argumentParser.getIntArgumentOrReturnDefault('t', hardwareConcurrency);
bool saveTemporaryResult = !argumentParser.isArgumentPresent('s');
std::cout << "Number of threads: " << numberOfThreads << std::endl;
if (argumentParser.isArgumentPresent('b')) {
database = new Database();
} else {
database = new Database(argumentParser.getStringArgumentOrReturnDefault('d', "points.ff"));
}
ValueProvider* valueProvider = new ValueProvider(database, params, numberOfThreads);
valueProvider->setIterationCountToConsiderInteresting(argumentParser.getIntArgumentOrReturnDefault('i', 100));
if (argumentParser.isArgumentPresent('o')) {
valueProvider->setReadOnlyFile(true);
}
if (argumentParser.isArgumentPresent('b')) {
valueProvider->setNoDb(true);
}
for (double d = params.startPower; d <= params.endPower; d+= params.increment) {
valueProvider->deleteSavedValues();
Fractal fractal(valueProvider, params);
fractal.draw(d, numberOfThreads, saveTemporaryResult);
}
delete database;
delete valueProvider;
} catch(const GeneralException& ex) {
std::cout << "Exception occured: " << ex.what() << std::endl;
return -1;
}
return 0;
}