YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yCameraDescriptor.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 <yCameraDescriptor.h>
12
13// Constructor with field values
15 const std::string& deviceDescription) :
16 WirePortable(),
17 busType(busType),
18 deviceDescription(deviceDescription)
19{
20}
21
22// Read structure on a Wire
24{
25 if (!nested_read_busType(reader)) {
26 return false;
27 }
28 if (!read_deviceDescription(reader)) {
29 return false;
30 }
31 if (reader.isError()) {
32 return false;
33 }
34 return true;
35}
36
37// Read structure on a Connection
39{
40 yarp::os::idl::WireReader reader(connection);
41 if (!reader.readListHeader(2)) {
42 return false;
43 }
44 if (!read(reader)) {
45 return false;
46 }
47 return true;
48}
49
50// Write structure on a Wire
52{
53 if (!nested_write_busType(writer)) {
54 return false;
55 }
56 if (!write_deviceDescription(writer)) {
57 return false;
58 }
59 if (writer.isError()) {
60 return false;
61 }
62 return true;
63}
64
65// Write structure on a Connection
67{
68 yarp::os::idl::WireWriter writer(connection);
69 if (!writer.writeListHeader(2)) {
70 return false;
71 }
72 if (!write(writer)) {
73 return false;
74 }
75 return true;
76}
77
78// Convert to a printable string
79std::string yCameraDescriptor::toString() const
80{
82 if (!yarp::os::Portable::copyPortable(*this, b)) {
83 return {};
84 }
85 return b.toString();
86}
87
88// read busType field
89bool yCameraDescriptor::read_busType(yarp::os::idl::WireReader& reader)
90{
91 if (reader.noMore()) {
92 reader.fail();
93 return false;
94 }
95 int32_t _ecast;
96 if (!reader.readI32(_ecast)) {
97 reader.fail();
98 return false;
99 }
100 busType = static_cast<yarp::dev::BusType>(_ecast);
101 return true;
102}
103
104// write busType field
105bool yCameraDescriptor::write_busType(const yarp::os::idl::WireWriter& writer) const
106{
107 if (!writer.writeI32(static_cast<int32_t>(busType))) {
108 return false;
109 }
110 return true;
111}
112
113// read (nested) busType field
114bool yCameraDescriptor::nested_read_busType(yarp::os::idl::WireReader& reader)
115{
116 if (reader.noMore()) {
117 reader.fail();
118 return false;
119 }
120 int32_t _ecast;
121 if (!reader.readI32(_ecast)) {
122 reader.fail();
123 return false;
124 }
125 busType = static_cast<yarp::dev::BusType>(_ecast);
126 return true;
127}
128
129// write (nested) busType field
130bool yCameraDescriptor::nested_write_busType(const yarp::os::idl::WireWriter& writer) const
131{
132 if (!writer.writeI32(static_cast<int32_t>(busType))) {
133 return false;
134 }
135 return true;
136}
137
138// read deviceDescription field
139bool yCameraDescriptor::read_deviceDescription(yarp::os::idl::WireReader& reader)
140{
141 if (reader.noMore()) {
142 reader.fail();
143 return false;
144 }
145 if (!reader.readString(deviceDescription)) {
146 reader.fail();
147 return false;
148 }
149 return true;
150}
151
152// write deviceDescription field
153bool yCameraDescriptor::write_deviceDescription(const yarp::os::idl::WireWriter& writer) const
154{
155 if (!writer.writeString(deviceDescription)) {
156 return false;
157 }
158 return true;
159}
160
161// read (nested) deviceDescription field
162bool yCameraDescriptor::nested_read_deviceDescription(yarp::os::idl::WireReader& reader)
163{
164 if (reader.noMore()) {
165 reader.fail();
166 return false;
167 }
168 if (!reader.readString(deviceDescription)) {
169 reader.fail();
170 return false;
171 }
172 return true;
173}
174
175// write (nested) deviceDescription field
176bool yCameraDescriptor::nested_write_deviceDescription(const yarp::os::idl::WireWriter& writer) const
177{
178 if (!writer.writeString(deviceDescription)) {
179 return false;
180 }
181 return true;
182}
yarp::dev::BusType busType
yCameraDescriptor()=default
std::string deviceDescription
std::string toString() const
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:65
std::string toString() const override
Gives a human-readable textual representation of the bottle.
Definition Bottle.cpp:217
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 readString(std::string &str, bool *is_vocab=nullptr)
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
bool writeString(const std::string &str, bool skip_tag=false) const