YARP
Yet Another Robot Platform
Char.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/Char" msg definition:
12 // char data// Instances of this class can be read and written with YARP ports,
13 // using a ROS-compatible format.
14 
15 #ifndef YARP_ROSMSG_std_msgs_Char_h
16 #define YARP_ROSMSG_std_msgs_Char_h
17 
18 #include <yarp/os/Wire.h>
19 #include <yarp/os/Type.h>
20 #include <yarp/os/idl/WireTypes.h>
21 #include <string>
22 #include <vector>
23 
24 namespace yarp {
25 namespace rosmsg {
26 namespace std_msgs {
27 
29 {
30 public:
31  std::int8_t data;
32 
33  Char() :
34  data(0)
35  {
36  }
37 
38  void clear()
39  {
40  // *** data ***
41  data = 0;
42  }
43 
44  bool readBare(yarp::os::ConnectionReader& connection) override
45  {
46  // *** data ***
47  data = connection.expectInt8();
48 
49  return !connection.isError();
50  }
51 
52  bool readBottle(yarp::os::ConnectionReader& connection) override
53  {
54  connection.convertTextMode();
55  yarp::os::idl::WireReader reader(connection);
56  if (!reader.readListHeader(1)) {
57  return false;
58  }
59 
60  // *** data ***
61  data = reader.expectInt8();
62 
63  return !connection.isError();
64  }
65 
67  bool read(yarp::os::ConnectionReader& connection) override
68  {
69  return (connection.isBareMode() ? readBare(connection)
70  : readBottle(connection));
71  }
72 
73  bool writeBare(yarp::os::ConnectionWriter& connection) const override
74  {
75  // *** data ***
76  connection.appendInt8(data);
77 
78  return !connection.isError();
79  }
80 
81  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
82  {
83  connection.appendInt32(BOTTLE_TAG_LIST);
84  connection.appendInt32(1);
85 
86  // *** data ***
87  connection.appendInt32(BOTTLE_TAG_INT8);
88  connection.appendInt8(data);
89 
90  connection.convertTextMode();
91  return !connection.isError();
92  }
93 
95  bool write(yarp::os::ConnectionWriter& connection) const override
96  {
97  return (connection.isBareMode() ? writeBare(connection)
98  : writeBottle(connection));
99  }
100 
101  // This class will serialize ROS style or YARP style depending on protocol.
102  // If you need to force a serialization style, use one of these classes:
105 
106  // The name for this message, ROS will need this
107  static constexpr const char* typeName = "std_msgs/Char";
108 
109  // The checksum for this message, ROS will need this
110  static constexpr const char* typeChecksum = "1bf77f25acecdedba0e224b162199717";
111 
112  // The source text for this message, ROS will need this
113  static constexpr const char* typeText = "\
114 char data\n\
115 ";
116 
117  yarp::os::Type getType() const override
118  {
120  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
121  typ.addProperty("message_definition", yarp::os::Value(typeText));
122  return typ;
123  }
124 };
125 
126 } // namespace std_msgs
127 } // namespace rosmsg
128 } // namespace yarp
129 
130 #endif // YARP_ROSMSG_std_msgs_Char_h
yarp::rosmsg::std_msgs::Char::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Char.h:52
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
yarp::rosmsg::std_msgs::Char::data
std::int8_t data
Definition: Char.h:31
yarp::os::idl::BottleStyle
Definition: BottleStyle.h:22
yarp::rosmsg::std_msgs::Char::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Char.h:95
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::rosmsg::std_msgs::Char::getType
yarp::os::Type getType() const override
Definition: Char.h:117
yarp::rosmsg::std_msgs::Char
Definition: Char.h:29
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::Char::clear
void clear()
Definition: Char.h:38
yarp::os::ConnectionReader::expectInt8
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::rosmsg::std_msgs::Char::typeChecksum
static constexpr const char * typeChecksum
Definition: Char.h:110
yarp::rosmsg::std_msgs::Char::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Char.h:81
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::Char::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::std_msgs::Char > rosStyle
Definition: Char.h:103
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
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::rosmsg::std_msgs::Char::typeText
static constexpr const char * typeText
Definition: Char.h:113
yarp::os::ConnectionWriter::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
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::Char::Char
Char()
Definition: Char.h:33
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::std_msgs::Char::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Char.h:73
yarp::os::idl::WireReader::expectInt8
std::int8_t expectInt8()
Definition: WireReader.h:87
yarp::rosmsg::std_msgs::Char::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::std_msgs::Char > bottleStyle
Definition: Char.h:104
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::std_msgs::Char::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Char.h:44
yarp::rosmsg::std_msgs::Char::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Char.h:67
yarp::rosmsg::std_msgs::Char::typeName
static constexpr const char * typeName
Definition: Char.h:107
yarp::os::idl::WireReader::readListHeader
bool readListHeader()
Definition: WireReader.cpp:470
yarp::os::idl::WirePortable::write
virtual bool write(const yarp::os::idl::WireWriter &writer) const
Definition: WirePortable.cpp:20