YARP
Yet Another Robot Platform
Int8.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/Int8" msg definition:
9 // int8 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_Int8_h
14 #define YARP_ROSMSG_std_msgs_Int8_h
15 
16 #include <yarp/os/Wire.h>
17 #include <yarp/os/Type.h>
18 #include <yarp/os/idl/WireTypes.h>
19 #include <string>
20 #include <vector>
21 
22 namespace yarp {
23 namespace rosmsg {
24 namespace std_msgs {
25 
27 {
28 public:
29  std::int8_t data;
30 
31  Int8() :
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/Int8";
106 
107  // The checksum for this message, ROS will need this
108  static constexpr const char* typeChecksum = "27ffa0c9c4b8fb8492252bcad9e5c57b";
109 
110  // The source text for this message, ROS will need this
111  static constexpr const char* typeText = "\
112 int8 data\n\
113 ";
114 
115  yarp::os::Type getType() const override
116  {
118  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
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_Int8_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:45
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:23
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:30
std::int8_t expectInt8()
Definition: WireReader.h:80
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Int8.h:42
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Int8.h:71
yarp::os::Type getType() const override
Definition: Int8.h:115
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Int8.h:65
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Int8.h:50
static constexpr const char * typeText
Definition: Int8.h:111
static constexpr const char * typeChecksum
Definition: Int8.h:108
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Int8.h:93
yarp::os::idl::BareStyle< yarp::rosmsg::std_msgs::Int8 > rosStyle
Definition: Int8.h:101
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Int8.h:79
static constexpr const char * typeName
Definition: Int8.h:105
yarp::os::idl::BottleStyle< yarp::rosmsg::std_msgs::Int8 > bottleStyle
Definition: Int8.h:102
Definition: Bool.h:19
The main, catch-all namespace for YARP.
Definition: dirs.h:16