YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
OSTestMsg.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 <yarp/os/OSTestMsg.h>
12
13namespace yarp::os {
14
15// Constructor with field values
16OSTestMsg::OSTestMsg(const std::string& test) :
17 WirePortable(),
18 test(test)
19{
20}
21
22// Read structure on a Wire
24{
25 if (!read_test(reader)) {
26 return false;
27 }
28 if (reader.isError()) {
29 return false;
30 }
31 return true;
32}
33
34// Read structure on a Connection
36{
37 yarp::os::idl::WireReader reader(connection);
38 if (!reader.readListHeader(1)) {
39 return false;
40 }
41 if (!read(reader)) {
42 return false;
43 }
44 return true;
45}
46
47// Write structure on a Wire
49{
50 if (!write_test(writer)) {
51 return false;
52 }
53 if (writer.isError()) {
54 return false;
55 }
56 return true;
57}
58
59// Write structure on a Connection
61{
62 yarp::os::idl::WireWriter writer(connection);
63 if (!writer.writeListHeader(1)) {
64 return false;
65 }
66 if (!write(writer)) {
67 return false;
68 }
69 return true;
70}
71
72// Convert to a printable string
73std::string OSTestMsg::toString() const
74{
76 if (!yarp::os::Portable::copyPortable(*this, b)) {
77 return {};
78 }
79 return b.toString();
80}
81
82// read test field
83bool OSTestMsg::read_test(yarp::os::idl::WireReader& reader)
84{
85 if (reader.noMore()) {
86 reader.fail();
87 return false;
88 }
89 if (!reader.readString(test)) {
90 reader.fail();
91 return false;
92 }
93 return true;
94}
95
96// write test field
97bool OSTestMsg::write_test(const yarp::os::idl::WireWriter& writer) const
98{
99 if (!writer.writeString(test)) {
100 return false;
101 }
102 return true;
103}
104
105// read (nested) test field
106bool OSTestMsg::nested_read_test(yarp::os::idl::WireReader& reader)
107{
108 if (reader.noMore()) {
109 reader.fail();
110 return false;
111 }
112 if (!reader.readString(test)) {
113 reader.fail();
114 return false;
115 }
116 return true;
117}
118
119// write (nested) test field
120bool OSTestMsg::nested_write_test(const yarp::os::idl::WireWriter& writer) const
121{
122 if (!writer.writeString(test)) {
123 return false;
124 }
125 return true;
126}
127
128} // namespace yarp::os
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.
std::string test
Test message.
Definition OSTestMsg.h:29
std::string toString() const
Definition OSTestMsg.cpp:73
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition OSTestMsg.cpp:35
bool write(const yarp::os::idl::WireWriter &writer) const override
Definition OSTestMsg.cpp:48
bool read(yarp::os::idl::WireReader &reader) override
Definition OSTestMsg.cpp:23
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)
IDL-friendly connection writer.
Definition WireWriter.h:28
bool writeListHeader(int len) const
bool writeString(const std::string &str, bool skip_tag=false) const
An interface to the operating system, including Port based communication.
Definition OSTestMsg.cpp:13