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