本文整理汇总了C++中NodeArgs::success方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeArgs::success方法的具体用法?C++ NodeArgs::success怎么用?C++ NodeArgs::success使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeArgs
的用法示例。
在下文中一共展示了NodeArgs::success方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: requestTopic
void requestTopic(NodeArgs& na)
{
std::string topic = na.args.get(0).asString();
topic = fromRosName(topic);
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;
}
Value v;
Bottle* lst = v.asList();
lst->addString("TCPROS");
lst->addString(c.getHost());
lst->addInt32(c.getPort());
na.reply = v;
na.success();
return;
}
na.fail("Cannot find topic");
}
示例2: requestTopic
void requestTopic(NodeArgs& na) {
ConstString topic = na.args.get(0).asString();
Contact c = lookup(topic);
if (!c.isValid()) {
na.fail("Cannot find topic");
return;
}
na.reply.addString("TCPROS");
na.reply.addString(c.getHost());
na.reply.addInt(c.getPort());
na.success();
}
示例3: getPublications
void getPublications(NodeArgs& na) {
mutex.lock();
for (std::map<ConstString,NodeItem>::iterator it = by_part_name.begin(); it != by_part_name.end(); it++) {
NodeItem& item = it->second;
if (!item.isPublisher()) continue;
item.update();
Bottle& lst = na.reply.addList();
lst.addString(item.nc.getNestedName());
lst.addString(item.nc.getTypeName());
}
mutex.unlock();
na.success();
}
示例4: getBusInfo
void getBusInfo(NodeArgs& na)
{
unsigned int opaque_id = 1;
ROSReport report;
Value v;
Bottle* connections = v.asList();
mutex.lock();
for (std::multimap<std::string, NodeItem>::iterator it = by_part_name.begin(); it != by_part_name.end(); ++it) {
NodeItem& item = it->second;
if (!(item.isSubscriber() || item.isPublisher())) {
continue;
}
item.update();
item.contactable->getReport(report);
}
mutex.unlock();
for (std::multimap<std::string, std::string>::const_iterator it = report.outgoingURIs.begin(); it != report.outgoingURIs.end(); ++it) {
Bottle& lst = connections->addList();
lst.addInt32(opaque_id); // connectionId
lst.addString(it->second);
lst.addString("o");
lst.addString("TCPROS");
NestedContact nc(it->first);
lst.addString(toRosName(nc.getNestedName()));
opaque_id++;
}
for (std::multimap<std::string, std::string>::const_iterator it = report.incomingURIs.begin(); it != report.incomingURIs.end(); ++it) {
Bottle& lst = connections->addList();
lst.addInt32(opaque_id); // connectionId
lst.addString(it->second);
lst.addString("i");
lst.addString("TCPROS");
NestedContact nc(it->first);
lst.addString(toRosName(nc.getNestedName()));
opaque_id++;
}
if (connections->size() == 0) {
connections->addList(); // add empty list
}
na.reply = v;
na.success();
}
示例5: getPublications
void getPublications(NodeArgs& na)
{
Value v;
Bottle* publications = v.asList();
mutex.lock();
for (std::multimap<std::string, NodeItem>::iterator it = by_part_name.begin(); it != by_part_name.end(); ++it) {
NodeItem& item = it->second;
if (!item.isPublisher()) {
continue;
}
item.update();
Bottle& lst = publications->addList();
lst.addString(toRosName(item.nc.getNestedName()));
lst.addString(item.nc.getTypeName());
}
mutex.unlock();
na.reply = v;
na.success();
}
示例6: getPublications
void getPublications(NodeArgs& na)
{
Value v;
Bottle* publications = v.asList();
mutex.lock();
for (auto& it : by_part_name) {
NodeItem& item = it.second;
if (!item.isPublisher()) {
continue;
}
item.update();
Bottle& lst = publications->addList();
lst.addString(toRosName(item.nc.getNestedName()));
lst.addString(item.nc.getTypeName());
}
mutex.unlock();
na.reply = v;
na.success();
}
示例7: getPid
void getPid(NodeArgs& na) {
na.reply.addInt(ACE_OS::getpid());
na.success();
}
示例8: getBusInfo
void getBusInfo(NodeArgs& na) {
na.reply.addList();
na.success();
}
示例9: getBusStats
void getBusStats(NodeArgs& na) {
na.reply.addList();
na.success();
}
示例10: getPid
void getPid(NodeArgs& na)
{
na.reply = Value(static_cast<int>(yarp::os::getpid()));
na.success();
}
示例11: getMasterUri
void getMasterUri(NodeArgs& na)
{
na.reply = Value(NetworkBase::getEnvironment("ROS_MASTER_URI"));
na.success();
}
示例12: getBusStats
void getBusStats(NodeArgs& na)
{
na.reply = Value();
na.success();
}