YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
CameraConfigData.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::dev {
14
15// Constructor with field values
16CameraConfigData::CameraConfigData(const std::int32_t width,
17 const std::int32_t height,
18 const double framerate,
19 const YarpVocabPixelTypesEnum pixelCoding) :
20 WirePortable(),
21 width(width),
22 height(height),
24 pixelCoding(pixelCoding)
25{
26}
27
28// Read structure on a Wire
30{
31 if (!read_width(reader)) {
32 return false;
33 }
34 if (!read_height(reader)) {
35 return false;
36 }
37 if (!read_framerate(reader)) {
38 return false;
39 }
40 if (!nested_read_pixelCoding(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_width(writer)) {
66 return false;
67 }
68 if (!write_height(writer)) {
69 return false;
70 }
71 if (!write_framerate(writer)) {
72 return false;
73 }
74 if (!nested_write_pixelCoding(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
97std::string CameraConfigData::toString() const
98{
100 if (!yarp::os::Portable::copyPortable(*this, b)) {
101 return {};
102 }
103 return b.toString();
104}
105
106// read width field
107bool CameraConfigData::read_width(yarp::os::idl::WireReader& reader)
108{
109 if (!reader.readI32(width)) {
110 width = 0;
111 }
112 return true;
113}
114
115// write width field
116bool CameraConfigData::write_width(const yarp::os::idl::WireWriter& writer) const
117{
118 if (!writer.writeI32(width)) {
119 return false;
120 }
121 return true;
122}
123
124// read (nested) width field
125bool CameraConfigData::nested_read_width(yarp::os::idl::WireReader& reader)
126{
127 if (!reader.readI32(width)) {
128 width = 0;
129 }
130 return true;
131}
132
133// write (nested) width field
134bool CameraConfigData::nested_write_width(const yarp::os::idl::WireWriter& writer) const
135{
136 if (!writer.writeI32(width)) {
137 return false;
138 }
139 return true;
140}
141
142// read height field
143bool CameraConfigData::read_height(yarp::os::idl::WireReader& reader)
144{
145 if (!reader.readI32(height)) {
146 height = 0;
147 }
148 return true;
149}
150
151// write height field
152bool CameraConfigData::write_height(const yarp::os::idl::WireWriter& writer) const
153{
154 if (!writer.writeI32(height)) {
155 return false;
156 }
157 return true;
158}
159
160// read (nested) height field
161bool CameraConfigData::nested_read_height(yarp::os::idl::WireReader& reader)
162{
163 if (!reader.readI32(height)) {
164 height = 0;
165 }
166 return true;
167}
168
169// write (nested) height field
170bool CameraConfigData::nested_write_height(const yarp::os::idl::WireWriter& writer) const
171{
172 if (!writer.writeI32(height)) {
173 return false;
174 }
175 return true;
176}
177
178// read framerate field
179bool CameraConfigData::read_framerate(yarp::os::idl::WireReader& reader)
180{
181 if (!reader.readFloat64(framerate)) {
182 framerate = 0.000000;
183 }
184 return true;
185}
186
187// write framerate field
188bool CameraConfigData::write_framerate(const yarp::os::idl::WireWriter& writer) const
189{
190 if (!writer.writeFloat64(framerate)) {
191 return false;
192 }
193 return true;
194}
195
196// read (nested) framerate field
197bool CameraConfigData::nested_read_framerate(yarp::os::idl::WireReader& reader)
198{
199 if (!reader.readFloat64(framerate)) {
200 framerate = 0.000000;
201 }
202 return true;
203}
204
205// write (nested) framerate field
206bool CameraConfigData::nested_write_framerate(const yarp::os::idl::WireWriter& writer) const
207{
208 if (!writer.writeFloat64(framerate)) {
209 return false;
210 }
211 return true;
212}
213
214// read pixelCoding field
215bool CameraConfigData::read_pixelCoding(yarp::os::idl::WireReader& reader)
216{
217 if (reader.noMore()) {
218 reader.fail();
219 return false;
220 }
222 if (!reader.readVocab32(_ecast)) {
223 reader.fail();
224 return false;
225 }
226 pixelCoding = static_cast<YarpVocabPixelTypesEnum>(_ecast);
227 return true;
228}
229
230// write pixelCoding field
231bool CameraConfigData::write_pixelCoding(const yarp::os::idl::WireWriter& writer) const
232{
233 if (!writer.writeVocab32(static_cast<yarp::conf::vocab32_t>(pixelCoding))) {
234 return false;
235 }
236 return true;
237}
238
239// read (nested) pixelCoding field
240bool CameraConfigData::nested_read_pixelCoding(yarp::os::idl::WireReader& reader)
241{
242 if (reader.noMore()) {
243 reader.fail();
244 return false;
245 }
247 if (!reader.readVocab32(_ecast)) {
248 reader.fail();
249 return false;
250 }
251 pixelCoding = static_cast<YarpVocabPixelTypesEnum>(_ecast);
252 return true;
253}
254
255// write (nested) pixelCoding field
256bool CameraConfigData::nested_write_pixelCoding(const yarp::os::idl::WireWriter& writer) const
257{
258 if (!writer.writeVocab32(static_cast<yarp::conf::vocab32_t>(pixelCoding))) {
259 return false;
260 }
261 return true;
262}
263
264} // namespace yarp::dev
YarpVocabPixelTypesEnum
Definition Image.h:40
bool read(yarp::os::idl::WireReader &reader) override
bool write(const yarp::os::idl::WireWriter &writer) const override
YarpVocabPixelTypesEnum pixelCoding
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 readVocab32(yarp::conf::vocab32_t &x)
bool readI32(std::int32_t &x)
bool readFloat64(yarp::conf::float64_t &x)
IDL-friendly connection writer.
Definition WireWriter.h:28
bool writeVocab32(yarp::conf::vocab32_t x, bool skip_tag=false) const
bool writeI32(std::int32_t x, bool skip_tag=false) const
bool writeListHeader(int len) const
bool writeFloat64(yarp::conf::float64_t x, bool skip_tag=false) const
std::int32_t vocab32_t
Definition numeric.h:78
For streams capable of holding different kinds of content, check what they actually have.
constexpr char framerate[]