YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ThreadInfoData.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
16ThreadInfoData::ThreadInfoData(const std::int32_t tid,
17 const std::int32_t priority,
18 const std::int32_t policy) :
19 WirePortable(),
20 tid(tid),
21 priority(priority),
22 policy(policy)
23{
24}
25
26// Read structure on a Wire
28{
29 if (!read_tid(reader)) {
30 return false;
31 }
32 if (!read_priority(reader)) {
33 return false;
34 }
35 if (!read_policy(reader)) {
36 return false;
37 }
38 if (reader.isError()) {
39 return false;
40 }
41 return true;
42}
43
44// Read structure on a Connection
46{
47 yarp::os::idl::WireReader reader(connection);
48 if (!reader.readListHeader(3)) {
49 return false;
50 }
51 if (!read(reader)) {
52 return false;
53 }
54 return true;
55}
56
57// Write structure on a Wire
59{
60 if (!write_tid(writer)) {
61 return false;
62 }
63 if (!write_priority(writer)) {
64 return false;
65 }
66 if (!write_policy(writer)) {
67 return false;
68 }
69 if (writer.isError()) {
70 return false;
71 }
72 return true;
73}
74
75// Write structure on a Connection
77{
78 yarp::os::idl::WireWriter writer(connection);
79 if (!writer.writeListHeader(3)) {
80 return false;
81 }
82 if (!write(writer)) {
83 return false;
84 }
85 return true;
86}
87
88// Convert to a printable string
89std::string ThreadInfoData::toString() const
90{
92 if (!yarp::os::Portable::copyPortable(*this, b)) {
93 return {};
94 }
95 return b.toString();
96}
97
98// read tid field
99bool ThreadInfoData::read_tid(yarp::os::idl::WireReader& reader)
100{
101 if (reader.noMore()) {
102 reader.fail();
103 return false;
104 }
105 if (!reader.readI32(tid)) {
106 reader.fail();
107 return false;
108 }
109 return true;
110}
111
112// write tid field
113bool ThreadInfoData::write_tid(const yarp::os::idl::WireWriter& writer) const
114{
115 if (!writer.writeI32(tid)) {
116 return false;
117 }
118 return true;
119}
120
121// read (nested) tid field
122bool ThreadInfoData::nested_read_tid(yarp::os::idl::WireReader& reader)
123{
124 if (reader.noMore()) {
125 reader.fail();
126 return false;
127 }
128 if (!reader.readI32(tid)) {
129 reader.fail();
130 return false;
131 }
132 return true;
133}
134
135// write (nested) tid field
136bool ThreadInfoData::nested_write_tid(const yarp::os::idl::WireWriter& writer) const
137{
138 if (!writer.writeI32(tid)) {
139 return false;
140 }
141 return true;
142}
143
144// read priority field
145bool ThreadInfoData::read_priority(yarp::os::idl::WireReader& reader)
146{
147 if (reader.noMore()) {
148 reader.fail();
149 return false;
150 }
151 if (!reader.readI32(priority)) {
152 reader.fail();
153 return false;
154 }
155 return true;
156}
157
158// write priority field
159bool ThreadInfoData::write_priority(const yarp::os::idl::WireWriter& writer) const
160{
161 if (!writer.writeI32(priority)) {
162 return false;
163 }
164 return true;
165}
166
167// read (nested) priority field
168bool ThreadInfoData::nested_read_priority(yarp::os::idl::WireReader& reader)
169{
170 if (reader.noMore()) {
171 reader.fail();
172 return false;
173 }
174 if (!reader.readI32(priority)) {
175 reader.fail();
176 return false;
177 }
178 return true;
179}
180
181// write (nested) priority field
182bool ThreadInfoData::nested_write_priority(const yarp::os::idl::WireWriter& writer) const
183{
184 if (!writer.writeI32(priority)) {
185 return false;
186 }
187 return true;
188}
189
190// read policy field
191bool ThreadInfoData::read_policy(yarp::os::idl::WireReader& reader)
192{
193 if (reader.noMore()) {
194 reader.fail();
195 return false;
196 }
197 if (!reader.readI32(policy)) {
198 reader.fail();
199 return false;
200 }
201 return true;
202}
203
204// write policy field
205bool ThreadInfoData::write_policy(const yarp::os::idl::WireWriter& writer) const
206{
207 if (!writer.writeI32(policy)) {
208 return false;
209 }
210 return true;
211}
212
213// read (nested) policy field
214bool ThreadInfoData::nested_read_policy(yarp::os::idl::WireReader& reader)
215{
216 if (reader.noMore()) {
217 reader.fail();
218 return false;
219 }
220 if (!reader.readI32(policy)) {
221 reader.fail();
222 return false;
223 }
224 return true;
225}
226
227// write (nested) policy field
228bool ThreadInfoData::nested_write_policy(const yarp::os::idl::WireWriter& writer) const
229{
230 if (!writer.writeI32(policy)) {
231 return false;
232 }
233 return true;
234}
235
236} // 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.
static bool copyPortable(const PortWriter &writer, PortReader &reader)
Copy one portable to another, via writing and reading.
Definition Portable.cpp:16
bool read(yarp::os::idl::WireReader &reader) override
std::string toString() const
bool write(const yarp::os::idl::WireWriter &writer) const override
IDL-friendly connection reader.
Definition WireReader.h:27
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
An interface to the operating system, including Port based communication.