YARP
Yet Another Robot Platform
RemoteFrameGrabber.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_DEV_REMOTEFRAMEGRABBER_H
11 #define YARP_DEV_REMOTEFRAMEGRABBER_H
12 
13 #include <cstring> // for memcpy
14 
15 #include <yarp/os/Network.h>
16 #include <yarp/os/LogComponent.h>
17 #include <yarp/os/LogStream.h>
20 #include <yarp/dev/GenericVocabs.h>
21 
22 #include <mutex>
23 
25 
27  public yarp::dev::IFrameGrabberControlsDC1394
28 {
29 private:
30  yarp::os::Port* _port{nullptr};
31 
32 public:
33  void init(yarp::os::Port *__port)
34  {
35  _port = __port;
36  }
37 
38 private:
39  bool setCommand(int code, double v)
40  {
41  yarp::os::Bottle cmd, response;
43  cmd.addVocab(VOCAB_SET);
44  cmd.addVocab(code);
45  cmd.addFloat64(v);
46  _port->write(cmd,response);
47  return true;
48  }
49 
50  bool setCommand(int code, double b, double r)
51  {
52  yarp::os::Bottle cmd, response;
54  cmd.addVocab(VOCAB_SET);
55  cmd.addVocab(code);
56  cmd.addFloat64(b);
57  cmd.addFloat64(r);
58  _port->write(cmd,response);
59  return true;
60  }
61 
62  double getCommand(int code) const
63  {
64  yarp::os::Bottle cmd, response;
66  cmd.addVocab(VOCAB_GET);
67  cmd.addVocab(code);
68  _port->write(cmd,response);
69  // response should be [cmd] [name] value
70  return response.get(2).asFloat64();
71  }
72 
73  bool getCommand(int code, double &b, double &r) const
74  {
75  yarp::os::Bottle cmd, response;
77  cmd.addVocab(VOCAB_GET);
78  cmd.addVocab(code);
79  _port->write(cmd,response);
80  // response should be [cmd] [name] value
81  b=response.get(2).asFloat64();
82  r=response.get(3).asFloat64();
83  return true;
84  }
85 
86 public:
87 
88  // 12
89  unsigned int getVideoModeMaskDC1394() override
90  {
91  yarp::os::Bottle cmd, response;
94  _port->write(cmd,response);
95 
96  // I'll bite your sweet little fingers ^__^
97  return (unsigned)response.get(0).asInt32();
98  //return response.get(0).asInt32()!=0? true:false;
99  }
100  // 13
101  unsigned int getVideoModeDC1394() override
102  {
103  yarp::os::Bottle cmd, response;
106  _port->write(cmd,response);
107 
108  // I'll bite your sweet little fingers ^__^
109  return (unsigned)response.get(0).asInt32();
110  //return response.get(0).asInt32()!=0? true:false;
111  }
112  // 14
113  bool setVideoModeDC1394(int video_mode) override
114  {
115  yarp::os::Bottle cmd, response;
118  cmd.addInt32(video_mode);
119  _port->write(cmd,response);
120  return response.get(0).asInt32()!=0? true:false;
121  }
122 
123  // 15
124  unsigned int getFPSMaskDC1394() override
125  {
126  yarp::os::Bottle cmd, response;
129  _port->write(cmd,response);
130 
131  // I'll bite your sweet little fingers ^__^
132  return (unsigned)response.get(0).asInt32();
133  //return response.get(0).asInt32()!=0? true:false;
134  }
135  // 16
136  unsigned int getFPSDC1394() override
137  {
138  yarp::os::Bottle cmd, response;
141  _port->write(cmd,response);
142 
143  // I'll bite your sweet little fingers ^__^
144  return (unsigned)response.get(0).asInt32();
145  //return response.get(0).asInt32()!=0? true:false;
146  }
147  // 17
148  bool setFPSDC1394(int fps) override
149  {
150  yarp::os::Bottle cmd, response;
153  cmd.addInt32(fps);
154  _port->write(cmd,response);
155  return response.get(0).asInt32()!=0? true:false;
156  }
157 
158  // 18
159  unsigned int getISOSpeedDC1394() override
160  {
161  yarp::os::Bottle cmd, response;
164  _port->write(cmd,response);
165 
166  // I'll bite your sweet little fingers ^__^
167  return (unsigned)response.get(0).asInt32();
168  //return response.get(0).asInt32()!=0? true:false;
169  }
170  // 19
171  bool setISOSpeedDC1394(int speed) override
172  {
173  yarp::os::Bottle cmd, response;
176  cmd.addInt32(speed);
177  _port->write(cmd,response);
178  return response.get(0).asInt32()!=0? true:false;
179  }
180 
181  // 20
182  unsigned int getColorCodingMaskDC1394(unsigned int video_mode) override
183  {
184  yarp::os::Bottle cmd, response;
187  cmd.addInt32(video_mode);
188  _port->write(cmd,response);
189 
190  // I'll bite your sweet little fingers ^__^
191  return (unsigned)response.get(0).asInt32();
192  //return response.get(0).asInt32()!=0? true:false;
193  }
194  // 21
195  unsigned int getColorCodingDC1394() override
196  {
197  yarp::os::Bottle cmd, response;
200  _port->write(cmd,response);
201 
202  // I'll bite your sweet little fingers ^__^
203  return (unsigned)response.get(0).asInt32();
204  //return response.get(0).asInt32()!=0? true:false;
205  }
206  // 22
207  bool setColorCodingDC1394(int coding) override
208  {
209  yarp::os::Bottle cmd, response;
212  cmd.addInt32(coding);
213  _port->write(cmd,response);
214  return response.get(0).asInt32()!=0? true:false;
215  }
216 
217  bool getFormat7MaxWindowDC1394(unsigned int &xdim,unsigned int &ydim,unsigned int &xstep,unsigned int &ystep,unsigned int &xoffstep,unsigned int &yoffstep) override
218  {
219  yarp::os::Bottle cmd, response;
222  _port->write(cmd,response);
223 
224  xdim=response.get(0).asInt32();
225  ydim=response.get(1).asInt32();
226  xstep=response.get(2).asInt32();
227  ystep=response.get(3).asInt32();
228  xoffstep=response.get(4).asInt32();
229  yoffstep=response.get(5).asInt32();
230  return response.get(0).asInt32()!=0? true:false;
231  }
232  // 26
233  bool getFormat7WindowDC1394(unsigned int &xdim,unsigned int &ydim,int &x0,int &y0) override
234  {
235  yarp::os::Bottle cmd, response;
238  _port->write(cmd,response);
239  xdim=response.get(0).asInt32();
240  ydim=response.get(1).asInt32();
241  x0=response.get(2).asInt32();
242  y0=response.get(3).asInt32();
243  return response.get(0).asInt32()!=0? true:false;
244  }
245  // 27
246  bool setFormat7WindowDC1394(unsigned int xdim,unsigned int ydim,int x0,int y0) override
247  {
248  yarp::os::Bottle cmd, response;
251  cmd.addInt32(xdim);
252  cmd.addInt32(ydim);
253  cmd.addInt32(x0);
254  cmd.addInt32(y0);
255  _port->write(cmd,response);
256  return response.get(0).asInt32()!=0? true:false;
257  }
258 
259  // 28
260  bool setOperationModeDC1394(bool b1394b) override
261  {
262  yarp::os::Bottle cmd, response;
265  cmd.addInt32(int(b1394b));
266  _port->write(cmd,response);
267  return response.get(0).asInt32()!=0? true:false;
268  }
269  // 29
270  bool getOperationModeDC1394() override
271  {
272  yarp::os::Bottle cmd, response;
275  _port->write(cmd,response);
276  return response.get(0).asInt32()!=0? true:false;
277  }
278 
279  // 30
280  bool setTransmissionDC1394(bool bTxON) override
281  {
282  yarp::os::Bottle cmd, response;
285  cmd.addInt32(int(bTxON));
286  _port->write(cmd,response);
287  return response.get(0).asInt32()!=0? true:false;
288  }
289  // 31
290  bool getTransmissionDC1394() override
291  {
292  yarp::os::Bottle cmd, response;
295  _port->write(cmd,response);
296  return response.get(0).asInt32()!=0? true:false;
297  }
298 
299  // 34
300  bool setBroadcastDC1394(bool onoff) override
301  {
302  yarp::os::Bottle cmd, response;
305  cmd.addInt32((int)onoff);
306  _port->write(cmd,response);
307  return response.get(0).asInt32()!=0? true:false;
308  }
309  // 35
310  bool setDefaultsDC1394() override
311  {
312  yarp::os::Bottle cmd, response;
315  _port->write(cmd,response);
316  return response.get(0).asInt32()!=0? true:false;
317  }
318  // 36
319  bool setResetDC1394() override
320  {
321  yarp::os::Bottle cmd, response;
324  _port->write(cmd,response);
325  return response.get(0).asInt32()!=0? true:false;
326  }
327  // 37
328  bool setPowerDC1394(bool onoff) override
329  {
330  yarp::os::Bottle cmd, response;
333  cmd.addInt32((int)onoff);
334  _port->write(cmd,response);
335  return response.get(0).asInt32()!=0? true:false;
336  }
337 
338  // 38
339  bool setCaptureDC1394(bool bON) override
340  {
341  yarp::os::Bottle cmd, response;
344  cmd.addInt32(int(bON));
345  _port->write(cmd,response);
346  return response.get(0).asInt32()!=0? true:false;
347  }
348 
349  // 39
350  bool setBytesPerPacketDC1394(unsigned int bpp) override
351  {
352  yarp::os::Bottle cmd, response;
355  cmd.addInt32(int(bpp));
356  _port->write(cmd,response);
357  return response.get(0).asInt32()!=0? true:false;
358  }
359 
360  // 40
361  unsigned int getBytesPerPacketDC1394() override
362  {
363  yarp::os::Bottle cmd, response;
366  _port->write(cmd,response);
367  return (unsigned)response.get(0).asInt32();
368  }
369 };
370 
381  public ImplementDC1394,
384 {
385 public:
391  ~RemoteFrameGrabber() override = default;
392 
393 
395  {
396  mutex.lock();
397  if(no_stream == true)
398  {
399  image.zero();
400  mutex.unlock();
401  return false;
402  }
403 
404  if (reader.read(true)!=NULL) {
405  image = *(reader.lastRead());
406  lastHeight = image.height();
407  lastWidth = image.width();
408  mutex.unlock();
409  return true;
410  }
411  mutex.unlock();
412  return false;
413  }
414 
415  bool getImageCrop(cropType_id_t cropType, yarp::sig::VectorOf<std::pair<int, int> > vertices, yarp::sig::ImageOf<yarp::sig::PixelRgb>& image) override
416  {
417  yarp::os::Bottle cmd, response;
419  cmd.addVocab(VOCAB_GET);
420  cmd.addVocab(VOCAB_CROP);
421  cmd.addInt32(cropType);
422  yarp::os::Bottle & list = cmd.addList();
423  for(size_t i=0; i<vertices.size(); i++)
424  {
425  list.addInt32(vertices[i].first);
426  list.addInt32(vertices[i].second);
427  }
428  port.write(cmd,response);
429 
430  // Parse the response
431  image.zero();
432  if( (response.get(0).asVocab() != VOCAB_CROP) || (response.size() != 5) || (!response.get(4).isBlob()))
433  {
434  yCError(REMOTEFRAMEGRABBER) << "getImageCrop: malformed response message. Size is " << response.size();
435  return false;
436  }
437 
438  image.resize(response.get(2).asInt32(), response.get(3).asInt32());
439  unsigned char *pixelOut = image.getRawImage();
440 
441  if(response.get(4).asBlob())
442  memcpy(pixelOut, response.get(4).asBlob(), (size_t) image.getRawImageSize());
443 
444  return true;
445  }
446 
447  // this is bad!
448  int height() const override
449  {
450  return lastHeight;
451  }
452 
453  int width() const override
454  {
455  return lastWidth;
456  }
457 
468  bool open(yarp::os::Searchable& config) override
469  {
471  yCDebug(REMOTEFRAMEGRABBER) << "config is " << config.toString();
472 
473  remote = config.check("remote",yarp::os::Value(""),
474  "port name of real grabber").asString();
475  local = config.check("local",yarp::os::Value("..."),
476  "port name to use locally").asString();
477  std::string carrier =
478  config.check("stream",yarp::os::Value("tcp"),
479  "carrier to use for streaming").asString();
480  port.open(local);
481  if (remote!="") {
482  yCInfo(REMOTEFRAMEGRABBER) << "connecting " << local << " to " << remote;
483 
484  if(!config.check("no_stream") )
485  {
486  no_stream = false;
487  if(!yarp::os::Network::connect(remote,local,carrier))
488  yCError(REMOTEFRAMEGRABBER) << "cannot connect " << local << " to " << remote;
489  }
490  else
491  no_stream = true;
492 
493  // reverse connection for RPC
494  // could choose to do this only on need
495 
496  yarp::os::Network::connect(local,remote);
497  }
498  reader.attach(port);
499  ImplementDC1394::init(&port);
500  return true;
501  }
502 
503  bool close() override
504  {
505  port.close();
506 // mutex.lock(); // why does it need this?
507  return true;
508  }
509 
510 #ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
511  bool setBrightness(double v) override
512  {
513  return setCommand(VOCAB_BRIGHTNESS, v);
514  }
515  double getBrightness() override
516  {
518  }
519  bool setExposure(double v) override
520  {
521  return setCommand(VOCAB_EXPOSURE, v);
522  }
523  double getExposure() override
524  {
525  return getCommand(VOCAB_EXPOSURE);
526  }
527 
528  bool setSharpness(double v) override
529  {
530  return setCommand(VOCAB_SHARPNESS, v);
531  }
532  double getSharpness() override
533  {
534  return getCommand(VOCAB_SHARPNESS);
535  }
536 
537  bool setWhiteBalance(double blue, double red) override
538  {
539  return setCommand(VOCAB_WHITE, blue, red);
540  }
541  bool getWhiteBalance(double &blue, double &red) override
542  {
543  return getCommand(VOCAB_WHITE, blue, red);
544  }
545 
546  bool setHue(double v) override
547  {
548  return setCommand(VOCAB_HUE,v);
549  }
550  double getHue() override
551  {
552  return getCommand(VOCAB_HUE);
553  }
554 
555  bool setSaturation(double v) override
556  {
557  return setCommand(VOCAB_SATURATION,v);
558  }
559  double getSaturation() override
560  {
562  }
563 
564  bool setGamma(double v) override
565  {
566  return setCommand(VOCAB_GAMMA,v);
567  }
568  double getGamma() override
569  {
570  return getCommand(VOCAB_GAMMA);
571  }
572 
573  bool setShutter(double v) override
574  {
575  return setCommand(VOCAB_SHUTTER,v);
576  }
577  double getShutter() override
578  {
579  return getCommand(VOCAB_SHUTTER);
580  }
581 
582  bool setGain(double v) override
583  {
584  return setCommand(VOCAB_GAIN,v);
585  }
586  double getGain() override
587  {
588  return getCommand(VOCAB_GAIN);
589  }
590 
591  bool setIris(double v) override
592  {
593  return setCommand(VOCAB_IRIS,v);
594  }
595  double getIris() override
596  {
597  return getCommand(VOCAB_IRIS);
598  }
599 #endif
600 
601 private:
603  yarp::os::Port port;
604  std::string remote;
605  std::string local;
606  std::mutex mutex;
607  int lastHeight{0};
608  int lastWidth{0};
609  bool no_stream{false};
610 
611 protected:
612 
613  IFrameGrabberControlsDC1394 *Ifirewire{nullptr};
614 
615  bool setCommand(int code, double v)
616  {
617  yarp::os::Bottle cmd, response;
619  cmd.addVocab(VOCAB_SET);
620  cmd.addVocab(code);
621  cmd.addFloat64(v);
622  port.write(cmd,response);
623  return true;
624  }
625 
626  bool setCommand(int code, double b, double r)
627  {
628  yarp::os::Bottle cmd, response;
630  cmd.addVocab(VOCAB_SET);
631  cmd.addVocab(code);
632  cmd.addFloat64(b);
633  cmd.addFloat64(r);
634  port.write(cmd,response);
635  return true;
636  }
637 
638  double getCommand(int code) const {
639  yarp::os::Bottle cmd, response;
641  cmd.addVocab(VOCAB_GET);
642  cmd.addVocab(code);
643  port.write(cmd,response);
644  // response should be [cmd] [name] value
645  return response.get(2).asFloat64();
646  }
647 
648  bool getCommand(int code, double &b, double &r) const
649  {
650  yarp::os::Bottle cmd, response;
652  cmd.addVocab(VOCAB_GET);
653  cmd.addVocab(code);
654  port.write(cmd,response);
655  // response should be [cmd] [name] value
656  b=response.get(2).asFloat64();
657  r=response.get(3).asFloat64();
658  return true;
659  }
660 };
661 
662 #endif // YARP_DEV_REMOTEFRAMEGRABBER_H
constexpr yarp::conf::vocab32_t VOCAB_DRGETISO
constexpr yarp::conf::vocab32_t VOCAB_GAMMA
constexpr yarp::conf::vocab32_t VOCAB_GAIN
constexpr yarp::conf::vocab32_t VOCAB_DRSETFPS
constexpr yarp::conf::vocab32_t VOCAB_SHUTTER
constexpr yarp::conf::vocab32_t VOCAB_DRSETDEF
constexpr yarp::conf::vocab32_t VOCAB_DRSETVMD
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_CONTROL_DC1394
constexpr yarp::conf::vocab32_t VOCAB_DRSETWF7
constexpr yarp::conf::vocab32_t VOCAB_DRGETF7M
constexpr yarp::conf::vocab32_t VOCAB_WHITE
constexpr yarp::conf::vocab32_t VOCAB_DRSETBCS
constexpr yarp::conf::vocab32_t VOCAB_IRIS
constexpr yarp::conf::vocab32_t VOCAB_DRSETCAP
constexpr yarp::conf::vocab32_t VOCAB_DRSETCOD
constexpr yarp::conf::vocab32_t VOCAB_HUE
constexpr yarp::conf::vocab32_t VOCAB_SHARPNESS
constexpr yarp::conf::vocab32_t VOCAB_DRGETMSK
constexpr yarp::conf::vocab32_t VOCAB_DRGETFPS
constexpr yarp::conf::vocab32_t VOCAB_DRSETOPM
constexpr yarp::conf::vocab32_t VOCAB_DRGETBPP
constexpr yarp::conf::vocab32_t VOCAB_DRSETPWR
constexpr yarp::conf::vocab32_t VOCAB_DRGETCCM
constexpr yarp::conf::vocab32_t VOCAB_DRGETTXM
constexpr yarp::conf::vocab32_t VOCAB_DRSETRST
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_IMAGE
constexpr yarp::conf::vocab32_t VOCAB_DRSETBPP
constexpr yarp::conf::vocab32_t VOCAB_BRIGHTNESS
constexpr yarp::conf::vocab32_t VOCAB_DRGETWF7
constexpr yarp::conf::vocab32_t VOCAB_DRGETVMD
constexpr yarp::conf::vocab32_t VOCAB_DRGETFPM
constexpr yarp::conf::vocab32_t VOCAB_SATURATION
constexpr yarp::conf::vocab32_t VOCAB_DRSETTXM
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_CONTROL
constexpr yarp::conf::vocab32_t VOCAB_CROP
constexpr yarp::conf::vocab32_t VOCAB_DRGETCOD
constexpr yarp::conf::vocab32_t VOCAB_DRSETISO
constexpr yarp::conf::vocab32_t VOCAB_EXPOSURE
constexpr yarp::conf::vocab32_t VOCAB_DRGETOPM
constexpr yarp::conf::vocab32_t VOCAB_GET
Definition: GenericVocabs.h:16
constexpr yarp::conf::vocab32_t VOCAB_SET
Definition: GenericVocabs.h:15
const yarp::os::LogComponent & REMOTEFRAMEGRABBER()
unsigned int getISOSpeedDC1394() override
bool setBroadcastDC1394(bool onoff) override
bool setDefaultsDC1394() override
bool getFormat7WindowDC1394(unsigned int &xdim, unsigned int &ydim, int &x0, int &y0) override
bool setOperationModeDC1394(bool b1394b) override
bool setResetDC1394() override
unsigned int getFPSMaskDC1394() override
unsigned int getVideoModeMaskDC1394() override
bool setFPSDC1394(int fps) override
bool setISOSpeedDC1394(int speed) override
unsigned int getColorCodingMaskDC1394(unsigned int video_mode) override
bool setPowerDC1394(bool onoff) override
unsigned int getFPSDC1394() override
bool setColorCodingDC1394(int coding) override
bool getFormat7MaxWindowDC1394(unsigned int &xdim, unsigned int &ydim, unsigned int &xstep, unsigned int &ystep, unsigned int &xoffstep, unsigned int &yoffstep) override
unsigned int getColorCodingDC1394() override
unsigned int getBytesPerPacketDC1394() override
void init(yarp::os::Port *__port)
bool setFormat7WindowDC1394(unsigned int xdim, unsigned int ydim, int x0, int y0) override
bool getOperationModeDC1394() override
bool setTransmissionDC1394(bool bTxON) override
bool setCaptureDC1394(bool bON) override
bool getTransmissionDC1394() override
unsigned int getVideoModeDC1394() override
bool setVideoModeDC1394(int video_mode) override
bool setBytesPerPacketDC1394(unsigned int bpp) override
bool setExposure(double v) override
Set the exposure.
double getCommand(int code) const
double getIris() override
Read the iris parameter.
bool open(yarp::os::Searchable &config) override
Configure with a set of options.
bool setShutter(double v) override
Set the shutter parameter.
bool setWhiteBalance(double blue, double red) override
Set the white balance for the frame grabber.
bool setSaturation(double v) override
Set the saturation.
RemoteFrameGrabber & operator=(RemoteFrameGrabber &&)=delete
IFrameGrabberControlsDC1394 * Ifirewire
bool setCommand(int code, double v)
bool setGamma(double v) override
Set the gamma.
bool setIris(double v) override
Set the iris.
int height() const override
Return the height of each frame.
double getExposure() override
Read the exposure parameter.
bool setCommand(int code, double b, double r)
double getSaturation() override
Read the saturation parameter.
RemoteFrameGrabber(RemoteFrameGrabber &&)=delete
double getShutter() override
Read the shutter parameter.
RemoteFrameGrabber & operator=(const RemoteFrameGrabber &)=delete
bool getImageCrop(cropType_id_t cropType, yarp::sig::VectorOf< std::pair< int, int > > vertices, yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Get a crop of the rgb image from the frame grabber, if required demosaicking/color reconstruction is ...
bool setHue(double v) override
Set the hue.
bool getWhiteBalance(double &blue, double &red) override
Read the white balance parameters.
double getBrightness() override
Read the brightness parameter.
double getSharpness() override
Read the sharpness parameter.
double getHue() override
Read the hue parameter.
int width() const override
Return the width of each frame.
double getGain() override
Read the gain parameter.
bool close() override
Close the DeviceDriver.
bool setBrightness(double v) override
Set the brightness.
bool setSharpness(double v) override
Set the sharpness.
bool getCommand(int code, double &b, double &r) const
double getGamma() override
Read the gamma parameter.
RemoteFrameGrabber(const RemoteFrameGrabber &)=delete
~RemoteFrameGrabber() override=default
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Get an rgb image from the frame grabber, if required demosaicking/color reconstruction is applied.
bool setGain(double v) override
Set the gain.
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
This classes implement a sender / parser for IFrameGrabberControls interface messages.
Read a YARP-format image from a device.
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
Definition: Bottle.cpp:185
size_type size() const
Gets the number of elements in the bottle.
Definition: Bottle.cpp:254
void addFloat64(yarp::conf::float64_t x)
Places a 64-bit floating point number in the bottle, at the end of the list.
Definition: Bottle.cpp:161
void addVocab(int x)
Places a vocabulary item in the bottle, at the end of the list.
Definition: Bottle.cpp:167
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Definition: Bottle.cpp:249
void addInt32(std::int32_t x)
Places a 32-bit integer in the bottle, at the end of the list.
Definition: Bottle.cpp:143
static bool connect(const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true)
Request that an output port connect to an input port.
Definition: Network.cpp:685
Buffer incoming data to a port.
T * read(bool shouldWait=true) override
Read an available object from the port.
void attach(Port &port)
Attach this buffer to a particular port.
T * lastRead() override
Get the last data returned by read()
A mini-server for network communication.
Definition: Port.h:50
bool write(const PortWriter &writer, const PortWriter *callback=nullptr) const override
Write an object to the port.
Definition: Port.cpp:430
void close() override
Stop port activity.
Definition: Port.cpp:357
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
Definition: Port.cpp:82
A base class for nested structures that can be searched.
Definition: Searchable.h:69
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
A single value (typically within a Bottle).
Definition: Value.h:47
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
Definition: Value.cpp:225
virtual std::int32_t asInt32() const
Get 32-bit integer value.
Definition: Value.cpp:207
virtual bool isBlob() const
Checks if value is a binary object.
Definition: Value.cpp:183
virtual const char * asBlob() const
Get binary data value.
Definition: Value.cpp:264
virtual std::int32_t asVocab() const
Get vocabulary identifier as an integer.
Definition: Value.cpp:231
size_t width() const
Gets width of image in pixels.
Definition: Image.h:153
unsigned char * getRawImage() const
Access to the internal image buffer.
Definition: Image.cpp:535
size_t getRawImageSize() const
Access to the internal buffer size information (this is how much memory has been allocated for the im...
Definition: Image.cpp:544
void resize(size_t imgWidth, size_t imgHeight)
Reallocate an image to be of a desired size, throwing away its current contents.
Definition: Image.cpp:467
void zero()
Set all pixels to 0.
Definition: Image.cpp:460
size_t height() const
Gets height of image in pixels.
Definition: Image.h:159
Provides:
Definition: Vector.h:122
#define yCInfo(component,...)
Definition: LogComponent.h:135
#define yCError(component,...)
Definition: LogComponent.h:157
#define yCTrace(component,...)
Definition: LogComponent.h:88
#define YARP_DECLARE_LOG_COMPONENT(name)
Definition: LogComponent.h:77
#define yCDebug(component,...)
Definition: LogComponent.h:112
The main, catch-all namespace for YARP.
Definition: environment.h:18