OnlineBodySchemaAdaptation  2.0
handPoseEstimation_IDL.cpp
1 // This is an automatically-generated file.
2 // It could get re-generated if the ALLOW_IDL_GENERATION flag is on.
3 
4 #include <handPoseEstimation_IDL.h>
5 #include <yarp/os/idl/WireTypes.h>
6 
7 
8 
9 class handPoseEstimation_IDL_start : public yarp::os::Portable {
10 public:
11  bool _return;
12  void init();
13  virtual bool write(yarp::os::ConnectionWriter& connection) YARP_OVERRIDE;
14  virtual bool read(yarp::os::ConnectionReader& connection) YARP_OVERRIDE;
15 };
16 
17 class handPoseEstimation_IDL_stop : public yarp::os::Portable {
18 public:
19  bool _return;
20  void init();
21  virtual bool write(yarp::os::ConnectionWriter& connection) YARP_OVERRIDE;
22  virtual bool read(yarp::os::ConnectionReader& connection) YARP_OVERRIDE;
23 };
24 
25 class handPoseEstimation_IDL_pause : public yarp::os::Portable {
26 public:
27  bool _return;
28  void init();
29  virtual bool write(yarp::os::ConnectionWriter& connection) YARP_OVERRIDE;
30  virtual bool read(yarp::os::ConnectionReader& connection) YARP_OVERRIDE;
31 };
32 
33 class handPoseEstimation_IDL_resume : public yarp::os::Portable {
34 public:
35  bool _return;
36  void init();
37  virtual bool write(yarp::os::ConnectionWriter& connection) YARP_OVERRIDE;
38  virtual bool read(yarp::os::ConnectionReader& connection) YARP_OVERRIDE;
39 };
40 
41 class handPoseEstimation_IDL_lastOffsets : public yarp::os::Portable {
42 public:
43  yarp::os::Bottle _return;
44  void init();
45  virtual bool write(yarp::os::ConnectionWriter& connection) YARP_OVERRIDE;
46  virtual bool read(yarp::os::ConnectionReader& connection) YARP_OVERRIDE;
47 };
48 
49 class handPoseEstimation_IDL_quit : public yarp::os::Portable {
50 public:
51  bool _return;
52  void init();
53  virtual bool write(yarp::os::ConnectionWriter& connection) YARP_OVERRIDE;
54  virtual bool read(yarp::os::ConnectionReader& connection) YARP_OVERRIDE;
55 };
56 
57 bool handPoseEstimation_IDL_start::write(yarp::os::ConnectionWriter& connection) {
58  yarp::os::idl::WireWriter writer(connection);
59  if (!writer.writeListHeader(1)) return false;
60  if (!writer.writeTag("start",1,1)) return false;
61  return true;
62 }
63 
64 bool handPoseEstimation_IDL_start::read(yarp::os::ConnectionReader& connection) {
65  yarp::os::idl::WireReader reader(connection);
66  if (!reader.readListReturn()) return false;
67  if (!reader.readBool(_return)) {
68  reader.fail();
69  return false;
70  }
71  return true;
72 }
73 
74 void handPoseEstimation_IDL_start::init() {
75  _return = false;
76 }
77 
78 bool handPoseEstimation_IDL_stop::write(yarp::os::ConnectionWriter& connection) {
79  yarp::os::idl::WireWriter writer(connection);
80  if (!writer.writeListHeader(1)) return false;
81  if (!writer.writeTag("stop",1,1)) return false;
82  return true;
83 }
84 
85 bool handPoseEstimation_IDL_stop::read(yarp::os::ConnectionReader& connection) {
86  yarp::os::idl::WireReader reader(connection);
87  if (!reader.readListReturn()) return false;
88  if (!reader.readBool(_return)) {
89  reader.fail();
90  return false;
91  }
92  return true;
93 }
94 
95 void handPoseEstimation_IDL_stop::init() {
96  _return = false;
97 }
98 
99 bool handPoseEstimation_IDL_pause::write(yarp::os::ConnectionWriter& connection) {
100  yarp::os::idl::WireWriter writer(connection);
101  if (!writer.writeListHeader(1)) return false;
102  if (!writer.writeTag("pause",1,1)) return false;
103  return true;
104 }
105 
106 bool handPoseEstimation_IDL_pause::read(yarp::os::ConnectionReader& connection) {
107  yarp::os::idl::WireReader reader(connection);
108  if (!reader.readListReturn()) return false;
109  if (!reader.readBool(_return)) {
110  reader.fail();
111  return false;
112  }
113  return true;
114 }
115 
116 void handPoseEstimation_IDL_pause::init() {
117  _return = false;
118 }
119 
120 bool handPoseEstimation_IDL_resume::write(yarp::os::ConnectionWriter& connection) {
121  yarp::os::idl::WireWriter writer(connection);
122  if (!writer.writeListHeader(1)) return false;
123  if (!writer.writeTag("resume",1,1)) return false;
124  return true;
125 }
126 
127 bool handPoseEstimation_IDL_resume::read(yarp::os::ConnectionReader& connection) {
128  yarp::os::idl::WireReader reader(connection);
129  if (!reader.readListReturn()) return false;
130  if (!reader.readBool(_return)) {
131  reader.fail();
132  return false;
133  }
134  return true;
135 }
136 
137 void handPoseEstimation_IDL_resume::init() {
138  _return = false;
139 }
140 
141 bool handPoseEstimation_IDL_lastOffsets::write(yarp::os::ConnectionWriter& connection) {
142  yarp::os::idl::WireWriter writer(connection);
143  if (!writer.writeListHeader(1)) return false;
144  if (!writer.writeTag("lastOffsets",1,1)) return false;
145  return true;
146 }
147 
148 bool handPoseEstimation_IDL_lastOffsets::read(yarp::os::ConnectionReader& connection) {
149  yarp::os::idl::WireReader reader(connection);
150  if (!reader.readListReturn()) return false;
151  if (!reader.read(_return)) {
152  reader.fail();
153  return false;
154  }
155  return true;
156 }
157 
158 void handPoseEstimation_IDL_lastOffsets::init() {
159 }
160 
161 bool handPoseEstimation_IDL_quit::write(yarp::os::ConnectionWriter& connection) {
162  yarp::os::idl::WireWriter writer(connection);
163  if (!writer.writeListHeader(1)) return false;
164  if (!writer.writeTag("quit",1,1)) return false;
165  return true;
166 }
167 
168 bool handPoseEstimation_IDL_quit::read(yarp::os::ConnectionReader& connection) {
169  yarp::os::idl::WireReader reader(connection);
170  if (!reader.readListReturn()) return false;
171  if (!reader.readBool(_return)) {
172  reader.fail();
173  return false;
174  }
175  return true;
176 }
177 
178 void handPoseEstimation_IDL_quit::init() {
179  _return = false;
180 }
181 
182 handPoseEstimation_IDL::handPoseEstimation_IDL() {
183  yarp().setOwner(*this);
184 }
186  bool _return = false;
187  handPoseEstimation_IDL_start helper;
188  helper.init();
189  if (!yarp().canWrite()) {
190  yError("Missing server method '%s'?","bool handPoseEstimation_IDL::start()");
191  }
192  bool ok = yarp().write(helper,helper);
193  return ok?helper._return:_return;
194 }
196  bool _return = false;
197  handPoseEstimation_IDL_stop helper;
198  helper.init();
199  if (!yarp().canWrite()) {
200  yError("Missing server method '%s'?","bool handPoseEstimation_IDL::stop()");
201  }
202  bool ok = yarp().write(helper,helper);
203  return ok?helper._return:_return;
204 }
206  bool _return = false;
207  handPoseEstimation_IDL_pause helper;
208  helper.init();
209  if (!yarp().canWrite()) {
210  yError("Missing server method '%s'?","bool handPoseEstimation_IDL::pause()");
211  }
212  bool ok = yarp().write(helper,helper);
213  return ok?helper._return:_return;
214 }
216  bool _return = false;
217  handPoseEstimation_IDL_resume helper;
218  helper.init();
219  if (!yarp().canWrite()) {
220  yError("Missing server method '%s'?","bool handPoseEstimation_IDL::resume()");
221  }
222  bool ok = yarp().write(helper,helper);
223  return ok?helper._return:_return;
224 }
226  yarp::os::Bottle _return;
227  handPoseEstimation_IDL_lastOffsets helper;
228  helper.init();
229  if (!yarp().canWrite()) {
230  yError("Missing server method '%s'?","yarp::os::Bottle handPoseEstimation_IDL::lastOffsets()");
231  }
232  bool ok = yarp().write(helper,helper);
233  return ok?helper._return:_return;
234 }
236  bool _return = false;
237  handPoseEstimation_IDL_quit helper;
238  helper.init();
239  if (!yarp().canWrite()) {
240  yError("Missing server method '%s'?","bool handPoseEstimation_IDL::quit()");
241  }
242  bool ok = yarp().write(helper,helper);
243  return ok?helper._return:_return;
244 }
245 
246 bool handPoseEstimation_IDL::read(yarp::os::ConnectionReader& connection) {
247  yarp::os::idl::WireReader reader(connection);
248  reader.expectAccept();
249  if (!reader.readListHeader()) { reader.fail(); return false; }
250  yarp::os::ConstString tag = reader.readTag();
251  bool direct = (tag=="__direct__");
252  if (direct) tag = reader.readTag();
253  while (!reader.isError()) {
254  // TODO: use quick lookup, this is just a test
255  if (tag == "start") {
256  bool _return;
257  _return = start();
258  yarp::os::idl::WireWriter writer(reader);
259  if (!writer.isNull()) {
260  if (!writer.writeListHeader(1)) return false;
261  if (!writer.writeBool(_return)) return false;
262  }
263  reader.accept();
264  return true;
265  }
266  if (tag == "stop") {
267  bool _return;
268  _return = stop();
269  yarp::os::idl::WireWriter writer(reader);
270  if (!writer.isNull()) {
271  if (!writer.writeListHeader(1)) return false;
272  if (!writer.writeBool(_return)) return false;
273  }
274  reader.accept();
275  return true;
276  }
277  if (tag == "pause") {
278  bool _return;
279  _return = pause();
280  yarp::os::idl::WireWriter writer(reader);
281  if (!writer.isNull()) {
282  if (!writer.writeListHeader(1)) return false;
283  if (!writer.writeBool(_return)) return false;
284  }
285  reader.accept();
286  return true;
287  }
288  if (tag == "resume") {
289  bool _return;
290  _return = resume();
291  yarp::os::idl::WireWriter writer(reader);
292  if (!writer.isNull()) {
293  if (!writer.writeListHeader(1)) return false;
294  if (!writer.writeBool(_return)) return false;
295  }
296  reader.accept();
297  return true;
298  }
299  if (tag == "lastOffsets") {
300  yarp::os::Bottle _return;
301  _return = lastOffsets();
302  yarp::os::idl::WireWriter writer(reader);
303  if (!writer.isNull()) {
304  if (!writer.writeListHeader(1)) return false;
305  if (!writer.write(_return)) return false;
306  }
307  reader.accept();
308  return true;
309  }
310  if (tag == "quit") {
311  bool _return;
312  _return = quit();
313  yarp::os::idl::WireWriter writer(reader);
314  if (!writer.isNull()) {
315  if (!writer.writeListHeader(1)) return false;
316  if (!writer.writeBool(_return)) return false;
317  }
318  reader.accept();
319  return true;
320  }
321  if (tag == "help") {
322  std::string functionName;
323  if (!reader.readString(functionName)) {
324  functionName = "--all";
325  }
326  std::vector<std::string> _return=help(functionName);
327  yarp::os::idl::WireWriter writer(reader);
328  if (!writer.isNull()) {
329  if (!writer.writeListHeader(2)) return false;
330  if (!writer.writeTag("many",1, 0)) return false;
331  if (!writer.writeListBegin(BOTTLE_TAG_INT, static_cast<uint32_t>(_return.size()))) return false;
332  std::vector<std::string> ::iterator _iterHelp;
333  for (_iterHelp = _return.begin(); _iterHelp != _return.end(); ++_iterHelp)
334  {
335  if (!writer.writeString(*_iterHelp)) return false;
336  }
337  if (!writer.writeListEnd()) return false;
338  }
339  reader.accept();
340  return true;
341  }
342  if (reader.noMore()) { reader.fail(); return false; }
343  yarp::os::ConstString next_tag = reader.readTag();
344  if (next_tag=="") break;
345  tag = tag + "_" + next_tag;
346  }
347  return false;
348 }
349 
350 std::vector<std::string> handPoseEstimation_IDL::help(const std::string& functionName) {
351  bool showAll=(functionName=="--all");
352  std::vector<std::string> helpString;
353  if(showAll) {
354  helpString.push_back("*** Available commands:");
355  helpString.push_back("start");
356  helpString.push_back("stop");
357  helpString.push_back("pause");
358  helpString.push_back("resume");
359  helpString.push_back("lastOffsets");
360  helpString.push_back("quit");
361  helpString.push_back("help");
362  }
363  else {
364  if (functionName=="start") {
365  helpString.push_back("bool start() ");
366  helpString.push_back("Start (re-start) the hand pose estimation. ");
367  helpString.push_back("The filter generates particles and update the particle distribution accordingly ");
368  helpString.push_back("@return true/false on success/failure ");
369  }
370  if (functionName=="stop") {
371  helpString.push_back("bool stop() ");
372  helpString.push_back("Stop the hand pose estimation. ");
373  helpString.push_back("The filter stop the generation of particles and waits for a start command ");
374  helpString.push_back("@return true/false on success/failure ");
375  }
376  if (functionName=="pause") {
377  helpString.push_back("bool pause() ");
378  helpString.push_back("Pause the hand pose estimation. ");
379  helpString.push_back("The filter stop the generation of particles and waits for a resume command ");
380  helpString.push_back("@return true/false on success/failure ");
381  }
382  if (functionName=="resume") {
383  helpString.push_back("bool resume() ");
384  helpString.push_back("Resume the hand pose estimation. ");
385  helpString.push_back("The filter resumes the generation of particles after a pause command ");
386  helpString.push_back("@return true/false on success/failure ");
387  }
388  if (functionName=="lastOffsets") {
389  helpString.push_back("yarp::os::Bottle lastOffsets() ");
390  helpString.push_back("Ask for the last estimated angular Offsets on the arm (7DoF) ");
391  helpString.push_back("@return Bottle with last angular Offsets ");
392  }
393  if (functionName=="quit") {
394  helpString.push_back("bool quit() ");
395  helpString.push_back("Quit the module. ");
396  helpString.push_back("@return true/false on success/failure ");
397  }
398  if (functionName=="help") {
399  helpString.push_back("std::vector<std::string> help(const std::string& functionName=\"--all\")");
400  helpString.push_back("Return list of available commands, or help message for a specific function");
401  helpString.push_back("@param functionName name of command for which to get a detailed description. If none or '--all' is provided, print list of available commands");
402  helpString.push_back("@return list of strings (one string per line)");
403  }
404  }
405  if ( helpString.empty()) helpString.push_back("Command not found");
406  return helpString;
407 }
408 
409 
virtual yarp::os::Bottle lastOffsets()
Ask for the last estimated angular Offsets on the arm (7DoF)
virtual bool quit()
Quit the module.
virtual bool resume()
Resume the hand pose estimation.
virtual bool stop()
Stop the hand pose estimation.
virtual bool start()
Start (re-start) the hand pose estimation.
virtual bool pause()
Pause the hand pose estimation.