YARP
Yet Another Robot Platform
FrameGraphReply.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 "tf2_msgs/FrameGraphReply" msg definition:
9 // Instances of this class can be read and written with YARP ports,
10 // using a ROS-compatible format.
11 
12 #ifndef YARP_ROSMSG_tf2_msgs_FrameGraphReply_h
13 #define YARP_ROSMSG_tf2_msgs_FrameGraphReply_h
14 
15 #include <yarp/os/Wire.h>
16 #include <yarp/os/Type.h>
17 #include <yarp/os/idl/WireTypes.h>
18 #include <string>
19 #include <vector>
20 
21 namespace yarp {
22 namespace rosmsg {
23 namespace tf2_msgs {
24 
26 {
27 public:
28  std::string frame_yaml;
29 
31  frame_yaml("")
32  {
33  }
34 
35  void clear()
36  {
37  // *** frame_yaml ***
38  frame_yaml = "";
39  }
40 
41  bool readBare(yarp::os::ConnectionReader& connection) override
42  {
43  // *** frame_yaml ***
44  int len = connection.expectInt32();
45  frame_yaml.resize(len);
46  if (!connection.expectBlock((char*)frame_yaml.c_str(), len)) {
47  return false;
48  }
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  // *** frame_yaml ***
62  if (!reader.readString(frame_yaml)) {
63  return false;
64  }
65 
66  return !connection.isError();
67  }
68 
70  bool read(yarp::os::ConnectionReader& connection) override
71  {
72  return (connection.isBareMode() ? readBare(connection)
73  : readBottle(connection));
74  }
75 
76  bool writeBare(yarp::os::ConnectionWriter& connection) const override
77  {
78  // *** frame_yaml ***
79  connection.appendInt32(frame_yaml.length());
80  connection.appendExternalBlock((char*)frame_yaml.c_str(), frame_yaml.length());
81 
82  return !connection.isError();
83  }
84 
85  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
86  {
87  connection.appendInt32(BOTTLE_TAG_LIST);
88  connection.appendInt32(1);
89 
90  // *** frame_yaml ***
91  connection.appendInt32(BOTTLE_TAG_STRING);
92  connection.appendInt32(frame_yaml.length());
93  connection.appendExternalBlock((char*)frame_yaml.c_str(), frame_yaml.length());
94 
95  connection.convertTextMode();
96  return !connection.isError();
97  }
98 
100  bool write(yarp::os::ConnectionWriter& connection) const override
101  {
102  return (connection.isBareMode() ? writeBare(connection)
103  : writeBottle(connection));
104  }
105 
106  // This class will serialize ROS style or YARP style depending on protocol.
107  // If you need to force a serialization style, use one of these classes:
110 
111  // The name for this message, ROS will need this
112  static constexpr const char* typeName = "tf2_msgs/FrameGraphReply";
113 
114  // The checksum for this message, ROS will need this
115  static constexpr const char* typeChecksum = "437ea58e9463815a0d511c7326b686b0";
116 
117  // The source text for this message, ROS will need this
118  static constexpr const char* typeText = "\
119 \n\
120 ";
121 
122  yarp::os::Type getType() const override
123  {
125  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
126  typ.addProperty("message_definition", yarp::os::Value(typeText));
127  return typ;
128  }
129 };
130 
131 } // namespace tf2_msgs
132 } // namespace rosmsg
133 } // namespace yarp
134 
135 #endif // YARP_ROSMSG_tf2_msgs_FrameGraphReply_h
#define BOTTLE_TAG_STRING
Definition: Bottle.h:26
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a network connection.
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
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
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 appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
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
bool readString(std::string &str, bool *is_vocab=nullptr)
Definition: WireReader.cpp:382
bool readBottle(yarp::os::ConnectionReader &connection) override
yarp::os::Type getType() const override
bool readBare(yarp::os::ConnectionReader &connection) override
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * typeChecksum
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * typeText
bool writeBare(yarp::os::ConnectionWriter &connection) const override
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
yarp::os::idl::BareStyle< yarp::rosmsg::tf2_msgs::FrameGraphReply > rosStyle
static constexpr const char * typeName
yarp::os::idl::BottleStyle< yarp::rosmsg::tf2_msgs::FrameGraphReply > bottleStyle
The main, catch-all namespace for YARP.
Definition: dirs.h:16