YARP
Yet Another Robot Platform
Float64.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 "std_msgs/Float64" msg definition:
9 // float64 data// Instances of this class can be read and written with YARP ports,
10 // using a ROS-compatible format.
11 
12 #ifndef YARP_ROSMSG_std_msgs_Float64_h
13 #define YARP_ROSMSG_std_msgs_Float64_h
14 
15 #include <yarp/os/Wire.h>
16 #include <yarp/os/Type.h>
17 #include <yarp/os/idl/WireTypes.h>
18 #include <string>
19 #include <vector>
20 
21 namespace yarp {
22 namespace rosmsg {
23 namespace std_msgs {
24 
26 {
27 public:
29 
30  Float64() :
31  data(0.0)
32  {
33  }
34 
35  void clear()
36  {
37  // *** data ***
38  data = 0.0;
39  }
40 
41  bool readBare(yarp::os::ConnectionReader& connection) override
42  {
43  // *** data ***
44  data = connection.expectFloat64();
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(1)) {
54  return false;
55  }
56 
57  // *** data ***
58  data = reader.expectFloat64();
59 
60  return !connection.isError();
61  }
62 
64  bool read(yarp::os::ConnectionReader& connection) override
65  {
66  return (connection.isBareMode() ? readBare(connection)
67  : readBottle(connection));
68  }
69 
70  bool writeBare(yarp::os::ConnectionWriter& connection) const override
71  {
72  // *** data ***
73  connection.appendFloat64(data);
74 
75  return !connection.isError();
76  }
77 
78  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
79  {
80  connection.appendInt32(BOTTLE_TAG_LIST);
81  connection.appendInt32(1);
82 
83  // *** data ***
84  connection.appendInt32(BOTTLE_TAG_FLOAT64);
85  connection.appendFloat64(data);
86 
87  connection.convertTextMode();
88  return !connection.isError();
89  }
90 
92  bool write(yarp::os::ConnectionWriter& connection) const override
93  {
94  return (connection.isBareMode() ? writeBare(connection)
95  : writeBottle(connection));
96  }
97 
98  // This class will serialize ROS style or YARP style depending on protocol.
99  // If you need to force a serialization style, use one of these classes:
102 
103  // The name for this message, ROS will need this
104  static constexpr const char* typeName = "std_msgs/Float64";
105 
106  // The checksum for this message, ROS will need this
107  static constexpr const char* typeChecksum = "fdb28210bfa9d7c91146260178d9a584";
108 
109  // The source text for this message, ROS will need this
110  static constexpr const char* typeText = "\
111 float64 data\n\
112 ";
113 
114  yarp::os::Type getType() const override
115  {
117  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
118  typ.addProperty("message_definition", yarp::os::Value(typeText));
119  return typ;
120  }
121 };
122 
123 } // namespace std_msgs
124 } // namespace rosmsg
125 } // namespace yarp
126 
127 #endif // YARP_ROSMSG_std_msgs_Float64_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
Definition: Float64.h:107
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Float64.h:78
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Float64.h:41
yarp::os::idl::BottleStyle< yarp::rosmsg::std_msgs::Float64 > bottleStyle
Definition: Float64.h:101
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Float64.h:92
yarp::os::Type getType() const override
Definition: Float64.h:114
yarp::os::idl::BareStyle< yarp::rosmsg::std_msgs::Float64 > rosStyle
Definition: Float64.h:100
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Float64.h:64
static constexpr const char * typeText
Definition: Float64.h:110
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Float64.h:49
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Float64.h:70
static constexpr const char * typeName
Definition: Float64.h:104
yarp::conf::float64_t data
Definition: Float64.h:28
Definition: Bool.h:19
double float64_t
Definition: numeric.h:77
The main, catch-all namespace for YARP.
Definition: dirs.h:16