YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
LoadInfoData.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::os {
14
15// Constructor with field values
16LoadInfoData::LoadInfoData(const double cpuLoad1,
17 const double cpuLoad5,
18 const double cpuLoad15,
19 const std::int32_t cpuLoadInstant) :
20 WirePortable(),
21 cpuLoad1(cpuLoad1),
22 cpuLoad5(cpuLoad5),
23 cpuLoad15(cpuLoad15),
24 cpuLoadInstant(cpuLoadInstant)
25{
26}
27
28// Read structure on a Wire
30{
31 if (!read_cpuLoad1(reader)) {
32 return false;
33 }
34 if (!read_cpuLoad5(reader)) {
35 return false;
36 }
37 if (!read_cpuLoad15(reader)) {
38 return false;
39 }
40 if (!read_cpuLoadInstant(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_cpuLoad1(writer)) {
66 return false;
67 }
68 if (!write_cpuLoad5(writer)) {
69 return false;
70 }
71 if (!write_cpuLoad15(writer)) {
72 return false;
73 }
74 if (!write_cpuLoadInstant(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 LoadInfoData::toString() const
98{
100 if (!yarp::os::Portable::copyPortable(*this, b)) {
101 return {};
102 }
103 return b.toString();
104}
105
106// read cpuLoad1 field
107bool LoadInfoData::read_cpuLoad1(yarp::os::idl::WireReader& reader)
108{
109 if (reader.noMore()) {
110 reader.fail();
111 return false;
112 }
113 if (!reader.readFloat64(cpuLoad1)) {
114 reader.fail();
115 return false;
116 }
117 return true;
118}
119
120// write cpuLoad1 field
121bool LoadInfoData::write_cpuLoad1(const yarp::os::idl::WireWriter& writer) const
122{
123 if (!writer.writeFloat64(cpuLoad1)) {
124 return false;
125 }
126 return true;
127}
128
129// read (nested) cpuLoad1 field
130bool LoadInfoData::nested_read_cpuLoad1(yarp::os::idl::WireReader& reader)
131{
132 if (reader.noMore()) {
133 reader.fail();
134 return false;
135 }
136 if (!reader.readFloat64(cpuLoad1)) {
137 reader.fail();
138 return false;
139 }
140 return true;
141}
142
143// write (nested) cpuLoad1 field
144bool LoadInfoData::nested_write_cpuLoad1(const yarp::os::idl::WireWriter& writer) const
145{
146 if (!writer.writeFloat64(cpuLoad1)) {
147 return false;
148 }
149 return true;
150}
151
152// read cpuLoad5 field
153bool LoadInfoData::read_cpuLoad5(yarp::os::idl::WireReader& reader)
154{
155 if (reader.noMore()) {
156 reader.fail();
157 return false;
158 }
159 if (!reader.readFloat64(cpuLoad5)) {
160 reader.fail();
161 return false;
162 }
163 return true;
164}
165
166// write cpuLoad5 field
167bool LoadInfoData::write_cpuLoad5(const yarp::os::idl::WireWriter& writer) const
168{
169 if (!writer.writeFloat64(cpuLoad5)) {
170 return false;
171 }
172 return true;
173}
174
175// read (nested) cpuLoad5 field
176bool LoadInfoData::nested_read_cpuLoad5(yarp::os::idl::WireReader& reader)
177{
178 if (reader.noMore()) {
179 reader.fail();
180 return false;
181 }
182 if (!reader.readFloat64(cpuLoad5)) {
183 reader.fail();
184 return false;
185 }
186 return true;
187}
188
189// write (nested) cpuLoad5 field
190bool LoadInfoData::nested_write_cpuLoad5(const yarp::os::idl::WireWriter& writer) const
191{
192 if (!writer.writeFloat64(cpuLoad5)) {
193 return false;
194 }
195 return true;
196}
197
198// read cpuLoad15 field
199bool LoadInfoData::read_cpuLoad15(yarp::os::idl::WireReader& reader)
200{
201 if (reader.noMore()) {
202 reader.fail();
203 return false;
204 }
205 if (!reader.readFloat64(cpuLoad15)) {
206 reader.fail();
207 return false;
208 }
209 return true;
210}
211
212// write cpuLoad15 field
213bool LoadInfoData::write_cpuLoad15(const yarp::os::idl::WireWriter& writer) const
214{
215 if (!writer.writeFloat64(cpuLoad15)) {
216 return false;
217 }
218 return true;
219}
220
221// read (nested) cpuLoad15 field
222bool LoadInfoData::nested_read_cpuLoad15(yarp::os::idl::WireReader& reader)
223{
224 if (reader.noMore()) {
225 reader.fail();
226 return false;
227 }
228 if (!reader.readFloat64(cpuLoad15)) {
229 reader.fail();
230 return false;
231 }
232 return true;
233}
234
235// write (nested) cpuLoad15 field
236bool LoadInfoData::nested_write_cpuLoad15(const yarp::os::idl::WireWriter& writer) const
237{
238 if (!writer.writeFloat64(cpuLoad15)) {
239 return false;
240 }
241 return true;
242}
243
244// read cpuLoadInstant field
245bool LoadInfoData::read_cpuLoadInstant(yarp::os::idl::WireReader& reader)
246{
247 if (reader.noMore()) {
248 reader.fail();
249 return false;
250 }
251 if (!reader.readI32(cpuLoadInstant)) {
252 reader.fail();
253 return false;
254 }
255 return true;
256}
257
258// write cpuLoadInstant field
259bool LoadInfoData::write_cpuLoadInstant(const yarp::os::idl::WireWriter& writer) const
260{
261 if (!writer.writeI32(cpuLoadInstant)) {
262 return false;
263 }
264 return true;
265}
266
267// read (nested) cpuLoadInstant field
268bool LoadInfoData::nested_read_cpuLoadInstant(yarp::os::idl::WireReader& reader)
269{
270 if (reader.noMore()) {
271 reader.fail();
272 return false;
273 }
274 if (!reader.readI32(cpuLoadInstant)) {
275 reader.fail();
276 return false;
277 }
278 return true;
279}
280
281// write (nested) cpuLoadInstant field
282bool LoadInfoData::nested_write_cpuLoadInstant(const yarp::os::idl::WireWriter& writer) const
283{
284 if (!writer.writeI32(cpuLoadInstant)) {
285 return false;
286 }
287 return true;
288}
289
290} // namespace yarp::os
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.
bool write(const yarp::os::idl::WireWriter &writer) const override
bool read(yarp::os::idl::WireReader &reader) override
std::string toString() const
std::int32_t cpuLoadInstant
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)
bool readFloat64(yarp::conf::float64_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 writeFloat64(yarp::conf::float64_t x, bool skip_tag=false) const
An interface to the operating system, including Port based communication.