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