YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FrameTransformData.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 (based on compiler 0.14.1-yarped)
7// yarpidl_thrift version 2.0 - 11/11/2026
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::math {
14
15// Constructor with field values
16FrameTransformData::FrameTransformData(const std::string& src_frame_id,
17 const std::string& dst_frame_id,
18 const double timestamp,
19 const bool isStatic,
20 const yarp::math::Translation& translation,
21 const yarp::math::Quaternion& rotation) :
22 WirePortable(),
23 src_frame_id(src_frame_id),
24 dst_frame_id(dst_frame_id),
25 timestamp(timestamp),
26 isStatic(isStatic),
27 translation(translation),
28 rotation(rotation)
29{
30}
31
32// Read structure on a Wire
34{
35 if (!read_src_frame_id(reader)) {
36 return false;
37 }
38 if (!read_dst_frame_id(reader)) {
39 return false;
40 }
41 if (!read_timestamp(reader)) {
42 return false;
43 }
44 if (!read_isStatic(reader)) {
45 return false;
46 }
47 if (!nested_read_translation(reader)) {
48 return false;
49 }
50 if (!nested_read_rotation(reader)) {
51 return false;
52 }
53 if (reader.isError()) {
54 return false;
55 }
56 return true;
57}
58
59// Read structure on a Connection
61{
62 yarp::os::idl::WireReader reader(connection);
63 if (!reader.readListHeader(6)) {
64 return false;
65 }
66 if (!read(reader)) {
67 return false;
68 }
69 return true;
70}
71
72// Write structure on a Wire
74{
75 if (!write_src_frame_id(writer)) {
76 return false;
77 }
78 if (!write_dst_frame_id(writer)) {
79 return false;
80 }
81 if (!write_timestamp(writer)) {
82 return false;
83 }
84 if (!write_isStatic(writer)) {
85 return false;
86 }
87 if (!nested_write_translation(writer)) {
88 return false;
89 }
90 if (!nested_write_rotation(writer)) {
91 return false;
92 }
93 if (writer.isError()) {
94 return false;
95 }
96 return true;
97}
98
99// Write structure on a Connection
101{
102 yarp::os::idl::WireWriter writer(connection);
103 if (!writer.writeListHeader(6)) {
104 return false;
105 }
106 if (!write(writer)) {
107 return false;
108 }
109 return true;
110}
111
112// Convert to a printable string
114{
116 if (!yarp::os::Portable::copyPortable(*this, b)) {
117 return {};
118 }
119 return b.toString();
120}
121
122// read src_frame_id field
123bool FrameTransformData::read_src_frame_id(yarp::os::idl::WireReader& reader)
124{
125 if (reader.noMore()) {
126 reader.fail();
127 return false;
128 }
129 if (!reader.readString(src_frame_id)) {
130 reader.fail();
131 return false;
132 }
133 return true;
134}
135
136// write src_frame_id field
137bool FrameTransformData::write_src_frame_id(const yarp::os::idl::WireWriter& writer) const
138{
139 if (!writer.writeString(src_frame_id)) {
140 return false;
141 }
142 return true;
143}
144
145// read (nested) src_frame_id field
146bool FrameTransformData::nested_read_src_frame_id(yarp::os::idl::WireReader& reader)
147{
148 if (reader.noMore()) {
149 reader.fail();
150 return false;
151 }
152 if (!reader.readString(src_frame_id)) {
153 reader.fail();
154 return false;
155 }
156 return true;
157}
158
159// write (nested) src_frame_id field
160bool FrameTransformData::nested_write_src_frame_id(const yarp::os::idl::WireWriter& writer) const
161{
162 if (!writer.writeString(src_frame_id)) {
163 return false;
164 }
165 return true;
166}
167
168// read dst_frame_id field
169bool FrameTransformData::read_dst_frame_id(yarp::os::idl::WireReader& reader)
170{
171 if (reader.noMore()) {
172 reader.fail();
173 return false;
174 }
175 if (!reader.readString(dst_frame_id)) {
176 reader.fail();
177 return false;
178 }
179 return true;
180}
181
182// write dst_frame_id field
183bool FrameTransformData::write_dst_frame_id(const yarp::os::idl::WireWriter& writer) const
184{
185 if (!writer.writeString(dst_frame_id)) {
186 return false;
187 }
188 return true;
189}
190
191// read (nested) dst_frame_id field
192bool FrameTransformData::nested_read_dst_frame_id(yarp::os::idl::WireReader& reader)
193{
194 if (reader.noMore()) {
195 reader.fail();
196 return false;
197 }
198 if (!reader.readString(dst_frame_id)) {
199 reader.fail();
200 return false;
201 }
202 return true;
203}
204
205// write (nested) dst_frame_id field
206bool FrameTransformData::nested_write_dst_frame_id(const yarp::os::idl::WireWriter& writer) const
207{
208 if (!writer.writeString(dst_frame_id)) {
209 return false;
210 }
211 return true;
212}
213
214// read timestamp field
215bool FrameTransformData::read_timestamp(yarp::os::idl::WireReader& reader)
216{
217 if (!reader.readFloat64(timestamp)) {
218 timestamp = 0;
219 }
220 return true;
221}
222
223// write timestamp field
224bool FrameTransformData::write_timestamp(const yarp::os::idl::WireWriter& writer) const
225{
226 if (!writer.writeFloat64(timestamp)) {
227 return false;
228 }
229 return true;
230}
231
232// read (nested) timestamp field
233bool FrameTransformData::nested_read_timestamp(yarp::os::idl::WireReader& reader)
234{
235 if (!reader.readFloat64(timestamp)) {
236 timestamp = 0;
237 }
238 return true;
239}
240
241// write (nested) timestamp field
242bool FrameTransformData::nested_write_timestamp(const yarp::os::idl::WireWriter& writer) const
243{
244 if (!writer.writeFloat64(timestamp)) {
245 return false;
246 }
247 return true;
248}
249
250// read isStatic field
251bool FrameTransformData::read_isStatic(yarp::os::idl::WireReader& reader)
252{
253 if (!reader.readBool(isStatic)) {
254 isStatic = false;
255 }
256 return true;
257}
258
259// write isStatic field
260bool FrameTransformData::write_isStatic(const yarp::os::idl::WireWriter& writer) const
261{
262 if (!writer.writeBool(isStatic)) {
263 return false;
264 }
265 return true;
266}
267
268// read (nested) isStatic field
269bool FrameTransformData::nested_read_isStatic(yarp::os::idl::WireReader& reader)
270{
271 if (!reader.readBool(isStatic)) {
272 isStatic = false;
273 }
274 return true;
275}
276
277// write (nested) isStatic field
278bool FrameTransformData::nested_write_isStatic(const yarp::os::idl::WireWriter& writer) const
279{
280 if (!writer.writeBool(isStatic)) {
281 return false;
282 }
283 return true;
284}
285
286// read translation field
287bool FrameTransformData::read_translation(yarp::os::idl::WireReader& reader)
288{
289 if (reader.noMore()) {
290 reader.fail();
291 return false;
292 }
293 if (!reader.read(translation)) {
294 reader.fail();
295 return false;
296 }
297 return true;
298}
299
300// write translation field
301bool FrameTransformData::write_translation(const yarp::os::idl::WireWriter& writer) const
302{
303 if (!writer.write(translation)) {
304 return false;
305 }
306 return true;
307}
308
309// read (nested) translation field
310bool FrameTransformData::nested_read_translation(yarp::os::idl::WireReader& reader)
311{
312 if (reader.noMore()) {
313 reader.fail();
314 return false;
315 }
316 if (!reader.readNested(translation)) {
317 reader.fail();
318 return false;
319 }
320 return true;
321}
322
323// write (nested) translation field
324bool FrameTransformData::nested_write_translation(const yarp::os::idl::WireWriter& writer) const
325{
326 if (!writer.writeNested(translation)) {
327 return false;
328 }
329 return true;
330}
331
332// read rotation field
333bool FrameTransformData::read_rotation(yarp::os::idl::WireReader& reader)
334{
335 if (reader.noMore()) {
336 reader.fail();
337 return false;
338 }
339 if (!reader.read(rotation)) {
340 reader.fail();
341 return false;
342 }
343 return true;
344}
345
346// write rotation field
347bool FrameTransformData::write_rotation(const yarp::os::idl::WireWriter& writer) const
348{
349 if (!writer.write(rotation)) {
350 return false;
351 }
352 return true;
353}
354
355// read (nested) rotation field
356bool FrameTransformData::nested_read_rotation(yarp::os::idl::WireReader& reader)
357{
358 if (reader.noMore()) {
359 reader.fail();
360 return false;
361 }
362 if (!reader.readNested(rotation)) {
363 reader.fail();
364 return false;
365 }
366 return true;
367}
368
369// write (nested) rotation field
370bool FrameTransformData::nested_write_rotation(const yarp::os::idl::WireWriter& writer) const
371{
372 if (!writer.writeNested(rotation)) {
373 return false;
374 }
375 return true;
376}
377
378} // namespace yarp::math
bool read(yarp::os::idl::WireReader &reader) override
yarp::math::Quaternion rotation
bool write(const yarp::os::idl::WireWriter &writer) const override
yarp::math::Translation translation
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:212
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 readNested(WirePortable &obj)
bool readString(std::string &str, bool *is_vocab=nullptr)
bool read(WirePortable &obj)
bool readFloat64(yarp::conf::float64_t &x)
IDL-friendly connection writer.
Definition WireWriter.h:28
bool writeBool(bool x, bool skip_tag=false) const
bool write(const WirePortable &obj) const
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
bool writeNested(const WirePortable &obj) const