本文整理汇总了C++中yarp::os::Bottle::check方法的典型用法代码示例。如果您正苦于以下问题:C++ Bottle::check方法的具体用法?C++ Bottle::check怎么用?C++ Bottle::check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yarp::os::Bottle
的用法示例。
在下文中一共展示了Bottle::check方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkVectorExistInConfiguration
bool checkVectorExistInConfiguration(yarp::os::Bottle & bot,
const std::string & name,
const int expected_vec_size)
{
//std::cerr << " checkVectorExistInConfiguration(" << name
// << " , " << expected_vec_size << " )" << std::endl;
//std::cerr << "bot.check(name) : " << bot.check(name) << std::endl;
//std::cerr << "bot.find(name).isList(): " << bot.find(name).isList() << std::endl;
//std::cerr << "bot.find(name).asList()->size() : " << bot.find(name).asList()->size()<< std::endl;
return (bot.check(name) &&
bot.find(name).isList() &&
bot.find(name).asList()->size() == expected_vec_size );
}
示例2: addNewDrive
bool homeostaticModule::addNewDrive(string driveName, yarp::os::Bottle& grpHomeostatic)
{
Drive* drv = new Drive(driveName);
drv->setHomeostasisMin(grpHomeostatic.check((driveName + "-homeostasisMin"), Value(drv->homeostasisMin)).asDouble());
drv->setHomeostasisMax(grpHomeostatic.check((driveName + "-homeostasisMax"), Value(drv->homeostasisMax)).asDouble());
cout << "H1 " << grpHomeostatic.check((driveName + "-decay"), Value(drv->decay)).asDouble() <<endl;
drv->setDecay(grpHomeostatic.check((driveName + "-decay"), Value(drv->decay)).asDouble());
drv->setValue((drv->homeostasisMax + drv->homeostasisMin) / 2.);
drv->setGradient(grpHomeostatic.check((driveName + "-gradient"), Value(drv->gradient)).asBool());
cout << "h2 " << drv->decay << endl;
//cout << drv->name << " " << drv->homeostasisMin << " " << drv->homeostasisMax << " " << drv->decay << " " <<drv->gradient << endl;
//cout << d << endl;
//cout << grpHomeostatic.toString()<<endl;
manager.addDrive(drv);
cout << "h2 " << manager.drives[0]->decay << endl;
openPorts(driveName);
return true;
}
示例3: apply
bool NameServiceOnTriples::apply(yarp::os::Bottle& cmd,
yarp::os::Bottle& reply,
yarp::os::Bottle& event,
const yarp::os::Contact& remote) {
ConstString key = cmd.get(0).toString();
ConstString prefix = " * ";
access.wait();
if (key=="register") {
lastRegister = cmd.get(1).asString().c_str();
} else if (key=="set") {
if (cmd.get(1).asString()==lastRegister.c_str()) {
prefix = " + ";
}
} else {
lastRegister = "";
}
if (!silent) {
printf("%s%s\n",
prefix.c_str(),
cmd.toString().c_str());
}
access.post();
TripleSource& mem = *db;
//mem.begin();
mem.reset();
reply.clear();
NameTripleState act(cmd,reply,event,remote,mem);
if (cmd.check("format")) {
if (cmd.find("format")=="json") {
act.bottleMode = true;
}
}
if (key == "NAME_SERVER") {
cmd = cmd.tail();
key = cmd.get(0).asString();
}
if (key == "bot") {
act.bottleMode = true;
cmd = cmd.tail();
key = cmd.get(0).asString();
}
if (key=="register") {
return cmdRegister(act);
} else if (key=="unregister") {
return cmdUnregister(act);
} else if (key=="query") {
return cmdQuery(act);
} else if (key=="list") {
return cmdList(act);
} else if (key=="set") {
return cmdSet(act);
} else if (key=="get") {
return cmdGet(act);
} else if (key=="check") {
return cmdCheck(act);
} else if (key=="route") {
return cmdRoute(act);
} else if (key=="gc") {
return cmdGc(act);
} else if (key=="help") {
return cmdHelp(act);
} else {
// not understood
act.reply.addString("old");
}
//mem.end();
return true;
}