YARP
Yet Another Robot Platform
MapMetaData.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 "nav_msgs/MapMetaData" msg definition:
12 // # This hold basic information about the characterists of the OccupancyGrid
13 //
14 // # The time at which the map was loaded
15 // time map_load_time
16 // # The map resolution [m/cell]
17 // float32 resolution
18 // # Map width [cells]
19 // uint32 width
20 // # Map height [cells]
21 // uint32 height
22 // # The origin of the map [m, m, rad]. This is the real-world pose of the
23 // # cell (0,0) in the map.
24 // geometry_msgs/Pose origin// Instances of this class can be read and written with YARP ports,
25 // using a ROS-compatible format.
26 
27 #ifndef YARP_ROSMSG_nav_msgs_MapMetaData_h
28 #define YARP_ROSMSG_nav_msgs_MapMetaData_h
29 
30 #include <yarp/os/Wire.h>
31 #include <yarp/os/Type.h>
32 #include <yarp/os/idl/WireTypes.h>
33 #include <string>
34 #include <vector>
35 #include <yarp/rosmsg/TickTime.h>
37 
38 namespace yarp {
39 namespace rosmsg {
40 namespace nav_msgs {
41 
43 {
44 public:
47  std::uint32_t width;
48  std::uint32_t height;
50 
52  map_load_time(),
53  resolution(0.0f),
54  width(0),
55  height(0),
56  origin()
57  {
58  }
59 
60  void clear()
61  {
62  // *** map_load_time ***
64 
65  // *** resolution ***
66  resolution = 0.0f;
67 
68  // *** width ***
69  width = 0;
70 
71  // *** height ***
72  height = 0;
73 
74  // *** origin ***
75  origin.clear();
76  }
77 
78  bool readBare(yarp::os::ConnectionReader& connection) override
79  {
80  // *** map_load_time ***
81  if (!map_load_time.read(connection)) {
82  return false;
83  }
84 
85  // *** resolution ***
86  resolution = connection.expectFloat32();
87 
88  // *** width ***
89  width = connection.expectInt32();
90 
91  // *** height ***
92  height = connection.expectInt32();
93 
94  // *** origin ***
95  if (!origin.read(connection)) {
96  return false;
97  }
98 
99  return !connection.isError();
100  }
101 
102  bool readBottle(yarp::os::ConnectionReader& connection) override
103  {
104  connection.convertTextMode();
105  yarp::os::idl::WireReader reader(connection);
106  if (!reader.readListHeader(5)) {
107  return false;
108  }
109 
110  // *** map_load_time ***
111  if (!map_load_time.read(connection)) {
112  return false;
113  }
114 
115  // *** resolution ***
116  resolution = reader.expectFloat32();
117 
118  // *** width ***
119  width = reader.expectInt32();
120 
121  // *** height ***
122  height = reader.expectInt32();
123 
124  // *** origin ***
125  if (!origin.read(connection)) {
126  return false;
127  }
128 
129  return !connection.isError();
130  }
131 
133  bool read(yarp::os::ConnectionReader& connection) override
134  {
135  return (connection.isBareMode() ? readBare(connection)
136  : readBottle(connection));
137  }
138 
139  bool writeBare(yarp::os::ConnectionWriter& connection) const override
140  {
141  // *** map_load_time ***
142  if (!map_load_time.write(connection)) {
143  return false;
144  }
145 
146  // *** resolution ***
147  connection.appendFloat32(resolution);
148 
149  // *** width ***
150  connection.appendInt32(width);
151 
152  // *** height ***
153  connection.appendInt32(height);
154 
155  // *** origin ***
156  if (!origin.write(connection)) {
157  return false;
158  }
159 
160  return !connection.isError();
161  }
162 
163  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
164  {
165  connection.appendInt32(BOTTLE_TAG_LIST);
166  connection.appendInt32(5);
167 
168  // *** map_load_time ***
169  if (!map_load_time.write(connection)) {
170  return false;
171  }
172 
173  // *** resolution ***
174  connection.appendInt32(BOTTLE_TAG_FLOAT32);
175  connection.appendFloat32(resolution);
176 
177  // *** width ***
178  connection.appendInt32(BOTTLE_TAG_INT32);
179  connection.appendInt32(width);
180 
181  // *** height ***
182  connection.appendInt32(BOTTLE_TAG_INT32);
183  connection.appendInt32(height);
184 
185  // *** origin ***
186  if (!origin.write(connection)) {
187  return false;
188  }
189 
190  connection.convertTextMode();
191  return !connection.isError();
192  }
193 
195  bool write(yarp::os::ConnectionWriter& connection) const override
196  {
197  return (connection.isBareMode() ? writeBare(connection)
198  : writeBottle(connection));
199  }
200 
201  // This class will serialize ROS style or YARP style depending on protocol.
202  // If you need to force a serialization style, use one of these classes:
205 
206  // The name for this message, ROS will need this
207  static constexpr const char* typeName = "nav_msgs/MapMetaData";
208 
209  // The checksum for this message, ROS will need this
210  static constexpr const char* typeChecksum = "10cfc8a2818024d3248802c00c95f11b";
211 
212  // The source text for this message, ROS will need this
213  static constexpr const char* typeText = "\
214 # This hold basic information about the characterists of the OccupancyGrid\n\
215 \n\
216 # The time at which the map was loaded\n\
217 time map_load_time\n\
218 # The map resolution [m/cell]\n\
219 float32 resolution\n\
220 # Map width [cells]\n\
221 uint32 width\n\
222 # Map height [cells]\n\
223 uint32 height\n\
224 # The origin of the map [m, m, rad]. This is the real-world pose of the\n\
225 # cell (0,0) in the map.\n\
226 geometry_msgs/Pose origin\n\
227 ================================================================================\n\
228 MSG: geometry_msgs/Pose\n\
229 # A representation of pose in free space, composed of position and orientation. \n\
230 Point position\n\
231 Quaternion orientation\n\
232 \n\
233 ================================================================================\n\
234 MSG: geometry_msgs/Point\n\
235 # This contains the position of a point in free space\n\
236 float64 x\n\
237 float64 y\n\
238 float64 z\n\
239 \n\
240 ================================================================================\n\
241 MSG: geometry_msgs/Quaternion\n\
242 # This represents an orientation in free space in quaternion form.\n\
243 \n\
244 float64 x\n\
245 float64 y\n\
246 float64 z\n\
247 float64 w\n\
248 ";
249 
250  yarp::os::Type getType() const override
251  {
253  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
254  typ.addProperty("message_definition", yarp::os::Value(typeText));
255  return typ;
256  }
257 };
258 
259 } // namespace nav_msgs
260 } // namespace rosmsg
261 } // namespace yarp
262 
263 #endif // YARP_ROSMSG_nav_msgs_MapMetaData_h
yarp::rosmsg::nav_msgs::MapMetaData::height
std::uint32_t height
Definition: MapMetaData.h:48
yarp::os::ConnectionWriter::appendFloat32
virtual void appendFloat32(yarp::conf::float32_t data)=0
Send a representation of a 32-bit floating point number to the network connection.
yarp::rosmsg::nav_msgs::MapMetaData::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: MapMetaData.h:78
TickTime.h
WireTypes.h
yarp::rosmsg::geometry_msgs::Pose
Definition: Pose.h:34
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
yarp::os::idl::WireReader::expectFloat32
yarp::conf::float32_t expectFloat32()
Definition: WireReader.h:113
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::rosmsg::geometry_msgs::Pose::clear
void clear()
Definition: Pose.h:45
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
Wire.h
yarp::rosmsg::nav_msgs::MapMetaData::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: MapMetaData.h:133
yarp::rosmsg::nav_msgs::MapMetaData::typeText
static constexpr const char * typeText
Definition: MapMetaData.h:213
BOTTLE_TAG_INT32
#define BOTTLE_TAG_INT32
Definition: Bottle.h:23
yarp::rosmsg::nav_msgs::MapMetaData::typeChecksum
static constexpr const char * typeChecksum
Definition: MapMetaData.h:210
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::rosmsg::TickTime
Definition: TickTime.h:30
yarp::rosmsg::nav_msgs::MapMetaData::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::nav_msgs::MapMetaData > bottleStyle
Definition: MapMetaData.h:204
BOTTLE_TAG_FLOAT32
#define BOTTLE_TAG_FLOAT32
Definition: Bottle.h:26
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::rosmsg::nav_msgs::MapMetaData
Definition: MapMetaData.h:43
yarp::rosmsg::nav_msgs::MapMetaData::map_load_time
yarp::rosmsg::TickTime map_load_time
Definition: MapMetaData.h:45
yarp::os::ConnectionReader::expectInt32
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
yarp::os::Type::addProperty
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:137
yarp::rosmsg::nav_msgs::MapMetaData::typeName
static constexpr const char * typeName
Definition: MapMetaData.h:207
yarp::rosmsg::nav_msgs::MapMetaData::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: MapMetaData.h:163
Type.h
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::rosmsg::nav_msgs::MapMetaData::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: MapMetaData.h:139
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::rosmsg::nav_msgs::MapMetaData::origin
yarp::rosmsg::geometry_msgs::Pose origin
Definition: MapMetaData.h:49
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.
Pose.h
yarp::rosmsg::nav_msgs::MapMetaData::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: MapMetaData.h:102
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::rosmsg::TickTime::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: TickTime.h:116
yarp::conf::float32_t
float float32_t
Definition: numeric.h:50
yarp::os::ConnectionWriter::appendInt32
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
nav_msgs
Definition: GetMap.h:22
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::os::idl::WireReader::expectInt32
std::int32_t expectInt32()
Definition: WireReader.h:99
yarp::rosmsg::nav_msgs::MapMetaData::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::nav_msgs::MapMetaData > rosStyle
Definition: MapMetaData.h:203
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::TickTime::clear
void clear()
Definition: TickTime.h:78
yarp::rosmsg::geometry_msgs::Pose::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Pose.h:91
yarp::rosmsg::nav_msgs::MapMetaData::getType
yarp::os::Type getType() const override
Definition: MapMetaData.h:250
yarp::os::ConnectionReader::expectFloat32
virtual yarp::conf::float32_t expectFloat32()=0
Read a 32-bit floating point number from the network connection.
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::nav_msgs::MapMetaData::width
std::uint32_t width
Definition: MapMetaData.h:47
yarp::rosmsg::TickTime::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: TickTime.h:151
yarp::rosmsg::nav_msgs::MapMetaData::MapMetaData
MapMetaData()
Definition: MapMetaData.h:51
yarp::rosmsg::geometry_msgs::Pose::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Pose.h:132
yarp::rosmsg::nav_msgs::MapMetaData::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: MapMetaData.h:195
yarp::rosmsg::nav_msgs::MapMetaData::clear
void clear()
Definition: MapMetaData.h:60
yarp::os::idl::WireReader::readListHeader
bool readListHeader()
Definition: WireReader.cpp:470
yarp::rosmsg::nav_msgs::MapMetaData::resolution
yarp::conf::float32_t resolution
Definition: MapMetaData.h:46
yarp::os::idl::WirePortable::write
virtual bool write(const yarp::os::idl::WireWriter &writer) const
Definition: WirePortable.cpp:20