YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ImageColorKeyData.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::sig {
14
15// Constructor with field values
17 const std::int32_t value) :
18 WirePortable(),
19 enable(enable),
20 value(value)
21{
22}
23
24// Read structure on a Wire
26{
27 if (!read_enable(reader)) {
28 return false;
29 }
30 if (!read_value(reader)) {
31 return false;
32 }
33 if (reader.isError()) {
34 return false;
35 }
36 return true;
37}
38
39// Read structure on a Connection
41{
42 yarp::os::idl::WireReader reader(connection);
43 if (!reader.readListHeader(2)) {
44 return false;
45 }
46 if (!read(reader)) {
47 return false;
48 }
49 return true;
50}
51
52// Write structure on a Wire
54{
55 if (!write_enable(writer)) {
56 return false;
57 }
58 if (!write_value(writer)) {
59 return false;
60 }
61 if (writer.isError()) {
62 return false;
63 }
64 return true;
65}
66
67// Write structure on a Connection
69{
70 yarp::os::idl::WireWriter writer(connection);
71 if (!writer.writeListHeader(2)) {
72 return false;
73 }
74 if (!write(writer)) {
75 return false;
76 }
77 return true;
78}
79
80// Convert to a printable string
81std::string ImageColorKeyData::toString() const
82{
84 if (!yarp::os::Portable::copyPortable(*this, b)) {
85 return {};
86 }
87 return b.toString();
88}
89
90// read enable field
91bool ImageColorKeyData::read_enable(yarp::os::idl::WireReader& reader)
92{
93 if (!reader.readBool(enable)) {
94 enable = true;
95 }
96 return true;
97}
98
99// write enable field
100bool ImageColorKeyData::write_enable(const yarp::os::idl::WireWriter& writer) const
101{
102 if (!writer.writeBool(enable)) {
103 return false;
104 }
105 return true;
106}
107
108// read (nested) enable field
109bool ImageColorKeyData::nested_read_enable(yarp::os::idl::WireReader& reader)
110{
111 if (!reader.readBool(enable)) {
112 enable = true;
113 }
114 return true;
115}
116
117// write (nested) enable field
118bool ImageColorKeyData::nested_write_enable(const yarp::os::idl::WireWriter& writer) const
119{
120 if (!writer.writeBool(enable)) {
121 return false;
122 }
123 return true;
124}
125
126// read value field
127bool ImageColorKeyData::read_value(yarp::os::idl::WireReader& reader)
128{
129 if (!reader.readI32(value)) {
130 value = 0;
131 }
132 return true;
133}
134
135// write value field
136bool ImageColorKeyData::write_value(const yarp::os::idl::WireWriter& writer) const
137{
138 if (!writer.writeI32(value)) {
139 return false;
140 }
141 return true;
142}
143
144// read (nested) value field
145bool ImageColorKeyData::nested_read_value(yarp::os::idl::WireReader& reader)
146{
147 if (!reader.readI32(value)) {
148 value = 0;
149 }
150 return true;
151}
152
153// write (nested) value field
154bool ImageColorKeyData::nested_write_value(const yarp::os::idl::WireWriter& writer) const
155{
156 if (!writer.writeI32(value)) {
157 return false;
158 }
159 return true;
160}
161
162} // namespace yarp::sig
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 readI32(std::int32_t &x)
IDL-friendly connection writer.
Definition WireWriter.h:28
bool writeBool(bool x, bool skip_tag=false) const
bool writeI32(std::int32_t x, bool skip_tag=false) const
bool writeListHeader(int len) const
bool read(yarp::os::idl::WireReader &reader) override
bool write(const yarp::os::idl::WireWriter &writer) const override