iCub-main
relay.cpp
Go to the documentation of this file.
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
16 #include <yarp/os/all.h>
17 #include <iostream>
18 
19 using namespace std;
20 using namespace yarp::os;
21 
22 int main(int argc, char **argv) {
23  Network yarp;
24  BufferedPort<Bottle> inPort;
25  inPort.open("/relay/in");
26 
27  BufferedPort<Bottle> outPort;
28  outPort.open("/relay/out");
29 
30  while (true) {
31  cout << "waiting for input" << endl;
32  Bottle *input = inPort.read();
33  if (input!=NULL)
34  {
35  Bottle& output = outPort.prepare();
36  output=*input;
37 
38  cout << "writing " << output.toString() << endl;
39  outPort.write();
40  }
41  }
42  return 0;
43 }
Definition: main.cpp:53
Copyright (C) 2008 RobotCub Consortium.
int main(int argc, char **argv)
Definition: relay.cpp:22