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