YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Map2DLocationData.cpp
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// Autogenerated by Thrift Compiler (0.14.1-yarped)
7//
8// This is an automatically generated file.
9// It could get re-generated if the ALLOW_IDL_GENERATION flag is on.
10
12
13namespace yarp::dev {
14
15// Constructor with field values
16Map2DLocationData::Map2DLocationData(const std::string& map_id,
17 const double x,
18 const double y,
19 const double theta,
20 const std::string& description) :
21 WirePortable(),
22 map_id(map_id),
23 x(x),
24 y(y),
25 theta(theta),
26 description(description)
27{
28}
29
30// Read structure on a Wire
32{
33 if (!read_map_id(reader)) {
34 return false;
35 }
36 if (!read_x(reader)) {
37 return false;
38 }
39 if (!read_y(reader)) {
40 return false;
41 }
42 if (!read_theta(reader)) {
43 return false;
44 }
45 if (!read_description(reader)) {
46 return false;
47 }
48 if (reader.isError()) {
49 return false;
50 }
51 return true;
52}
53
54// Read structure on a Connection
56{
57 yarp::os::idl::WireReader reader(connection);
58 if (!reader.readListHeader(5)) {
59 return false;
60 }
61 if (!read(reader)) {
62 return false;
63 }
64 return true;
65}
66
67// Write structure on a Wire
69{
70 if (!write_map_id(writer)) {
71 return false;
72 }
73 if (!write_x(writer)) {
74 return false;
75 }
76 if (!write_y(writer)) {
77 return false;
78 }
79 if (!write_theta(writer)) {
80 return false;
81 }
82 if (!write_description(writer)) {
83 return false;
84 }
85 if (writer.isError()) {
86 return false;
87 }
88 return true;
89}
90
91// Write structure on a Connection
93{
94 yarp::os::idl::WireWriter writer(connection);
95 if (!writer.writeListHeader(5)) {
96 return false;
97 }
98 if (!write(writer)) {
99 return false;
100 }
101 return true;
102}
103
104// Convert to a printable string
106{
108 if (!yarp::os::Portable::copyPortable(*this, b)) {
109 return {};
110 }
111 return b.toString();
112}
113
114// read map_id field
115bool Map2DLocationData::read_map_id(yarp::os::idl::WireReader& reader)
116{
117 if (reader.noMore()) {
118 reader.fail();
119 return false;
120 }
121 if (!reader.readString(map_id)) {
122 reader.fail();
123 return false;
124 }
125 return true;
126}
127
128// write map_id field
129bool Map2DLocationData::write_map_id(const yarp::os::idl::WireWriter& writer) const
130{
131 if (!writer.writeString(map_id)) {
132 return false;
133 }
134 return true;
135}
136
137// read (nested) map_id field
138bool Map2DLocationData::nested_read_map_id(yarp::os::idl::WireReader& reader)
139{
140 if (reader.noMore()) {
141 reader.fail();
142 return false;
143 }
144 if (!reader.readString(map_id)) {
145 reader.fail();
146 return false;
147 }
148 return true;
149}
150
151// write (nested) map_id field
152bool Map2DLocationData::nested_write_map_id(const yarp::os::idl::WireWriter& writer) const
153{
154 if (!writer.writeString(map_id)) {
155 return false;
156 }
157 return true;
158}
159
160// read x field
161bool Map2DLocationData::read_x(yarp::os::idl::WireReader& reader)
162{
163 if (reader.noMore()) {
164 reader.fail();
165 return false;
166 }
167 if (!reader.readFloat64(x)) {
168 reader.fail();
169 return false;
170 }
171 return true;
172}
173
174// write x field
175bool Map2DLocationData::write_x(const yarp::os::idl::WireWriter& writer) const
176{
177 if (!writer.writeFloat64(x)) {
178 return false;
179 }
180 return true;
181}
182
183// read (nested) x field
184bool Map2DLocationData::nested_read_x(yarp::os::idl::WireReader& reader)
185{
186 if (reader.noMore()) {
187 reader.fail();
188 return false;
189 }
190 if (!reader.readFloat64(x)) {
191 reader.fail();
192 return false;
193 }
194 return true;
195}
196
197// write (nested) x field
198bool Map2DLocationData::nested_write_x(const yarp::os::idl::WireWriter& writer) const
199{
200 if (!writer.writeFloat64(x)) {
201 return false;
202 }
203 return true;
204}
205
206// read y field
207bool Map2DLocationData::read_y(yarp::os::idl::WireReader& reader)
208{
209 if (reader.noMore()) {
210 reader.fail();
211 return false;
212 }
213 if (!reader.readFloat64(y)) {
214 reader.fail();
215 return false;
216 }
217 return true;
218}
219
220// write y field
221bool Map2DLocationData::write_y(const yarp::os::idl::WireWriter& writer) const
222{
223 if (!writer.writeFloat64(y)) {
224 return false;
225 }
226 return true;
227}
228
229// read (nested) y field
230bool Map2DLocationData::nested_read_y(yarp::os::idl::WireReader& reader)
231{
232 if (reader.noMore()) {
233 reader.fail();
234 return false;
235 }
236 if (!reader.readFloat64(y)) {
237 reader.fail();
238 return false;
239 }
240 return true;
241}
242
243// write (nested) y field
244bool Map2DLocationData::nested_write_y(const yarp::os::idl::WireWriter& writer) const
245{
246 if (!writer.writeFloat64(y)) {
247 return false;
248 }
249 return true;
250}
251
252// read theta field
253bool Map2DLocationData::read_theta(yarp::os::idl::WireReader& reader)
254{
255 if (reader.noMore()) {
256 reader.fail();
257 return false;
258 }
259 if (!reader.readFloat64(theta)) {
260 reader.fail();
261 return false;
262 }
263 return true;
264}
265
266// write theta field
267bool Map2DLocationData::write_theta(const yarp::os::idl::WireWriter& writer) const
268{
269 if (!writer.writeFloat64(theta)) {
270 return false;
271 }
272 return true;
273}
274
275// read (nested) theta field
276bool Map2DLocationData::nested_read_theta(yarp::os::idl::WireReader& reader)
277{
278 if (reader.noMore()) {
279 reader.fail();
280 return false;
281 }
282 if (!reader.readFloat64(theta)) {
283 reader.fail();
284 return false;
285 }
286 return true;
287}
288
289// write (nested) theta field
290bool Map2DLocationData::nested_write_theta(const yarp::os::idl::WireWriter& writer) const
291{
292 if (!writer.writeFloat64(theta)) {
293 return false;
294 }
295 return true;
296}
297
298// read description field
299bool Map2DLocationData::read_description(yarp::os::idl::WireReader& reader)
300{
301 if (reader.noMore()) {
302 reader.fail();
303 return false;
304 }
305 if (!reader.readString(description)) {
306 reader.fail();
307 return false;
308 }
309 return true;
310}
311
312// write description field
313bool Map2DLocationData::write_description(const yarp::os::idl::WireWriter& writer) const
314{
315 if (!writer.writeString(description)) {
316 return false;
317 }
318 return true;
319}
320
321// read (nested) description field
322bool Map2DLocationData::nested_read_description(yarp::os::idl::WireReader& reader)
323{
324 if (reader.noMore()) {
325 reader.fail();
326 return false;
327 }
328 if (!reader.readString(description)) {
329 reader.fail();
330 return false;
331 }
332 return true;
333}
334
335// write (nested) description field
336bool Map2DLocationData::nested_write_description(const yarp::os::idl::WireWriter& writer) const
337{
338 if (!writer.writeString(description)) {
339 return false;
340 }
341 return true;
342}
343
344} // namespace yarp::dev
std::string map_id
name of the map
bool read(yarp::os::idl::WireReader &reader) override
double theta
orientation [deg] in the map reference frame
double y
y position of the location [m], expressed in the map reference frame
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(const yarp::os::idl::WireWriter &writer) const override
std::string description
user defined string
double x
x position of the location [m], expressed in the map reference frame
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
std::string toString() const override
Gives a human-readable textual representation of the bottle.
Definition Bottle.cpp:211
An interface for reading from a network connection.
An interface for writing to a network connection.
static bool copyPortable(const PortWriter &writer, PortReader &reader)
Copy one portable to another, via writing and reading.
Definition Portable.cpp:16
IDL-friendly connection reader.
Definition WireReader.h:27
bool readString(std::string &str, bool *is_vocab=nullptr)
bool readFloat64(yarp::conf::float64_t &x)
IDL-friendly connection writer.
Definition WireWriter.h:28
bool writeListHeader(int len) const
bool writeFloat64(yarp::conf::float64_t x, bool skip_tag=false) const
bool writeString(const std::string &str, bool skip_tag=false) const
For streams capable of holding different kinds of content, check what they actually have.