本文整理汇总了C++中Option::isDefined方法的典型用法代码示例。如果您正苦于以下问题:C++ Option::isDefined方法的具体用法?C++ Option::isDefined怎么用?C++ Option::isDefined使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Option
的用法示例。
在下文中一共展示了Option::isDefined方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doAll
/**
* The entry point for console version of ShowGraph
*/
static int doAll( int argc, char **argv)
{
QApplication app(argc, argv);
app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
Conf conf;
conf.addOption( new Option( OPT_STRING, "f", "file", "input graph description file name"));
conf.addOption( new Option( OPT_STRING, "o", "output", "output image file name"));
conf.readArgs( argc, argv);
Option *fopt = conf.longOption("file");
Option *out_opt = conf.longOption("output");
assertd( isNotNullP( fopt));
assertd( isNotNullP( out_opt));
if ( fopt->isDefined())
{
QString xmlname = fopt->string();
QString outname("image.png");
Renderer r;
if ( out_opt->isDefined())
{
outname = out_opt->string();
}
r.render( xmlname, outname);
} else
{
conf.printOpts(); // Print options to console
}
//return app.exec();
return 0;
}
示例2: findPlane
PlaneVisionMessage Vision::findPlane(IplImage* image, double blobX, double blobY){
if(image == nullptr){
return PlaneVisionMessage();
}
vector<ImageMessage> extras;
pair<CvBlobs,IplImage*> candidatesWithLabel = findCandidates(image,extras);
auto candidates = candidatesWithLabel.first;
Option<CvBlob> bestCandidate = None<CvBlob>();
double bestDistance = DBL_MAX;
for (CvBlobs::const_iterator it=candidates.begin(); it!=candidates.end(); ++it){
auto blob = it->second;
double dx = blob->centroid.x - blobX;
double dy = blob->centroid.y - blobY;
if (dx * dx + dy * dy < bestDistance){
bestDistance = dx * dx + dy * dy;
bestCandidate = Some<CvBlob>(*blob);
}
}
cvReleaseBlobs(candidates);
if (bestCandidate.isDefined()) {
return PlaneVisionMessage(*bestCandidate,image,extras,true);
} else {
return PlaneVisionMessage(image,extras);
}
}
示例3:
template<typename T> T StabConfig::getOpt(const QCommandLineParser &parser, ErrorMessageHelper &die,
const QCommandLineOption &opt, const Option<T> &min, const Option<T> &max, T def,
QString parseErrMsg, QString outOfRangeErrMsg) {
bool ok = false;
T i;
if (parser.isSet(opt)) {
if (is_same<int, T>::value)
i = parser.value(opt).toInt(&ok);
if (is_same<float, T>::value)
i = parser.value(opt).toFloat(&ok);
if (is_same<double, T>::value)
i = parser.value(opt).toDouble(&ok);
if (!ok) die << parseErrMsg;
if ((min.isDefined() && i < *min) || (max.isDefined() && i > *max))
die << outOfRangeErrMsg;
return i;
}
return def;
}