YARP
Yet Another Robot Platform
RelativeHumidity.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 "sensor_msgs/RelativeHumidity" msg definition:
9 // # Single reading from a relative humidity sensor. Defines the ratio of partial
10 // # pressure of water vapor to the saturated vapor pressure at a temperature.
11 //
12 // Header header # timestamp of the measurement
13 // # frame_id is the location of the humidity sensor
14 //
15 // float64 relative_humidity # Expression of the relative humidity
16 // # from 0.0 to 1.0.
17 // # 0.0 is no partial pressure of water vapor
18 // # 1.0 represents partial pressure of saturation
19 //
20 // float64 variance # 0 is interpreted as variance unknown// Instances of this class can be read and written with YARP ports,
21 // using a ROS-compatible format.
22 
23 #ifndef YARP_ROSMSG_sensor_msgs_RelativeHumidity_h
24 #define YARP_ROSMSG_sensor_msgs_RelativeHumidity_h
25 
26 #include <yarp/os/Wire.h>
27 #include <yarp/os/Type.h>
28 #include <yarp/os/idl/WireTypes.h>
29 #include <string>
30 #include <vector>
32 
33 namespace yarp {
34 namespace rosmsg {
35 namespace sensor_msgs {
36 
38 {
39 public:
43 
45  header(),
46  relative_humidity(0.0),
47  variance(0.0)
48  {
49  }
50 
51  void clear()
52  {
53  // *** header ***
54  header.clear();
55 
56  // *** relative_humidity ***
57  relative_humidity = 0.0;
58 
59  // *** variance ***
60  variance = 0.0;
61  }
62 
63  bool readBare(yarp::os::ConnectionReader& connection) override
64  {
65  // *** header ***
66  if (!header.read(connection)) {
67  return false;
68  }
69 
70  // *** relative_humidity ***
71  relative_humidity = connection.expectFloat64();
72 
73  // *** variance ***
74  variance = connection.expectFloat64();
75 
76  return !connection.isError();
77  }
78 
79  bool readBottle(yarp::os::ConnectionReader& connection) override
80  {
81  connection.convertTextMode();
82  yarp::os::idl::WireReader reader(connection);
83  if (!reader.readListHeader(3)) {
84  return false;
85  }
86 
87  // *** header ***
88  if (!header.read(connection)) {
89  return false;
90  }
91 
92  // *** relative_humidity ***
94 
95  // *** variance ***
96  variance = reader.expectFloat64();
97 
98  return !connection.isError();
99  }
100 
102  bool read(yarp::os::ConnectionReader& connection) override
103  {
104  return (connection.isBareMode() ? readBare(connection)
105  : readBottle(connection));
106  }
107 
108  bool writeBare(yarp::os::ConnectionWriter& connection) const override
109  {
110  // *** header ***
111  if (!header.write(connection)) {
112  return false;
113  }
114 
115  // *** relative_humidity ***
116  connection.appendFloat64(relative_humidity);
117 
118  // *** variance ***
119  connection.appendFloat64(variance);
120 
121  return !connection.isError();
122  }
123 
124  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
125  {
126  connection.appendInt32(BOTTLE_TAG_LIST);
127  connection.appendInt32(3);
128 
129  // *** header ***
130  if (!header.write(connection)) {
131  return false;
132  }
133 
134  // *** relative_humidity ***
135  connection.appendInt32(BOTTLE_TAG_FLOAT64);
136  connection.appendFloat64(relative_humidity);
137 
138  // *** variance ***
139  connection.appendInt32(BOTTLE_TAG_FLOAT64);
140  connection.appendFloat64(variance);
141 
142  connection.convertTextMode();
143  return !connection.isError();
144  }
145 
147  bool write(yarp::os::ConnectionWriter& connection) const override
148  {
149  return (connection.isBareMode() ? writeBare(connection)
150  : writeBottle(connection));
151  }
152 
153  // This class will serialize ROS style or YARP style depending on protocol.
154  // If you need to force a serialization style, use one of these classes:
157 
158  // The name for this message, ROS will need this
159  static constexpr const char* typeName = "sensor_msgs/RelativeHumidity";
160 
161  // The checksum for this message, ROS will need this
162  static constexpr const char* typeChecksum = "8730015b05955b7e992ce29a2678d90f";
163 
164  // The source text for this message, ROS will need this
165  static constexpr const char* typeText = "\
166  # Single reading from a relative humidity sensor. Defines the ratio of partial\n\
167  # pressure of water vapor to the saturated vapor pressure at a temperature.\n\
168 \n\
169  Header header # timestamp of the measurement\n\
170  # frame_id is the location of the humidity sensor\n\
171 \n\
172  float64 relative_humidity # Expression of the relative humidity\n\
173  # from 0.0 to 1.0.\n\
174  # 0.0 is no partial pressure of water vapor\n\
175  # 1.0 represents partial pressure of saturation\n\
176 \n\
177  float64 variance # 0 is interpreted as variance unknown\n\
178 ================================================================================\n\
179 MSG: std_msgs/Header\n\
180 # Standard metadata for higher-level stamped data types.\n\
181 # This is generally used to communicate timestamped data \n\
182 # in a particular coordinate frame.\n\
183 # \n\
184 # sequence ID: consecutively increasing ID \n\
185 uint32 seq\n\
186 #Two-integer timestamp that is expressed as:\n\
187 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
188 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
189 # time-handling sugar is provided by the client library\n\
190 time stamp\n\
191 #Frame this data is associated with\n\
192 # 0: no frame\n\
193 # 1: global frame\n\
194 string frame_id\n\
195 ";
196 
197  yarp::os::Type getType() const override
198  {
200  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
201  typ.addProperty("message_definition", yarp::os::Value(typeText));
202  return typ;
203  }
204 };
205 
206 } // namespace sensor_msgs
207 } // namespace rosmsg
208 } // namespace yarp
209 
210 #endif // YARP_ROSMSG_sensor_msgs_RelativeHumidity_h
#define BOTTLE_TAG_FLOAT64
Definition: Bottle.h:25
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a network connection.
virtual bool isBareMode() const =0
Check if the connection is bare mode.
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
virtual yarp::conf::float64_t expectFloat64()=0
Read a 64-bit floating point number from the network connection.
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 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.
virtual void appendFloat64(yarp::conf::float64_t data)=0
Send a representation of a 64-bit floating point number 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
yarp::conf::float64_t expectFloat64()
Definition: WireReader.h:113
static constexpr const char * typeChecksum
static constexpr const char * typeName
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readBottle(yarp::os::ConnectionReader &connection) override
yarp::os::idl::BottleStyle< yarp::rosmsg::sensor_msgs::RelativeHumidity > bottleStyle
yarp::os::Type getType() const override
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * typeText
yarp::os::idl::BareStyle< yarp::rosmsg::sensor_msgs::RelativeHumidity > rosStyle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
bool readBare(yarp::os::ConnectionReader &connection) override
yarp::rosmsg::std_msgs::Header header
bool writeBare(yarp::os::ConnectionWriter &connection) const override
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Header.h:159
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Header.h:112
double float64_t
Definition: numeric.h:77
The main, catch-all namespace for YARP.
Definition: dirs.h:16