本文整理汇总了C++中yarp::os::Searchable::getMonitor方法的典型用法代码示例。如果您正苦于以下问题:C++ Searchable::getMonitor方法的具体用法?C++ Searchable::getMonitor怎么用?C++ Searchable::getMonitor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yarp::os::Searchable
的用法示例。
在下文中一共展示了Searchable::getMonitor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: open
bool DeviceGroup::open(const char *key, PolyDriver& poly,
yarp::os::Searchable& config, const char *comment) {
Value *name;
if (config.check(key,name,comment)) {
if (name->isString()) {
// maybe user isn't doing nested configuration
yarp::os::Property p;
p.setMonitor(config.getMonitor(),
name->toString().c_str()); // pass on any monitoring
p.fromString(config.toString());
p.put("device",name->toString());
p.unput("subdevice");
p.unput("wrapped");
poly.open(p);
} else {
Bottle subdevice = config.findGroup(key).tail();
poly.open(subdevice);
}
if (!poly.isValid()) {
printf("cannot make <%s>\n", name->toString().c_str());
return false;
}
} else {
printf("\"--%s <name>\" not set\n", key);
return false;
}
return true;
}
示例2: open
bool PolyDriver::open(yarp::os::Searchable& config) {
if (isValid()) {
// already open - should close first
return false;
}
if (system_resource==NULL) {
system_resource = new YarpDevMonitor;
}
yAssert(system_resource!=NULL);
bool removeMonitorAfterwards = false;
if (config.getMonitor()==NULL) {
config.setMonitor(&HELPER(system_resource));
removeMonitorAfterwards = true;
}
//dd = Drivers::factory().open(config);
coreOpen(config);
HELPER(system_resource).info.fromString(config.toString());
if (removeMonitorAfterwards) {
config.setMonitor(NULL);
}
return isValid();
}
示例3: open
bool ServerFrameGrabber::open(yarp::os::Searchable& config) {
if (active) {
printf("Did you just try to open the same ServerFrameGrabber twice?\n");
return false;
}
// for AV, control whether output goes on a single port or multiple
bool separatePorts = false;
p.setReader(*this);
yarp::os::Value *name;
if (config.check("subdevice",name,"name (or nested configuration) of device to wrap")) {
if (name->isString()) {
// maybe user isn't doing nested configuration
yarp::os::Property p;
p.setMonitor(config.getMonitor(),
name->toString().c_str()); // pass on any monitoring
p.fromString(config.toString());
p.put("device",name->toString());
p.unput("subdevice");
poly.open(p);
} else {
Bottle subdevice = config.findGroup("subdevice").tail();
poly.open(subdevice);
}
if (!poly.isValid()) {
//printf("cannot make <%s>\n", name->toString().c_str());
return false;
}
} else {
printf("\"--subdevice <name>\" not set for server_framegrabber\n");
return false;
}
if (poly.isValid()) {
IAudioVisualStream *str;
poly.view(str);
bool a = true;
bool v = true;
bool vraw = true;
if (str!=NULL) {
a = str->hasAudio();
v = str->hasVideo();
vraw = str->hasRawVideo();
}
if (v) {
poly.view(fgImage);
}
if (vraw) {
poly.view(fgImageRaw);
}
if (a) {
poly.view(fgSound);
}
if (a&&v) {
poly.view(fgAv);
}
poly.view(fgCtrl);
poly.view(fgTimed);
}
canDrop = !config.check("no_drop","if present, use strict policy for sending data");
addStamp = config.check("stamp","if present, add timestamps to data");
p.promiseType(Type::byName("yarp/image")); // TODO: reflect audio options
p.setWriteOnly();
p.open(config.check("name",Value("/grabber"),
"name of port to send data on").asString());
/*
double framerate=0;
if (config.check("framerate", name,
"maximum rate in Hz to read from subdevice")) {
framerate=name->asDouble();
}
*/
if (fgAv&&
!config.check("shared-ports",
"If present, send audio and images on same port")) {
separatePorts = true;
yAssert(p2==NULL);
p2 = new Port;
yAssert(p2!=NULL);
p2->open(config.check("name2",Value("/grabber2"),
"Name of second port to send data on, when audio and images sent separately").asString());
}
if (fgAv!=NULL) {
if (separatePorts) {
yAssert(p2!=NULL);
thread.attach(new DataWriter2<yarp::sig::ImageOf<yarp::sig::PixelRgb>, yarp::sig::Sound>(p,*p2,*this,canDrop,addStamp));
} else {
thread.attach(new DataWriter<ImageRgbSound>(p,*this,canDrop,
addStamp));
}
} else if (fgImage!=NULL) {
thread.attach(new DataWriter<yarp::sig::ImageOf<yarp::sig::PixelRgb> >(p,*this,canDrop,addStamp,fgTimed));
} else if (fgImageRaw!=NULL) {
//.........这里部分代码省略.........
示例4: coreOpen
bool PolyDriver::coreOpen(yarp::os::Searchable& prop) {
yarp::os::Searchable *config = ∝
Property p;
ConstString str = prop.toString();
Value *part;
if (prop.check("device",part)) {
str = part->toString().c_str();
}
Bottle bot(str.c_str());
if (bot.size()>1) {
// this wasn't a device name, but some codes -- rearrange
p.fromString(str.c_str());
str = p.find("device").asString().c_str();
config = &p;
}
DeviceDriver *driver = NULL;
DriverCreator *creator = Drivers::factory().find(str.c_str());
if (creator!=NULL) {
Value *val;
if (config->check("wrapped",val)&&(creator->getWrapper()!="")) {
ConstString wrapper = creator->getWrapper();
DriverCreator *wrapCreator =
Drivers::factory().find(wrapper.c_str());
if (wrapCreator!=NULL) {
p.fromString(config->toString());
p.unput("wrapped");
config = &p;
if (wrapCreator!=creator) {
p.put("subdevice",str.c_str());
p.put("device",wrapper.c_str());
p.setMonitor(prop.getMonitor(),
wrapper.c_str()); // pass on any monitoring
driver = wrapCreator->create();
creator = wrapCreator;
} else {
// already wrapped
driver = creator->create();
}
}
} else {
driver = creator->create();
}
} else {
// FIXME do not use yarpdev here
printf("yarpdev: ***ERROR*** could not find device <%s>\n", str.c_str());
}
if (driver!=NULL) {
PolyDriver *manager = creator->owner();
if (manager!=NULL) {
link(*manager);
return true;
}
//printf("yarpdev: parameters are %s\n", config->toString().c_str());
bool ok = driver->open(*config);
if (!ok) {
printf("yarpdev: ***ERROR*** driver <%s> was found but could not open\n", config->find("device").toString().c_str());
//YARP_DEBUG(Logger::get(),String("Discarding ") + str);
delete driver;
//YARP_DEBUG(Logger::get(),String("Discarded ") + str);
driver = NULL;
} else {
yarp::dev::DeprecatedDeviceDriver *ddd = NULL;
driver->view(ddd);
if(ddd) {
if(config->check("allow-deprecated-devices")) {
yWarning("Device \"%s\" is deprecated. Opening since the \"allow-deprecated-devices\" option was passed in the configuration.", str.c_str());
} else {
yError("Device \"%s\" is deprecated. Pass the \"allow-deprecated-devices\" option in the configuration if you want to open it anyway.", str.c_str());
driver->close();
delete driver;
return false;
}
}
if (creator!=NULL) {
ConstString name = creator->getName();
ConstString wrapper = creator->getWrapper();
ConstString code = creator->getCode();
yInfo("created %s <%s>. See C++ class %s for documentation.",
((name==wrapper)?"wrapper":"device"),
name.c_str(),
code.c_str());
}
}
dd = driver;
return true;
}
return false;
}