本文整理汇总了C++中NodeArgs::fromExternal方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeArgs::fromExternal方法的具体用法?C++ NodeArgs::fromExternal怎么用?C++ NodeArgs::fromExternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeArgs
的用法示例。
在下文中一共展示了NodeArgs::fromExternal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: publisherUpdate
void publisherUpdate(NodeArgs& na)
{
std::string topic = fromRosName(na.args.get(0).asString());
std::vector<Contact> contacts = query(topic, "-");
if (contacts.size() < 1) {
na.fail("Cannot find topic");
return;
}
for (std::vector<Contact>::iterator it = contacts.begin(); it != contacts.end(); ++it) {
Contact &c = *it;
if (!c.isValid()) {
continue;
}
c.setName("");
// just pass the message along, YARP ports know what to do with it
ContactStyle style;
style.admin = true;
style.carrier = "tcp";
Bottle reply;
if (!NetworkBase::write(c, na.request, reply, style)) {
continue;
}
na.fromExternal(reply);
}
}
示例2: publisherUpdate
void publisherUpdate(NodeArgs& na) {
ConstString topic = na.args.get(0).asString();
Contact c = lookup(topic);
if (!c.isValid()) {
na.fail("Cannot find topic");
return;
}
c = c.addName("");
// just pass the message along, YARP ports know what to do with it
ContactStyle style;
style.admin = true;
style.carrier = "tcp";
Bottle reply;
if (!NetworkBase::write(c,na.request,reply,style)) {
na.fail("Cannot communicate with local port");
return;
}
na.fromExternal(reply);
//printf("DONE with passing on publisherUpdate\n");
}