portable_pair.cpp
来自「一个语言识别引擎」· C++ 代码 · 共 35 行
CPP
35 行
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
#include <ace/config.h>
#include <yarp/os/all.h>
#include <yarp/sig/all.h>
using namespace yarp::os;
using namespace yarp::sig;
int main(int argc, char *argv[]) {
Network::init();
Port port;
PortablePair<Bottle,Vector> pp;
port.open("/pp");
pp.head.fromString("this is the bottle part");
int ct = 1;
int ct2 = 1;
while (true) {
Vector v(3);
v[0] = ct;
v[1] = ct2;
v[2] = ct*ct2;
pp.body = v;
port.write(pp);
printf("Sent output to %s...\n", port.getName().c_str());
ct++;
if (ct>10) {
ct2 = 1+(ct2+1)%10;
ct = 1;
}
Time::delay(0.25);
}
Network::fini();
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?