YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
return_transcribe.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
11#include <return_transcribe.h>
12
13// Constructor with field values
15 const std::string& transcription,
16 const double score) :
17 WirePortable(),
18 ret(ret),
19 transcription(transcription),
20 score(score)
21{
22}
23
24// Read structure on a Wire
26{
27 if (!nested_read_ret(reader)) {
28 return false;
29 }
30 if (!read_transcription(reader)) {
31 return false;
32 }
33 if (!read_score(reader)) {
34 return false;
35 }
36 if (reader.isError()) {
37 return false;
38 }
39 return true;
40}
41
42// Read structure on a Connection
44{
45 yarp::os::idl::WireReader reader(connection);
46 if (!reader.readListHeader(3)) {
47 return false;
48 }
49 if (!read(reader)) {
50 return false;
51 }
52 return true;
53}
54
55// Write structure on a Wire
57{
58 if (!nested_write_ret(writer)) {
59 return false;
60 }
61 if (!write_transcription(writer)) {
62 return false;
63 }
64 if (!write_score(writer)) {
65 return false;
66 }
67 if (writer.isError()) {
68 return false;
69 }
70 return true;
71}
72
73// Write structure on a Connection
75{
76 yarp::os::idl::WireWriter writer(connection);
77 if (!writer.writeListHeader(3)) {
78 return false;
79 }
80 if (!write(writer)) {
81 return false;
82 }
83 return true;
84}
85
86// Convert to a printable string
87std::string return_transcribe::toString() const
88{
90 if (!yarp::os::Portable::copyPortable(*this, b)) {
91 return {};
92 }
93 return b.toString();
94}
95
96// read ret field
97bool return_transcribe::read_ret(yarp::os::idl::WireReader& reader)
98{
99 if (reader.noMore()) {
100 reader.fail();
101 return false;
102 }
103 if (!reader.read(ret)) {
104 reader.fail();
105 return false;
106 }
107 return true;
108}
109
110// write ret field
111bool return_transcribe::write_ret(const yarp::os::idl::WireWriter& writer) const
112{
113 if (!writer.write(ret)) {
114 return false;
115 }
116 return true;
117}
118
119// read (nested) ret field
120bool return_transcribe::nested_read_ret(yarp::os::idl::WireReader& reader)
121{
122 if (reader.noMore()) {
123 reader.fail();
124 return false;
125 }
126 if (!reader.readNested(ret)) {
127 reader.fail();
128 return false;
129 }
130 return true;
131}
132
133// write (nested) ret field
134bool return_transcribe::nested_write_ret(const yarp::os::idl::WireWriter& writer) const
135{
136 if (!writer.writeNested(ret)) {
137 return false;
138 }
139 return true;
140}
141
142// read transcription field
143bool return_transcribe::read_transcription(yarp::os::idl::WireReader& reader)
144{
145 if (reader.noMore()) {
146 reader.fail();
147 return false;
148 }
149 if (!reader.readString(transcription)) {
150 reader.fail();
151 return false;
152 }
153 return true;
154}
155
156// write transcription field
157bool return_transcribe::write_transcription(const yarp::os::idl::WireWriter& writer) const
158{
159 if (!writer.writeString(transcription)) {
160 return false;
161 }
162 return true;
163}
164
165// read (nested) transcription field
166bool return_transcribe::nested_read_transcription(yarp::os::idl::WireReader& reader)
167{
168 if (reader.noMore()) {
169 reader.fail();
170 return false;
171 }
172 if (!reader.readString(transcription)) {
173 reader.fail();
174 return false;
175 }
176 return true;
177}
178
179// write (nested) transcription field
180bool return_transcribe::nested_write_transcription(const yarp::os::idl::WireWriter& writer) const
181{
182 if (!writer.writeString(transcription)) {
183 return false;
184 }
185 return true;
186}
187
188// read score field
189bool return_transcribe::read_score(yarp::os::idl::WireReader& reader)
190{
191 if (reader.noMore()) {
192 reader.fail();
193 return false;
194 }
195 if (!reader.readFloat64(score)) {
196 reader.fail();
197 return false;
198 }
199 return true;
200}
201
202// write score field
203bool return_transcribe::write_score(const yarp::os::idl::WireWriter& writer) const
204{
205 if (!writer.writeFloat64(score)) {
206 return false;
207 }
208 return true;
209}
210
211// read (nested) score field
212bool return_transcribe::nested_read_score(yarp::os::idl::WireReader& reader)
213{
214 if (reader.noMore()) {
215 reader.fail();
216 return false;
217 }
218 if (!reader.readFloat64(score)) {
219 reader.fail();
220 return false;
221 }
222 return true;
223}
224
225// write (nested) score field
226bool return_transcribe::nested_write_score(const yarp::os::idl::WireWriter& writer) const
227{
228 if (!writer.writeFloat64(score)) {
229 return false;
230 }
231 return true;
232}
bool ret
bool read(yarp::os::idl::WireReader &reader) override
std::string transcription
yarp::dev::ReturnValue ret
return_transcribe()=default
std::string toString() const
bool write(const yarp::os::idl::WireWriter &writer) const override
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 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 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