YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
audioBufferSizeData.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
16audioBufferSizeData::audioBufferSizeData(const std::int32_t m_samples,
17 const std::int32_t m_channels,
18 const std::int32_t m_depth,
19 const std::int32_t size) :
20 WirePortable(),
21 m_samples(m_samples),
22 m_channels(m_channels),
23 m_depth(m_depth),
24 size(size)
25{
26}
27
28// Read structure on a Wire
30{
31 if (!read_m_samples(reader)) {
32 return false;
33 }
34 if (!read_m_channels(reader)) {
35 return false;
36 }
37 if (!read_m_depth(reader)) {
38 return false;
39 }
40 if (!read_size(reader)) {
41 return false;
42 }
43 if (reader.isError()) {
44 return false;
45 }
46 return true;
47}
48
49// Read structure on a Connection
51{
52 yarp::os::idl::WireReader reader(connection);
53 if (!reader.readListHeader(4)) {
54 return false;
55 }
56 if (!read(reader)) {
57 return false;
58 }
59 return true;
60}
61
62// Write structure on a Wire
64{
65 if (!write_m_samples(writer)) {
66 return false;
67 }
68 if (!write_m_channels(writer)) {
69 return false;
70 }
71 if (!write_m_depth(writer)) {
72 return false;
73 }
74 if (!write_size(writer)) {
75 return false;
76 }
77 if (writer.isError()) {
78 return false;
79 }
80 return true;
81}
82
83// Write structure on a Connection
85{
86 yarp::os::idl::WireWriter writer(connection);
87 if (!writer.writeListHeader(4)) {
88 return false;
89 }
90 if (!write(writer)) {
91 return false;
92 }
93 return true;
94}
95
96// Convert to a printable string
98{
100 if (!yarp::os::Portable::copyPortable(*this, b)) {
101 return {};
102 }
103 return b.toString();
104}
105
106// read m_samples field
107bool audioBufferSizeData::read_m_samples(yarp::os::idl::WireReader& reader)
108{
109 if (reader.noMore()) {
110 reader.fail();
111 return false;
112 }
113 if (!reader.readI32(m_samples)) {
114 reader.fail();
115 return false;
116 }
117 return true;
118}
119
120// write m_samples field
121bool audioBufferSizeData::write_m_samples(const yarp::os::idl::WireWriter& writer) const
122{
123 if (!writer.writeI32(m_samples)) {
124 return false;
125 }
126 return true;
127}
128
129// read (nested) m_samples field
130bool audioBufferSizeData::nested_read_m_samples(yarp::os::idl::WireReader& reader)
131{
132 if (reader.noMore()) {
133 reader.fail();
134 return false;
135 }
136 if (!reader.readI32(m_samples)) {
137 reader.fail();
138 return false;
139 }
140 return true;
141}
142
143// write (nested) m_samples field
144bool audioBufferSizeData::nested_write_m_samples(const yarp::os::idl::WireWriter& writer) const
145{
146 if (!writer.writeI32(m_samples)) {
147 return false;
148 }
149 return true;
150}
151
152// read m_channels field
153bool audioBufferSizeData::read_m_channels(yarp::os::idl::WireReader& reader)
154{
155 if (reader.noMore()) {
156 reader.fail();
157 return false;
158 }
159 if (!reader.readI32(m_channels)) {
160 reader.fail();
161 return false;
162 }
163 return true;
164}
165
166// write m_channels field
167bool audioBufferSizeData::write_m_channels(const yarp::os::idl::WireWriter& writer) const
168{
169 if (!writer.writeI32(m_channels)) {
170 return false;
171 }
172 return true;
173}
174
175// read (nested) m_channels field
176bool audioBufferSizeData::nested_read_m_channels(yarp::os::idl::WireReader& reader)
177{
178 if (reader.noMore()) {
179 reader.fail();
180 return false;
181 }
182 if (!reader.readI32(m_channels)) {
183 reader.fail();
184 return false;
185 }
186 return true;
187}
188
189// write (nested) m_channels field
190bool audioBufferSizeData::nested_write_m_channels(const yarp::os::idl::WireWriter& writer) const
191{
192 if (!writer.writeI32(m_channels)) {
193 return false;
194 }
195 return true;
196}
197
198// read m_depth field
199bool audioBufferSizeData::read_m_depth(yarp::os::idl::WireReader& reader)
200{
201 if (reader.noMore()) {
202 reader.fail();
203 return false;
204 }
205 if (!reader.readI32(m_depth)) {
206 reader.fail();
207 return false;
208 }
209 return true;
210}
211
212// write m_depth field
213bool audioBufferSizeData::write_m_depth(const yarp::os::idl::WireWriter& writer) const
214{
215 if (!writer.writeI32(m_depth)) {
216 return false;
217 }
218 return true;
219}
220
221// read (nested) m_depth field
222bool audioBufferSizeData::nested_read_m_depth(yarp::os::idl::WireReader& reader)
223{
224 if (reader.noMore()) {
225 reader.fail();
226 return false;
227 }
228 if (!reader.readI32(m_depth)) {
229 reader.fail();
230 return false;
231 }
232 return true;
233}
234
235// write (nested) m_depth field
236bool audioBufferSizeData::nested_write_m_depth(const yarp::os::idl::WireWriter& writer) const
237{
238 if (!writer.writeI32(m_depth)) {
239 return false;
240 }
241 return true;
242}
243
244// read size field
245bool audioBufferSizeData::read_size(yarp::os::idl::WireReader& reader)
246{
247 if (reader.noMore()) {
248 reader.fail();
249 return false;
250 }
251 if (!reader.readI32(size)) {
252 reader.fail();
253 return false;
254 }
255 return true;
256}
257
258// write size field
259bool audioBufferSizeData::write_size(const yarp::os::idl::WireWriter& writer) const
260{
261 if (!writer.writeI32(size)) {
262 return false;
263 }
264 return true;
265}
266
267// read (nested) size field
268bool audioBufferSizeData::nested_read_size(yarp::os::idl::WireReader& reader)
269{
270 if (reader.noMore()) {
271 reader.fail();
272 return false;
273 }
274 if (!reader.readI32(size)) {
275 reader.fail();
276 return false;
277 }
278 return true;
279}
280
281// write (nested) size field
282bool audioBufferSizeData::nested_write_size(const yarp::os::idl::WireWriter& writer) const
283{
284 if (!writer.writeI32(size)) {
285 return false;
286 }
287 return true;
288}
289
290} // namespace yarp::dev
bool write(const yarp::os::idl::WireWriter &writer) const override
bool read(yarp::os::idl::WireReader &reader) 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 readI32(std::int32_t &x)
IDL-friendly connection writer.
Definition WireWriter.h:28
bool writeI32(std::int32_t x, bool skip_tag=false) const
bool writeListHeader(int len) const
For streams capable of holding different kinds of content, check what they actually have.