YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
StorageInfoData.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
16StorageInfoData::StorageInfoData(const std::int32_t totalSpace,
17 const std::int32_t freeSpace) :
18 WirePortable(),
19 totalSpace(totalSpace),
20 freeSpace(freeSpace)
21{
22}
23
24// Read structure on a Wire
26{
27 if (!read_totalSpace(reader)) {
28 return false;
29 }
30 if (!read_freeSpace(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_totalSpace(writer)) {
56 return false;
57 }
58 if (!write_freeSpace(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 StorageInfoData::toString() const
82{
84 if (!yarp::os::Portable::copyPortable(*this, b)) {
85 return {};
86 }
87 return b.toString();
88}
89
90// read totalSpace field
91bool StorageInfoData::read_totalSpace(yarp::os::idl::WireReader& reader)
92{
93 if (reader.noMore()) {
94 reader.fail();
95 return false;
96 }
97 if (!reader.readI32(totalSpace)) {
98 reader.fail();
99 return false;
100 }
101 return true;
102}
103
104// write totalSpace field
105bool StorageInfoData::write_totalSpace(const yarp::os::idl::WireWriter& writer) const
106{
107 if (!writer.writeI32(totalSpace)) {
108 return false;
109 }
110 return true;
111}
112
113// read (nested) totalSpace field
114bool StorageInfoData::nested_read_totalSpace(yarp::os::idl::WireReader& reader)
115{
116 if (reader.noMore()) {
117 reader.fail();
118 return false;
119 }
120 if (!reader.readI32(totalSpace)) {
121 reader.fail();
122 return false;
123 }
124 return true;
125}
126
127// write (nested) totalSpace field
128bool StorageInfoData::nested_write_totalSpace(const yarp::os::idl::WireWriter& writer) const
129{
130 if (!writer.writeI32(totalSpace)) {
131 return false;
132 }
133 return true;
134}
135
136// read freeSpace field
137bool StorageInfoData::read_freeSpace(yarp::os::idl::WireReader& reader)
138{
139 if (reader.noMore()) {
140 reader.fail();
141 return false;
142 }
143 if (!reader.readI32(freeSpace)) {
144 reader.fail();
145 return false;
146 }
147 return true;
148}
149
150// write freeSpace field
151bool StorageInfoData::write_freeSpace(const yarp::os::idl::WireWriter& writer) const
152{
153 if (!writer.writeI32(freeSpace)) {
154 return false;
155 }
156 return true;
157}
158
159// read (nested) freeSpace field
160bool StorageInfoData::nested_read_freeSpace(yarp::os::idl::WireReader& reader)
161{
162 if (reader.noMore()) {
163 reader.fail();
164 return false;
165 }
166 if (!reader.readI32(freeSpace)) {
167 reader.fail();
168 return false;
169 }
170 return true;
171}
172
173// write (nested) freeSpace field
174bool StorageInfoData::nested_write_freeSpace(const yarp::os::idl::WireWriter& writer) const
175{
176 if (!writer.writeI32(freeSpace)) {
177 return false;
178 }
179 return true;
180}
181
182} // 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 write(const yarp::os::idl::WireWriter &writer) const override
bool read(yarp::os::idl::WireReader &reader) override
std::string toString() const
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.