YARP
Yet Another Robot Platform
Temperature.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/Temperature" msg definition:
9// # Single temperature reading.
10//
11// Header header # timestamp is the time the temperature was measured
12// # frame_id is the location of the temperature reading
13//
14// float64 temperature # Measurement of the Temperature in Degrees Celsius
15//
16// float64 variance # 0 is interpreted as variance unknown// Instances of this class can be read and written with YARP ports,
17// using a ROS-compatible format.
18
19#ifndef YARP_ROSMSG_sensor_msgs_Temperature_h
20#define YARP_ROSMSG_sensor_msgs_Temperature_h
22#include <yarp/os/Wire.h>
23#include <yarp/os/Type.h>
25#include <string>
26#include <vector>
28
29namespace yarp {
30namespace rosmsg {
31namespace sensor_msgs {
32
34{
35public:
37 yarp::conf::float64_t temperature;
38 yarp::conf::float64_t variance;
39
40 Temperature() :
41 header(),
42 temperature(0.0),
43 variance(0.0)
44 {
45 }
46
47 void clear()
48 {
49 // *** header ***
50 header.clear();
51
52 // *** temperature ***
53 temperature = 0.0;
54
55 // *** variance ***
56 variance = 0.0;
57 }
58
59 bool readBare(yarp::os::ConnectionReader& connection) override
60 {
61 // *** header ***
62 if (!header.read(connection)) {
63 return false;
64 }
65
66 // *** temperature ***
67 temperature = connection.expectFloat64();
68
69 // *** variance ***
70 variance = connection.expectFloat64();
71
72 return !connection.isError();
73 }
74
75 bool readBottle(yarp::os::ConnectionReader& connection) override
76 {
77 connection.convertTextMode();
78 yarp::os::idl::WireReader reader(connection);
79 if (!reader.readListHeader(3)) {
80 return false;
81 }
82
83 // *** header ***
84 if (!header.read(connection)) {
85 return false;
86 }
87
88 // *** temperature ***
89 temperature = reader.expectFloat64();
90
91 // *** variance ***
92 variance = reader.expectFloat64();
93
94 return !connection.isError();
95 }
96
98 bool read(yarp::os::ConnectionReader& connection) override
99 {
100 return (connection.isBareMode() ? readBare(connection)
101 : readBottle(connection));
102 }
103
104 bool writeBare(yarp::os::ConnectionWriter& connection) const override
105 {
106 // *** header ***
107 if (!header.write(connection)) {
108 return false;
109 }
110
111 // *** temperature ***
112 connection.appendFloat64(temperature);
113
114 // *** variance ***
115 connection.appendFloat64(variance);
116
117 return !connection.isError();
118 }
119
120 bool writeBottle(yarp::os::ConnectionWriter& connection) const override
121 {
122 connection.appendInt32(BOTTLE_TAG_LIST);
123 connection.appendInt32(3);
124
125 // *** header ***
126 if (!header.write(connection)) {
127 return false;
128 }
129
130 // *** temperature ***
132 connection.appendFloat64(temperature);
133
134 // *** variance ***
136 connection.appendFloat64(variance);
137
138 connection.convertTextMode();
139 return !connection.isError();
140 }
141
143 bool write(yarp::os::ConnectionWriter& connection) const override
144 {
145 return (connection.isBareMode() ? writeBare(connection)
146 : writeBottle(connection));
147 }
148
149 // This class will serialize ROS style or YARP style depending on protocol.
150 // If you need to force a serialization style, use one of these classes:
153
154 // The name for this message, ROS will need this
155 static constexpr const char* typeName = "sensor_msgs/Temperature";
156
157 // The checksum for this message, ROS will need this
158 static constexpr const char* typeChecksum = "ff71b307acdbe7c871a5a6d7ed359100";
159
160 // The source text for this message, ROS will need this
161 static constexpr const char* typeText = "\
162 # Single temperature reading.\n\
163\n\
164 Header header # timestamp is the time the temperature was measured\n\
165 # frame_id is the location of the temperature reading\n\
166\n\
167 float64 temperature # Measurement of the Temperature in Degrees Celsius\n\
168\n\
169 float64 variance # 0 is interpreted as variance unknown\n\
170================================================================================\n\
171MSG: std_msgs/Header\n\
172# Standard metadata for higher-level stamped data types.\n\
173# This is generally used to communicate timestamped data \n\
174# in a particular coordinate frame.\n\
175# \n\
176# sequence ID: consecutively increasing ID \n\
177uint32 seq\n\
178#Two-integer timestamp that is expressed as:\n\
179# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
180# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
181# time-handling sugar is provided by the client library\n\
182time stamp\n\
183#Frame this data is associated with\n\
184# 0: no frame\n\
185# 1: global frame\n\
186string frame_id\n\
187";
188
189 yarp::os::Type getType() const override
190 {
191 yarp::os::Type typ = yarp::os::Type::byName(typeName, typeName);
192 typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
193 typ.addProperty("message_definition", yarp::os::Value(typeText));
194 return typ;
195 }
196};
197
198} // namespace sensor_msgs
199} // namespace rosmsg
200} // namespace yarp
201
202#endif // YARP_ROSMSG_sensor_msgs_Temperature_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:43
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:21
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:27
yarp::conf::float64_t expectFloat64()
Definition: WireReader.h:110
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
yarp::rosmsg::sensor_msgs::Temperature Temperature
Definition: Temperature.h:21
double float64_t
Definition: numeric.h:77
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:915
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1091
The main, catch-all namespace for YARP.
Definition: dirs.h:16