本文整理汇总了C++中ConfigReader::GetUnsignedNonZeroOption方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigReader::GetUnsignedNonZeroOption方法的具体用法?C++ ConfigReader::GetUnsignedNonZeroOption怎么用?C++ ConfigReader::GetUnsignedNonZeroOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigReader
的用法示例。
在下文中一共展示了ConfigReader::GetUnsignedNonZeroOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read
int GeneralGamlConfig::Read(const char* fname, bool isMaster /*=false*/) {
ConfigReader cr;
if (cr.Load(fname) != 0) {
printf("ERROR: GamlConfig::General::Read(%s) failed.\n", fname);
return -1;
}
int errors = 0;
errors += cr.SetSection("general");
if(errors < 0) throw ErrorException("Didn't find [general] section in config file\n (this section heading is required)");
errors += cr.GetUnsignedOption("logevery", logevery);
errors += cr.GetUnsignedOption("saveevery", saveevery);
int found=cr.GetPositiveNonZeroDoubleOption("megsclamemory", megsClaMemory, true);
found += cr.GetPositiveNonZeroDoubleOption("availablememory", availableMemory, true);
if(found == -2) throw ErrorException("Either \"megsclamemory\" or \"availablememory\" must be specified in conf!");
errors += cr.GetStringOption("datafname", datafname);
errors += cr.GetStringOption("ofprefix", ofprefix);
errors += cr.GetStringOption("streefname", streefname);
cr.GetStringOption("constraintfile", constraintfile, true);
errors += cr.GetIntNonZeroOption("randseed", randseed);
errors += cr.GetBoolOption("refinestart", refineStart);
cr.GetBoolOption("refineend", refineEnd, true);
errors += cr.GetBoolOption("outputeachbettertopology", outputTreelog);
errors += cr.GetBoolOption("enforcetermconditions", enforceTermConditions);
errors += cr.GetUnsignedNonZeroOption("genthreshfortopoterm", lastTopoImproveThresh);
errors += cr.GetPositiveNonZeroDoubleOption("scorethreshforterm", improveOverStoredIntervalsThresh);
cr.GetPositiveNonZeroDoubleOption("significanttopochange", significantTopoChange, true);
cr.GetUnsignedNonZeroOption("attachmentspertaxon", attachmentsPerTaxon, true);
cr.GetUnsignedOption("outputsitelikelihoods", outputSitelikelihoods, true);
cr.GetBoolOption("reportrunprogress", reportRunProgress, true);
cr.GetBoolOption("outputmostlyuselessfiles", outputMostlyUselessFiles, true);
cr.GetBoolOption("outputphyliptree", outputPhylipTree, true);
cr.GetBoolOption("collapsebranches", collapseBranches, true);
cr.GetIntOption("genthreshforswapterm", swapTermThreshold, true);
cr.GetStringOption("arbitrarystring", arbitraryString, true);
cr.GetUnsignedOption("windowlength", siteWindowLength, true);
cr.GetUnsignedOption("windowstride", siteWindowStride, true);
cr.GetBoolOption("usepatternmanager", usePatternManager, true);
//changed the wording of this from besttree to besttopology, to match outputeachbettertopology
//still allow besttree, since that is what I told Maddison, and I think has already been incorporated
//into Mesquite
int ret = cr.GetBoolOption("outputcurrentbesttopology", outputCurrentBestTopology, true);
if(ret < 0)
cr.GetBoolOption("outputcurrentbesttree", outputCurrentBestTopology, true);
cr.GetBoolOption("restart", restart, true);
cr.GetBoolOption("writecheckpoints", checkpoint, true);
//after changes to Population, this is now allowed
// if((restart || checkpoint) && collapseBranches)
// throw ErrorException("Sorry, the collapsebranches option can not currently be used with checkpointing");
cr.GetUnsignedNonZeroOption("searchreps", searchReps, true);
cr.GetUnsignedOption("runmode", runmode, true);
cr.GetBoolOption("scoreonly", scoreOnly, true);
//cr.GetBoolOption("useflexrates", useflexrates, true);
//cr.GetBoolOption("dontinferproportioninvariant", dontInferProportionInvariant, true);
cr.GetStringOption("ratehetmodel", rateHetModel, true);
cr.GetUnsignedOption("numratecats", numRateCats, true);
cr.GetStringOption("statefrequencies", stateFrequencies, true);
cr.GetStringOption("ratematrix", rateMatrix, true);
if(cr.GetStringOption("invariantsites", proportionInvariant, true) == -1)
proportionInvariant = "unspecified";
cr.GetStringOption("datatype", datatype, true);
cr.GetStringOption("geneticcode", geneticCode, true);
cr.GetStringOption("outgroup", outgroupString, true);
if(isMaster){
errors += cr.SetSection("master");
if(errors < 0) throw ErrorException("Didn't find [master] section in config file\n (this section heading is required)");
}
else{
errors += cr.SetSection("remote");
if(errors < 0) throw ErrorException("Didn't find [remote] section in config file\n (this section heading is required)");
}
errors += cr.GetUnsignedNonZeroOption("nindivs", nindivs);
errors += cr.GetUnsignedOption("holdover", holdover);
errors += cr.GetPositiveNonZeroDoubleOption("selectionintensity", selectionIntensity);
errors += cr.GetDoubleOption("holdoverpenalty", holdoverPenalty);
errors += cr.GetUnsignedNonZeroOption("stopgen", stopgen);
errors += cr.GetUnsignedNonZeroOption("stoptime", stoptime);
errors += cr.GetPositiveNonZeroDoubleOption("startoptprec", startOptPrec);
errors += cr.GetPositiveNonZeroDoubleOption("minoptprec", minOptPrec);
//changing this to specify either the number of reductions in the precision or the
//multiplier as before. Prefer the number, since it should be easier to specify.
//
found=0;
found=cr.GetIntOption("numberofprecreductions", numPrecReductions, true);
found += cr.GetPositiveNonZeroDoubleOption("precreductionfactor", precReductionFactor, true);
if(found == -2) throw ErrorException("Error: either \"numberofprecreductions\" (preferably) or \"precreductionfactor\" must be specified in conf!");
errors += cr.GetPositiveDoubleOption("topoweight", topoWeight);
//.........这里部分代码省略.........
示例2: Read
int GeneralGamlConfig::Read(const char* fname, bool isMaster /*=false*/) {
ConfigReader cr;
if (cr.Load(fname) != 0) {
printf("ERROR: GamlConfig::General::Read(%s) failed.\n", fname);
return -1;
}
cr.MakeAllSection();
int errors = 0;
errors += cr.SetSection("general");
if(errors < 0) throw ErrorException("Didn't find [general] section in config file\n (this section heading is required)");
errors += cr.GetUnsignedOption("logevery", logevery);
errors += cr.GetUnsignedOption("saveevery", saveevery);
int found=cr.GetPositiveNonZeroDoubleOption("megsclamemory", megsClaMemory, true);
found += cr.GetPositiveNonZeroDoubleOption("availablememory", availableMemory, true);
if(found == -2) throw ErrorException("Either \"megsclamemory\" or \"availablememory\" must be specified in conf!");
errors += cr.GetStringOption("datafname", datafname);
errors += cr.GetStringOption("ofprefix", ofprefix);
errors += cr.GetStringOption("streefname", streefname);
cr.GetStringOption("constraintfile", constraintfile, true);
errors += cr.GetIntNonZeroOption("randseed", randseed);
cr.GetIntNonZeroOption("bootstrapseed", bootstrapSeed, true);
errors += cr.GetBoolOption("refinestart", refineStart);
cr.GetBoolOption("refineend", refineEnd, true);
errors += cr.GetBoolOption("outputeachbettertopology", outputTreelog);
errors += cr.GetBoolOption("enforcetermconditions", enforceTermConditions);
errors += cr.GetUnsignedNonZeroOption("genthreshfortopoterm", lastTopoImproveThresh);
errors += cr.GetPositiveNonZeroDoubleOption("scorethreshforterm", improveOverStoredIntervalsThresh);
cr.GetPositiveNonZeroDoubleOption("significanttopochange", significantTopoChange, true);
cr.GetUnsignedNonZeroOption("attachmentspertaxon", attachmentsPerTaxon, true);
cr.GetUnsignedOption("outputsitelikelihoods", outputSitelikelihoods, true);
cr.GetBoolOption("reportrunprogress", reportRunProgress, true);
cr.GetBoolOption("optimizeinputonly", optimizeInputOnly, true);
cr.GetBoolOption("ignorestopcodons", ignoreStopCodons, true);
cr.GetBoolOption("outputmostlyuselessfiles", outputMostlyUselessFiles, true);
cr.GetBoolOption("outputphyliptree", outputPhylipTree, true);
cr.GetBoolOption("collapsebranches", collapseBranches, true);
cr.GetIntOption("genthreshforswapterm", swapTermThreshold, true);
cr.GetStringOption("arbitrarystring", arbitraryString, true);
cr.GetUnsignedOption("windowlength", siteWindowLength, true);
cr.GetUnsignedOption("windowstride", siteWindowStride, true);
cr.GetBoolOption("usepatternmanager", usePatternManager, true);
cr.GetStringOption("parametervaluestring", parameterValueString, true);
cr.GetBoolOption("combineadjacentidenticalgappatterns", combineAdjacentIdenticalGapPatterns, true);
cr.GetBoolOption("rootatbranchmidpoint", rootAtBranchMidpoint, true);
cr.GetBoolOption("useoptboundedforblen", useOptBoundedForBlen, true);
//changed the wording of this from besttree to besttopology, to match outputeachbettertopology
//still allow besttree, since that is what I told Maddison, and I think has already been incorporated
//into Mesquite
int ret = cr.GetBoolOption("outputcurrentbesttopology", outputCurrentBestTopology, true);
if(ret < 0)
cr.GetBoolOption("outputcurrentbesttree", outputCurrentBestTopology, true);
cr.GetBoolOption("restart", restart, true);
cr.GetBoolOption("writecheckpoints", checkpoint, true);
cr.GetUnsignedNonZeroOption("searchreps", searchReps, true);
cr.GetUnsignedOption("runmode", runmode, true);
cr.GetBoolOption("scoreonly", scoreOnly, true);
//These three used to be in the [master] section, for no apparent reason. Now allowed in [general]
//as well. If in both, will be overridden by master
cr.GetUnsignedOption("bootstrapreps", bootstrapReps, true);
cr.GetPositiveNonZeroDoubleOption("resampleproportion", resampleProportion, true);
cr.GetBoolOption("inferinternalstateprobs", inferInternalStateProbs, true);
cr.GetBoolOption("workphasedivision", workPhaseDivision, true);
bool multipleModelsFound = ReadPossibleModelPartition(cr);
if(!multipleModelsFound){//if we didn't find multiple models in separate model sections, look for them in
ConfigModelSettings configModSet;
int settingsFound = 0;
settingsFound += cr.GetStringOption("ratehetmodel", configModSet.rateHetModel, true);
settingsFound += cr.GetUnsignedOption("numratecats", configModSet.numRateCats, true);
settingsFound += cr.GetStringOption("statefrequencies", configModSet.stateFrequencies, true);
settingsFound += cr.GetStringOption("ratematrix", configModSet.rateMatrix, true);
settingsFound += cr.GetStringOption("invariantsites", configModSet.proportionInvariant, true);
settingsFound += cr.GetStringOption("datatype", configModSet.datatype, true);
settingsFound += cr.GetStringOption("geneticcode", configModSet.geneticCode, true);
if(settingsFound == -7)
throw ErrorException("No model descriptions found in config file. Proper setup is either:\n\t1. Model settings found somewhere under [general] heading,\n\t applying to all data subsets\n\t2. Separate model settings for each partition subset\n\t found under different headings [model1], [model2]. etc");
configModelSets.push_back(configModSet);
}
cr.GetBoolOption("linkmodels", linkModels, true);
cr.GetBoolOption("subsetspecificrates", subsetSpecificRates, true);
cr.GetStringOption("outgroup", outgroupString, true);
if(isMaster){
errors += cr.SetSection("master");
//.........这里部分代码省略.........