本文整理汇总了C++中ArgumentParser::getCString方法的典型用法代码示例。如果您正苦于以下问题:C++ ArgumentParser::getCString方法的具体用法?C++ ArgumentParser::getCString怎么用?C++ ArgumentParser::getCString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArgumentParser
的用法示例。
在下文中一共展示了ArgumentParser::getCString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTypes
TypeVec getTypes()
{
TypeVec types;
// init types with predefined species (if any)
vector<string> species = strsplit(args.getCString("species"));
for (size_t i = 0; i < species.size(); ++i)
{
types.push_back(Type(species[i].c_str(), types.size()));
}
return types;
}
示例2: getCoordCutoffs
SquareSelector<double> getCoordCutoffs(const TypeVec &types)
{
vector<string> cutstrs = strsplit(args.getCString("coordinationCutoffs"));
if (cutstrs.size() != 0)
{
if (types.size() == 0)
{
cerr << "coordinationCutoffs: species not defined" << endl;
exit(1);
}
if (cutstrs.size() < types.size() * types.size())
{
cerr
<< "coordinationCutoffs: too few values. Must be number of species squared"
<< endl;
exit(1);
}
if (cutstrs.size() > types.size() * types.size())
{
cerr
<< "coordinationCutoffs: too many values. Must be number of species squared"
<< endl;
exit(1);
}
vector<double> cutoffs(cutstrs.size());
for (size_t i = 0; i < cutstrs.size(); ++i)
{
double value;
if (convert(cutstrs[i].c_str(), &value))
{
cerr << "coordinationCutoffs: invalid double value '"
<< cutstrs[i].c_str() << "'" << endl;
exit(1);
}
cutoffs[i] = value;
}
return SquareSelector<double>(cutoffs);
}
return SquareSelector<double>(vector<double>());
}