本文整理汇总了C++中ConfigReader::readConfigFile方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigReader::readConfigFile方法的具体用法?C++ ConfigReader::readConfigFile怎么用?C++ ConfigReader::readConfigFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigReader
的用法示例。
在下文中一共展示了ConfigReader::readConfigFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
string strConfigFile;
ConfigReader cr;
ImageData *idata = new ImageDataFloat();
TrainingSetSelection<float> *pTrainingSet;
bool bTestAll = false;
int optNumTrees=-1;
char *optTreeFnamePrefix=NULL;
char buffer[2048];
int optNoImages=12;
srand((unsigned int)time(0));
setlocale(LC_NUMERIC, "C");
profiling(NULL);
#ifndef NDEBUG
std::cout << "******************************************************\n"
<< "DEBUG MODE!!!!!\n"
<< "******************************************************\n";
#endif
if (argc!=4)
usage(*argv);
else
{
strConfigFile = argv[1];
optNumTrees = atoi(argv[2]);
optTreeFnamePrefix = argv[3];
}
if (cr.readConfigFile(strConfigFile)==false)
{
cout<<"Failed to read config file "<<strConfigFile<<endl;
return -1;
}
if (!canMapHostMemory())
{
cout << "Cannot map host memory" << endl;
return -1;
}
// Load image data
idata->bGenerateFeatures = true;
if (idata->setConfiguration(cr)==false)
{
cout<<"Failed to initialize image data with configuration"<<endl;
return -1;
}
if (bTestAll==true)
{
std::cout << "Set contains all images. Not supported.\n";
exit(1);
}
else {
// CW Create a dummy training set selection with a single image number
pTrainingSet = new TrainingSetSelection<float>(9, idata);
for (int i=0; i<optNoImages; ++i)
((TrainingSetSelection<float> *)pTrainingSet)->vectSelectedImagesIndices.push_back(i);
}
#ifndef SHUT_UP
cout<<pTrainingSet->getNbImages()<<" test images"<<endl;
#endif
// Load forest
StrucClassSSF<float> *forest = new StrucClassSSF<float>[optNumTrees];
profiling("Init + feature extraction");
cr.numTrees = optNumTrees;
#ifndef SHUT_UP
cout << "Loading " << cr.numTrees << " trees: \n";
#endif
for(int iTree = 0; iTree < optNumTrees; ++iTree)
{
sprintf(buffer, "%s%d.txt", optTreeFnamePrefix, iTree + 1);
#ifndef SHUT_UP
std::cout << "Loading tree from file " << buffer << "\n";
#endif
forest[iTree].bUseRandomBoxes = true;
forest[iTree].load(buffer);
forest[iTree].setTrainingSet(pTrainingSet);
}
#ifndef SHUT_UP
cout << "done!" << endl;
#endif
profiling("Tree loading");
testStructClassForest(forest, &cr, pTrainingSet);
// delete tree;
delete pTrainingSet;
//.........这里部分代码省略.........
示例2: main
//.........这里部分代码省略.........
{
usage(argv[0]);
fprintf(stderr, "Missing argument for %s\n", argv[cmdlnIndex]);
return 1;
}
fcpPath = argv[cmdlnIndex + 1];
cmdlnIndex += 2;
}
else
{
usage(argv[0]);
fprintf(stderr, "Unknown argument '%s'\n", argv[cmdlnIndex]);
return 1;
}
}
}
catch (const char*& ex)
{
usage(argv[0]);
fprintf(stderr, "\nFailed to parse arguments:\n%s\n", ex);
return 1;
}
catch (...)
{
usage(argv[0]);
fprintf(stderr, "\nFailed to parse arguments:\nUnknown exception thrown\n");
return 1;
}
if (xmlCommandPath.size() != 0)
{
ConfigReader appConfig;
appConfig.readConfigFile(xmlCommandPath);
cout << "Application verbose= " << appConfig.getVerbose() << endl;
cout << "Application prefix= " << appConfig.getPrefix() << endl;
std::string test = "TRUE";
ostringstream test_ss;
test_ss << test;
if (appConfig.getVerbose() == test_ss.str())
{
verbose = true;
}
if (appConfig.getGroupOnly() == test_ss.str())
{
createAAFGroupOnly = true;
}
if (appConfig.getGroup() == test_ss.str())
{
createAAFGroup = true;
}
if (appConfig.getMultiCam() == test_ss.str())
{
createMultiCam = true;
}
if (appConfig.getNTSC() == test_ss.str())
{
isPAL = false;
}
if (appConfig.getFCP() == test_ss.str())
{
fcpxml = true;
fcpPath = appConfig.getEditPath();
}