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