YARP
Yet Another Robot Platform
UInt8.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6// This is an automatically generated file.
7
8// Generated from the following "std_msgs/UInt8" msg definition:
9// uint8 data
10// Instances of this class can be read and written with YARP ports,
11// using a ROS-compatible format.
12
13#ifndef YARP_ROSMSG_std_msgs_UInt8_h
14#define YARP_ROSMSG_std_msgs_UInt8_h
15
16#include <yarp/os/Wire.h>
17#include <yarp/os/Type.h>
19#include <string>
20#include <vector>
22namespace yarp {
23namespace rosmsg {
24namespace std_msgs {
25
27{
28public:
29 std::uint8_t data;
30
32 data(0)
33 {
34 }
35
36 void clear()
37 {
38 // *** data ***
39 data = 0;
40 }
41
42 bool readBare(yarp::os::ConnectionReader& connection) override
43 {
44 // *** data ***
45 data = connection.expectInt8();
46
47 return !connection.isError();
48 }
49
50 bool readBottle(yarp::os::ConnectionReader& connection) override
51 {
52 connection.convertTextMode();
53 yarp::os::idl::WireReader reader(connection);
54 if (!reader.readListHeader(1)) {
55 return false;
56 }
57
58 // *** data ***
59 data = reader.expectInt8();
60
61 return !connection.isError();
62 }
63
65 bool read(yarp::os::ConnectionReader& connection) override
66 {
67 return (connection.isBareMode() ? readBare(connection)
68 : readBottle(connection));
69 }
70
71 bool writeBare(yarp::os::ConnectionWriter& connection) const override
72 {
73 // *** data ***
74 connection.appendInt8(data);
75
76 return !connection.isError();
77 }
78
79 bool writeBottle(yarp::os::ConnectionWriter& connection) const override
80 {
81 connection.appendInt32(BOTTLE_TAG_LIST);
82 connection.appendInt32(1);
83
84 // *** data ***
85 connection.appendInt32(BOTTLE_TAG_INT8);
86 connection.appendInt8(data);
87
88 connection.convertTextMode();
89 return !connection.isError();
90 }
91
93 bool write(yarp::os::ConnectionWriter& connection) const override
94 {
95 return (connection.isBareMode() ? writeBare(connection)
96 : writeBottle(connection));
97 }
98
99 // This class will serialize ROS style or YARP style depending on protocol.
100 // If you need to force a serialization style, use one of these classes:
103
104 // The name for this message, ROS will need this
105 static constexpr const char* typeName = "std_msgs/UInt8";
106
107 // The checksum for this message, ROS will need this
108 static constexpr const char* typeChecksum = "7c8164229e7d2c17eb95e9231617fdee";
109
110 // The source text for this message, ROS will need this
111 static constexpr const char* typeText = "\
112uint8 data\n\
113";
114
115 yarp::os::Type getType() const override
116 {
119 typ.addProperty("message_definition", yarp::os::Value(typeText));
120 return typ;
121 }
122};
123
124} // namespace std_msgs
125} // namespace rosmsg
126} // namespace yarp
127
128#endif // YARP_ROSMSG_std_msgs_UInt8_h
#define BOTTLE_TAG_INT8
Definition: Bottle.h:19
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a network connection.
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
virtual bool isError() const =0
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
An interface for writing to a network connection.
virtual bool isError() const =0
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual void appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
static Type byName(const char *name)
Definition: Type.cpp:171
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:134
A single value (typically within a Bottle).
Definition: Value.h:43
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:21
virtual bool read(yarp::os::idl::WireReader &reader)
virtual bool write(const yarp::os::idl::WireWriter &writer) const
IDL-friendly connection reader.
Definition: WireReader.h:27
std::int8_t expectInt8()
Definition: WireReader.h:77
static constexpr const char * typeName
Definition: UInt8.h:105
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: UInt8.h:93
yarp::os::idl::BareStyle< yarp::rosmsg::std_msgs::UInt8 > rosStyle
Definition: UInt8.h:101
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: UInt8.h:79
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: UInt8.h:50
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: UInt8.h:65
static constexpr const char * typeChecksum
Definition: UInt8.h:108
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: UInt8.h:42
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: UInt8.h:71
yarp::os::Type getType() const override
Definition: UInt8.h:115
static constexpr const char * typeText
Definition: UInt8.h:111
yarp::os::idl::BottleStyle< yarp::rosmsg::std_msgs::UInt8 > bottleStyle
Definition: UInt8.h:102
Definition: Bool.h:19
The main, catch-all namespace for YARP.
Definition: dirs.h:16