YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ColorRGBA.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/ColorRGBA" msg definition:
9// float32 r
10// float32 g
11// float32 b
12// float32 a
13// Instances of this class can be read and written with YARP ports,
14// using a ROS-compatible format.
15
16#ifndef YARP_ROSMSG_std_msgs_ColorRGBA_h
17#define YARP_ROSMSG_std_msgs_ColorRGBA_h
18
19#include <yarp/os/Wire.h>
20#include <yarp/os/Type.h>
22#include <string>
23#include <vector>
24
25namespace yarp {
26namespace rosmsg {
27namespace std_msgs {
28
30{
31public:
36
38 r(0.0f),
39 g(0.0f),
40 b(0.0f),
41 a(0.0f)
42 {
43 }
44
45 void clear()
46 {
47 // *** r ***
48 r = 0.0f;
49
50 // *** g ***
51 g = 0.0f;
52
53 // *** b ***
54 b = 0.0f;
55
56 // *** a ***
57 a = 0.0f;
58 }
59
60 bool readBare(yarp::os::ConnectionReader& connection) override
61 {
62 // *** r ***
63 r = connection.expectFloat32();
64
65 // *** g ***
66 g = connection.expectFloat32();
67
68 // *** b ***
69 b = connection.expectFloat32();
70
71 // *** a ***
72 a = connection.expectFloat32();
73
74 return !connection.isError();
75 }
76
77 bool readBottle(yarp::os::ConnectionReader& connection) override
78 {
79 connection.convertTextMode();
80 yarp::os::idl::WireReader reader(connection);
81 if (!reader.readListHeader(4)) {
82 return false;
83 }
84
85 // *** r ***
86 r = reader.expectFloat32();
87
88 // *** g ***
89 g = reader.expectFloat32();
90
91 // *** b ***
92 b = reader.expectFloat32();
93
94 // *** a ***
95 a = reader.expectFloat32();
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 // *** r ***
110 connection.appendFloat32(r);
111
112 // *** g ***
113 connection.appendFloat32(g);
114
115 // *** b ***
116 connection.appendFloat32(b);
117
118 // *** a ***
119 connection.appendFloat32(a);
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(4);
128
129 // *** r ***
131 connection.appendFloat32(r);
132
133 // *** g ***
135 connection.appendFloat32(g);
136
137 // *** b ***
139 connection.appendFloat32(b);
140
141 // *** a ***
143 connection.appendFloat32(a);
144
145 connection.convertTextMode();
146 return !connection.isError();
147 }
148
150 bool write(yarp::os::ConnectionWriter& connection) const override
151 {
152 return (connection.isBareMode() ? writeBare(connection)
153 : writeBottle(connection));
154 }
155
156 // This class will serialize ROS style or YARP style depending on protocol.
157 // If you need to force a serialization style, use one of these classes:
160
161 // The name for this message, ROS will need this
162 static constexpr const char* typeName = "std_msgs/ColorRGBA";
163
164 // The checksum for this message, ROS will need this
165 static constexpr const char* typeChecksum = "a29a96539573343b1310c73607334b00";
166
167 // The source text for this message, ROS will need this
168 static constexpr const char* typeText = "\
169float32 r\n\
170float32 g\n\
171float32 b\n\
172float32 a\n\
173";
174
175 yarp::os::Type getType() const override
176 {
179 typ.addProperty("message_definition", yarp::os::Value(typeText));
180 return typ;
181 }
182};
183
184} // namespace std_msgs
185} // namespace rosmsg
186} // namespace yarp
187
188#endif // YARP_ROSMSG_std_msgs_ColorRGBA_h
#define BOTTLE_TAG_LIST
Definition Bottle.h:28
#define BOTTLE_TAG_FLOAT32
Definition Bottle.h:24
A mini-server for performing network communication in the background.
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 yarp::conf::float32_t expectFloat32()=0
Read a 32-bit floating point number from the network connection.
virtual bool isError() const =0
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 void appendFloat32(yarp::conf::float32_t data)=0
Send a representation of a 32-bit floating point number to the network connection.
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.
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.
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::float32_t expectFloat32()
Definition WireReader.h:103
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition ColorRGBA.h:77
bool readBare(yarp::os::ConnectionReader &connection) override
Definition ColorRGBA.h:60
yarp::conf::float32_t b
Definition ColorRGBA.h:34
static constexpr const char * typeText
Definition ColorRGBA.h:168
static constexpr const char * typeName
Definition ColorRGBA.h:162
yarp::os::idl::BareStyle< yarp::rosmsg::std_msgs::ColorRGBA > rosStyle
Definition ColorRGBA.h:158
yarp::os::Type getType() const override
Definition ColorRGBA.h:175
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition ColorRGBA.h:107
yarp::os::idl::BottleStyle< yarp::rosmsg::std_msgs::ColorRGBA > bottleStyle
Definition ColorRGBA.h:159
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition ColorRGBA.h:124
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition ColorRGBA.h:101
yarp::conf::float32_t a
Definition ColorRGBA.h:35
static constexpr const char * typeChecksum
Definition ColorRGBA.h:165
yarp::conf::float32_t g
Definition ColorRGBA.h:33
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition ColorRGBA.h:150
yarp::conf::float32_t r
Definition ColorRGBA.h:32
The main, catch-all namespace for YARP.
Definition dirs.h:16