本文整理汇总了C++中RpcServer类的典型用法代码示例。如果您正苦于以下问题:C++ RpcServer类的具体用法?C++ RpcServer怎么用?C++ RpcServer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RpcServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
RpcServer server;
RpcServerOptions option;
option.net_threads_num = 1;
option.worker_threads_num = 1;
server.set_options(option);
comcfg::Configure conf;
if (conf.load("./conf", "rpc_server.conf") != 0) {
std::cerr << "load conf/rpc_server.conf fail" << std::endl;
}
comlog_init(conf["log"]);
EchoServiceImpl echo_service_impl;
if (server.RegisterService(&echo_service_impl) != 0) {
std::cerr << "register service fail" << std::endl;
return -1;
}
if (server.Start("127.0.0.1:60006")) {
std::cerr << "start server fail" << std::endl;
return -1;
}
return server.WaitForStop();
}
示例2: main
int main(int argc, char *argv[]) {
Network yarp;
RpcServer server;
server.promiseType(Type::byNameOnWire("rospy_tutorials/AddTwoInts"));
if (!server.open("/[email protected]/yarp_add_int_server")) {
fprintf(stderr,"Failed to open port\n");
return 1;
}
while (true) {
Bottle msg, reply;
if (!server.read(msg,true)) continue;
int x = msg.get(0).asInt32();
int y = msg.get(1).asInt32();
int sum = x + y;
reply.addInt32(sum);
printf("Got %d + %d, answering %d\n", x, y, sum);
server.reply(reply);
}
return 0;
}
示例3: close
bool close()
{
rpc.interrupt();
rpc.close();
speaker.stop();
return true;
}
示例4: close
bool close()
{
rpcPort.interrupt();
rpcPort.close();
dumpPort.interrupt();
dumpPort.close();
opc.interrupt();
opc.close();
return true;
}
示例5: configure
bool configure(ResourceFinder &rf)
{
rf1=rf;
if(algorithm==1)
loc5=new UnscentedParticleFilter();
else
loc5=new ScalingSeries();
loc5->configure(rf1);
state=0;
meas_given=1;
if(loc5->measurementsString!=1)
{
namePorts = rf.check("namePorts", Value("visual-localization"), "Getting module name").asString();
portIn.open("/"+namePorts+"/pnt:i");
rpcOut.open("/"+namePorts+"/toolFeat:rpc");
meas_given=0;
}
cout<<"meas_given "<<meas_given<<endl;
error_thres=loc5->error_thres;
cout<<"thresconf "<<error_thres<<endl;
rpcPort.open(("/"+namePorts+"/rpc").c_str());
attach(rpcPort);
delete loc5;
return true;
}
示例6: close
bool close()
{
save();
dispose();
rpcPort.close();
return true;
}
示例7: interruptModule
bool interruptModule()
{
rpcPort.interrupt();
dumpPort.interrupt();
opc.interrupt();
return true;
}
示例8: interruptModule
bool interruptModule()
{
closing = true;
handlerPort.interrupt();
cout<<"Interrupting your module, for port cleanup"<<endl;
return true;
}
示例9: configure
/*
* Configure function. Receive a previously initialized
* resource finder object. Use it to configure your module.
* Open port and attach it to message handler.
*/
bool configure(yarp::os::ResourceFinder &rf)
{
count=0;
handlerPort.open("/myModule");
attach(handlerPort);
return true;
}
示例10: close
bool close()
{
rpcPort.close();
iPort.close();
oPort.close();
return true;
}
示例11: interruptModule
bool interruptModule()
{
imgInPort.interrupt();
imgOutPort.interrupt();
dataOutPort.interrupt();
rpcPort.interrupt();
return true;
}
示例12: close
bool close()
{
imgInPort.close();
imgOutPort.close();
dataOutPort.close();
rpcPort.close();
return true;
}
示例13: interruptModule
bool interruptModule()
{
cout<<"Interrupt caught!"<<endl;
cout<<endl;
handlerPort.interrupt();
objectsPort.interrupt();
return true;
}
示例14: configure
bool configure(ResourceFinder &rf)
{
iPort.open("/tracker:i");
oPort.open("/tracker:o");
rpcPort.open("/tracker:rpc");
attach(rpcPort);
state=idle;
return true;
}
示例15: close
bool close()
{
portDispIn.close();
portDispOut.close();
portOutPoints.close();
portImgIn.close();
portContour.close();
portSFM.close();
portRpc.close();
return true;
}