YARP
Yet Another Robot Platform
PortCommand.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef YARP_OS_IMPL_PORTCOMMAND_H
8 #define YARP_OS_IMPL_PORTCOMMAND_H
9 
12 #include <yarp/os/ManagedBytes.h>
13 #include <yarp/os/Portable.h>
14 
15 #include <string>
16 
17 namespace yarp {
18 namespace os {
19 namespace impl {
20 
25  public yarp::os::Portable
26 {
27 public:
29  header(8)
30  {
31  ch = '\0';
32  str = "";
33  }
34 
35  PortCommand(char ch, const std::string& str) :
36  header(8)
37  {
38  this->ch = ch;
39  this->str = str;
40  }
41 
42  bool write(yarp::os::ConnectionWriter& writer) const override;
43  bool read(yarp::os::ConnectionReader& reader) override;
44 
45  char getKey()
46  {
47  return ch;
48  }
49 
50  std::string getText()
51  {
52  return str;
53  }
54 
55 public:
56  char ch;
59 };
60 
61 } // namespace impl
62 } // namespace os
63 } // namespace yarp
64 
65 #endif // YARP_OS_IMPL_PORTCOMMAND_H
An interface for reading from a network connection.
An interface for writing to a network connection.
An abstraction for a block of bytes, with optional responsibility for allocating/destroying that bloc...
Definition: ManagedBytes.h:22
This is a base class for objects that can be both read from and be written to the YARP network.
Definition: Portable.h:26
Simple Readable and Writable object representing a command to a YARP port.
Definition: PortCommand.h:26
PortCommand(char ch, const std::string &str)
Definition: PortCommand.h:35
yarp::os::ManagedBytes header
Definition: PortCommand.h:58
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:922
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1098
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition: system.h:336
#define YARP_os_impl_API
Definition: api.h:46