YARP
Yet Another Robot Platform
SetCameraInfoReply.h
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// This is an automatically generated file.
7
8// Generated from the following "sensor_msgs/SetCameraInfoReply" msg definition:
9// Instances of this class can be read and written with YARP ports,
10// using a ROS-compatible format.
11
12#ifndef YARP_ROSMSG_sensor_msgs_SetCameraInfoReply_h
13#define YARP_ROSMSG_sensor_msgs_SetCameraInfoReply_h
14
15#include <yarp/os/Wire.h>
16#include <yarp/os/Type.h>
18#include <string>
19#include <vector>
20
21namespace yarp {
22namespace rosmsg {
23namespace sensor_msgs {
24
26{
27public:
28 bool success;
29 std::string status_message;
30
32 success(false),
34 {
35 }
36
37 void clear()
38 {
39 // *** success ***
40 success = false;
41
42 // *** status_message ***
43 status_message = "";
44 }
45
46 bool readBare(yarp::os::ConnectionReader& connection) override
47 {
48 // *** success ***
49 if (!connection.expectBlock((char*)&success, 1)) {
50 return false;
51 }
52
53 // *** status_message ***
54 int len = connection.expectInt32();
55 status_message.resize(len);
56 if (!connection.expectBlock((char*)status_message.c_str(), len)) {
57 return false;
58 }
59
60 return !connection.isError();
61 }
62
63 bool readBottle(yarp::os::ConnectionReader& connection) override
64 {
65 connection.convertTextMode();
66 yarp::os::idl::WireReader reader(connection);
67 if (!reader.readListHeader(2)) {
68 return false;
69 }
70
71 // *** success ***
72 success = reader.expectInt8();
73
74 // *** status_message ***
75 if (!reader.readString(status_message)) {
76 return false;
77 }
78
79 return !connection.isError();
80 }
81
83 bool read(yarp::os::ConnectionReader& connection) override
84 {
85 return (connection.isBareMode() ? readBare(connection)
86 : readBottle(connection));
87 }
88
89 bool writeBare(yarp::os::ConnectionWriter& connection) const override
90 {
91 // *** success ***
92 connection.appendBlock((char*)&success, 1);
93
94 // *** status_message ***
95 connection.appendInt32(status_message.length());
96 connection.appendExternalBlock((char*)status_message.c_str(), status_message.length());
97
98 return !connection.isError();
99 }
100
101 bool writeBottle(yarp::os::ConnectionWriter& connection) const override
102 {
103 connection.appendInt32(BOTTLE_TAG_LIST);
104 connection.appendInt32(2);
105
106 // *** success ***
107 connection.appendInt32(BOTTLE_TAG_INT8);
108 connection.appendInt8(success);
109
110 // *** status_message ***
111 connection.appendInt32(BOTTLE_TAG_STRING);
112 connection.appendInt32(status_message.length());
113 connection.appendExternalBlock((char*)status_message.c_str(), status_message.length());
114
115 connection.convertTextMode();
116 return !connection.isError();
117 }
118
120 bool write(yarp::os::ConnectionWriter& connection) const override
121 {
122 return (connection.isBareMode() ? writeBare(connection)
123 : writeBottle(connection));
124 }
125
126 // This class will serialize ROS style or YARP style depending on protocol.
127 // If you need to force a serialization style, use one of these classes:
130
131 // The name for this message, ROS will need this
132 static constexpr const char* typeName = "sensor_msgs/SetCameraInfoReply";
133
134 // The checksum for this message, ROS will need this
135 static constexpr const char* typeChecksum = "2ec6f3eff0161f4257b808b12bc830c2";
136
137 // The source text for this message, ROS will need this
138 static constexpr const char* typeText = "\
139\n\
140";
141
142 yarp::os::Type getType() const override
143 {
146 typ.addProperty("message_definition", yarp::os::Value(typeText));
147 return typ;
148 }
149};
150
151} // namespace sensor_msgs
152} // namespace rosmsg
153} // namespace yarp
154
155#endif // YARP_ROSMSG_sensor_msgs_SetCameraInfoReply_h
#define BOTTLE_TAG_INT8
Definition: Bottle.h:19
#define BOTTLE_TAG_STRING
Definition: Bottle.h:26
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a network connection.
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
virtual bool isError() const =0
An interface for writing to a network connection.
virtual bool isError() const =0
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual void appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.
virtual void appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
virtual void appendBlock(const char *data, size_t len)=0
Send a block of data to the network connection.
static Type byName(const char *name)
Definition: Type.cpp:171
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:134
A single value (typically within a Bottle).
Definition: Value.h:43
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:21
virtual bool read(yarp::os::idl::WireReader &reader)
virtual bool write(const yarp::os::idl::WireWriter &writer) const
IDL-friendly connection reader.
Definition: WireReader.h:27
bool readString(std::string &str, bool *is_vocab=nullptr)
Definition: WireReader.cpp:376
std::int8_t expectInt8()
Definition: WireReader.h:77
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readBottle(yarp::os::ConnectionReader &connection) override
bool writeBare(yarp::os::ConnectionWriter &connection) const override
yarp::os::idl::BottleStyle< yarp::rosmsg::sensor_msgs::SetCameraInfoReply > bottleStyle
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
bool readBare(yarp::os::ConnectionReader &connection) override
yarp::os::idl::BareStyle< yarp::rosmsg::sensor_msgs::SetCameraInfoReply > rosStyle
The main, catch-all namespace for YARP.
Definition: dirs.h:16