YARP
Yet Another Robot Platform
SetCameraInfoReply.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 // This is an automatically generated file.
10 
11 // Generated from the following "sensor_msgs/SetCameraInfoReply" msg definition:
12 // Instances of this class can be read and written with YARP ports,
13 // using a ROS-compatible format.
14 
15 #ifndef YARP_ROSMSG_sensor_msgs_SetCameraInfoReply_h
16 #define YARP_ROSMSG_sensor_msgs_SetCameraInfoReply_h
17 
18 #include <yarp/os/Wire.h>
19 #include <yarp/os/Type.h>
20 #include <yarp/os/idl/WireTypes.h>
21 #include <string>
22 #include <vector>
23 
24 namespace yarp {
25 namespace rosmsg {
26 namespace sensor_msgs {
27 
29 {
30 public:
31  bool success;
32  std::string status_message;
33 
35  success(false),
36  status_message("")
37  {
38  }
39 
40  void clear()
41  {
42  // *** success ***
43  success = false;
44 
45  // *** status_message ***
46  status_message = "";
47  }
48 
49  bool readBare(yarp::os::ConnectionReader& connection) override
50  {
51  // *** success ***
52  if (!connection.expectBlock((char*)&success, 1)) {
53  return false;
54  }
55 
56  // *** status_message ***
57  int len = connection.expectInt32();
58  status_message.resize(len);
59  if (!connection.expectBlock((char*)status_message.c_str(), len)) {
60  return false;
61  }
62 
63  return !connection.isError();
64  }
65 
66  bool readBottle(yarp::os::ConnectionReader& connection) override
67  {
68  connection.convertTextMode();
69  yarp::os::idl::WireReader reader(connection);
70  if (!reader.readListHeader(2)) {
71  return false;
72  }
73 
74  // *** success ***
75  success = reader.expectInt8();
76 
77  // *** status_message ***
78  if (!reader.readString(status_message)) {
79  return false;
80  }
81 
82  return !connection.isError();
83  }
84 
86  bool read(yarp::os::ConnectionReader& connection) override
87  {
88  return (connection.isBareMode() ? readBare(connection)
89  : readBottle(connection));
90  }
91 
92  bool writeBare(yarp::os::ConnectionWriter& connection) const override
93  {
94  // *** success ***
95  connection.appendBlock((char*)&success, 1);
96 
97  // *** status_message ***
98  connection.appendInt32(status_message.length());
99  connection.appendExternalBlock((char*)status_message.c_str(), status_message.length());
100 
101  return !connection.isError();
102  }
103 
104  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
105  {
106  connection.appendInt32(BOTTLE_TAG_LIST);
107  connection.appendInt32(2);
108 
109  // *** success ***
110  connection.appendInt32(BOTTLE_TAG_INT8);
111  connection.appendInt8(success);
112 
113  // *** status_message ***
114  connection.appendInt32(BOTTLE_TAG_STRING);
115  connection.appendInt32(status_message.length());
116  connection.appendExternalBlock((char*)status_message.c_str(), status_message.length());
117 
118  connection.convertTextMode();
119  return !connection.isError();
120  }
121 
123  bool write(yarp::os::ConnectionWriter& connection) const override
124  {
125  return (connection.isBareMode() ? writeBare(connection)
126  : writeBottle(connection));
127  }
128 
129  // This class will serialize ROS style or YARP style depending on protocol.
130  // If you need to force a serialization style, use one of these classes:
133 
134  // The name for this message, ROS will need this
135  static constexpr const char* typeName = "sensor_msgs/SetCameraInfoReply";
136 
137  // The checksum for this message, ROS will need this
138  static constexpr const char* typeChecksum = "2ec6f3eff0161f4257b808b12bc830c2";
139 
140  // The source text for this message, ROS will need this
141  static constexpr const char* typeText = "\
142 \n\
143 ";
144 
145  yarp::os::Type getType() const override
146  {
148  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
149  typ.addProperty("message_definition", yarp::os::Value(typeText));
150  return typ;
151  }
152 };
153 
154 } // namespace sensor_msgs
155 } // namespace rosmsg
156 } // namespace yarp
157 
158 #endif // YARP_ROSMSG_sensor_msgs_SetCameraInfoReply_h
#define BOTTLE_TAG_INT8
Definition: Bottle.h:21
#define BOTTLE_TAG_STRING
Definition: Bottle.h:28
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
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:174
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:137
A single value (typically within a Bottle).
Definition: Value.h:47
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:26
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:33
bool readString(std::string &str, bool *is_vocab=nullptr)
Definition: WireReader.cpp:339
std::int8_t expectInt8()
Definition: WireReader.h:87
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: environment.h:18