YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
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
13#include <yarp/os/Portable.h>
14
15#include <string>
16
17namespace yarp::os::impl {
18
24{
25public:
27 header(8)
28 {
29 ch = '\0';
30 str = "";
31 }
32
33 PortCommand(char ch, const std::string& str) :
34 header(8)
35 {
36 this->ch = ch;
37 this->str = str;
38 }
39
40 bool write(yarp::os::ConnectionWriter& writer) const override;
41 bool read(yarp::os::ConnectionReader& reader) override;
42
43 char getKey()
44 {
45 return ch;
46 }
47
48 std::string getText()
49 {
50 return str;
51 }
52
53public:
54 char ch;
57};
58
59} // namespace yarp::os::impl
60
61#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...
This is a base class for objects that can be both read from and be written to the YARP network.
Definition Portable.h:25
Simple Readable and Writable object representing a command to a YARP port.
Definition PortCommand.h:24
PortCommand(char ch, const std::string &str)
Definition PortCommand.h:33
yarp::os::ManagedBytes header
Definition PortCommand.h:56
The components from which ports and connections are built.
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition system.h:338
#define YARP_os_impl_API
Definition api.h:46