YARP
Yet Another Robot Platform
Accel.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 "geometry_msgs/Accel" msg definition:
12 // # This expresses acceleration in free space broken into its linear and angular parts.
13 // Vector3 linear
14 // Vector3 angular
15 // Instances of this class can be read and written with YARP ports,
16 // using a ROS-compatible format.
17 
18 #ifndef YARP_ROSMSG_geometry_msgs_Accel_h
19 #define YARP_ROSMSG_geometry_msgs_Accel_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>
27 
28 namespace yarp {
29 namespace rosmsg {
30 namespace geometry_msgs {
31 
33 {
34 public:
37 
38  Accel() :
39  linear(),
40  angular()
41  {
42  }
43 
44  void clear()
45  {
46  // *** linear ***
47  linear.clear();
48 
49  // *** angular ***
50  angular.clear();
51  }
52 
53  bool readBare(yarp::os::ConnectionReader& connection) override
54  {
55  // *** linear ***
56  if (!linear.read(connection)) {
57  return false;
58  }
59 
60  // *** angular ***
61  if (!angular.read(connection)) {
62  return false;
63  }
64 
65  return !connection.isError();
66  }
67 
68  bool readBottle(yarp::os::ConnectionReader& connection) override
69  {
70  connection.convertTextMode();
71  yarp::os::idl::WireReader reader(connection);
72  if (!reader.readListHeader(2)) {
73  return false;
74  }
75 
76  // *** linear ***
77  if (!linear.read(connection)) {
78  return false;
79  }
80 
81  // *** angular ***
82  if (!angular.read(connection)) {
83  return false;
84  }
85 
86  return !connection.isError();
87  }
88 
90  bool read(yarp::os::ConnectionReader& connection) override
91  {
92  return (connection.isBareMode() ? readBare(connection)
93  : readBottle(connection));
94  }
95 
96  bool writeBare(yarp::os::ConnectionWriter& connection) const override
97  {
98  // *** linear ***
99  if (!linear.write(connection)) {
100  return false;
101  }
102 
103  // *** angular ***
104  if (!angular.write(connection)) {
105  return false;
106  }
107 
108  return !connection.isError();
109  }
110 
111  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
112  {
113  connection.appendInt32(BOTTLE_TAG_LIST);
114  connection.appendInt32(2);
115 
116  // *** linear ***
117  if (!linear.write(connection)) {
118  return false;
119  }
120 
121  // *** angular ***
122  if (!angular.write(connection)) {
123  return false;
124  }
125 
126  connection.convertTextMode();
127  return !connection.isError();
128  }
129 
131  bool write(yarp::os::ConnectionWriter& connection) const override
132  {
133  return (connection.isBareMode() ? writeBare(connection)
134  : writeBottle(connection));
135  }
136 
137  // This class will serialize ROS style or YARP style depending on protocol.
138  // If you need to force a serialization style, use one of these classes:
141 
142  // The name for this message, ROS will need this
143  static constexpr const char* typeName = "geometry_msgs/Accel";
144 
145  // The checksum for this message, ROS will need this
146  static constexpr const char* typeChecksum = "9f195f881246fdfa2798d1d3eebca84a";
147 
148  // The source text for this message, ROS will need this
149  static constexpr const char* typeText = "\
150 # This expresses acceleration in free space broken into its linear and angular parts.\n\
151 Vector3 linear\n\
152 Vector3 angular\n\
153 \n\
154 ================================================================================\n\
155 MSG: geometry_msgs/Vector3\n\
156 # This represents a vector in free space. \n\
157 # It is only meant to represent a direction. Therefore, it does not\n\
158 # make sense to apply a translation to it (e.g., when applying a \n\
159 # generic rigid transformation to a Vector3, tf2 will only apply the\n\
160 # rotation). If you want your data to be translatable too, use the\n\
161 # geometry_msgs/Point message instead.\n\
162 \n\
163 float64 x\n\
164 float64 y\n\
165 float64 z\n\
166 ";
167 
168  yarp::os::Type getType() const override
169  {
171  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
172  typ.addProperty("message_definition", yarp::os::Value(typeText));
173  return typ;
174  }
175 };
176 
177 } // namespace geometry_msgs
178 } // namespace rosmsg
179 } // namespace yarp
180 
181 #endif // YARP_ROSMSG_geometry_msgs_Accel_h
yarp::rosmsg::geometry_msgs::Accel::typeChecksum
static constexpr const char * typeChecksum
Definition: Accel.h:146
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
yarp::rosmsg::geometry_msgs::Accel::typeText
static constexpr const char * typeText
Definition: Accel.h:149
yarp::rosmsg::geometry_msgs::Vector3
Definition: Vector3.h:38
yarp::rosmsg::geometry_msgs::Vector3::clear
void clear()
Definition: Vector3.h:51
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::geometry_msgs::Vector3::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Vector3.h:98
yarp::rosmsg::geometry_msgs::Accel::Accel
Accel()
Definition: Accel.h:38
geometry_msgs
Definition: Accel.h:22
yarp::rosmsg::geometry_msgs::Accel::angular
yarp::rosmsg::geometry_msgs::Vector3 angular
Definition: Accel.h:36
yarp::rosmsg::geometry_msgs::Accel::clear
void clear()
Definition: Accel.h:44
yarp::rosmsg::geometry_msgs::Accel::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::Accel > rosStyle
Definition: Accel.h:139
yarp::rosmsg::geometry_msgs::Accel::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Accel.h:111
yarp::rosmsg::geometry_msgs::Accel::getType
yarp::os::Type getType() const override
Definition: Accel.h:168
yarp::rosmsg::geometry_msgs::Accel::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Accel.h:90
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::rosmsg::geometry_msgs::Accel::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Accel.h:96
yarp::rosmsg::geometry_msgs::Accel::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Accel.h:53
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
Vector3.h
yarp::rosmsg::geometry_msgs::Accel
Definition: Accel.h:33
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::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::geometry_msgs::Accel::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Accel.h:131
yarp::os::idl::BareStyle
Definition: BareStyle.h:22
yarp::rosmsg::geometry_msgs::Accel::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Accel.h:68
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::geometry_msgs::Accel::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::Accel > bottleStyle
Definition: Accel.h:140
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::geometry_msgs::Accel::linear
yarp::rosmsg::geometry_msgs::Vector3 linear
Definition: Accel.h:35
yarp::rosmsg::geometry_msgs::Vector3::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Vector3.h:140
yarp::os::idl::WireReader::readListHeader
bool readListHeader()
Definition: WireReader.cpp:470
yarp::rosmsg::geometry_msgs::Accel::typeName
static constexpr const char * typeName
Definition: Accel.h:143
yarp::os::idl::WirePortable::write
virtual bool write(const yarp::os::idl::WireWriter &writer) const
Definition: WirePortable.cpp:20