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
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::typeChecksum
static constexpr const char * typeChecksum
Definition: SetCameraInfoReply.h:138
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::success
bool success
Definition: SetCameraInfoReply.h:31
yarp::os::idl::WireReader::readString
bool readString(std::string &str, bool *is_vocab=nullptr)
Definition: WireReader.cpp:339
yarp::os::ConnectionWriter::appendBlock
virtual void appendBlock(const char *data, size_t len)=0
Send a block of data to the network connection.
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::SetCameraInfoReply
SetCameraInfoReply()
Definition: SetCameraInfoReply.h:34
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::sensor_msgs::SetCameraInfoReply > rosStyle
Definition: SetCameraInfoReply.h:131
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
yarp::rosmsg::sensor_msgs::SetCameraInfoReply
Definition: SetCameraInfoReply.h:29
yarp::os::idl::BottleStyle
Definition: BottleStyle.h:22
yarp::os::Type
Definition: Type.h:24
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::clear
void clear()
Definition: SetCameraInfoReply.h:40
yarp::os::idl::WirePortable::read
virtual bool read(yarp::os::idl::WireReader &reader)
Definition: WirePortable.cpp:14
yarp::os::ConnectionWriter::appendInt8
virtual void appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
BOTTLE_TAG_STRING
#define BOTTLE_TAG_STRING
Definition: Bottle.h:28
Wire.h
BOTTLE_TAG_INT8
#define BOTTLE_TAG_INT8
Definition: Bottle.h:21
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::getType
yarp::os::Type getType() const override
Definition: SetCameraInfoReply.h:145
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: SetCameraInfoReply.h:123
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: SetCameraInfoReply.h:104
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: SetCameraInfoReply.h:86
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::os::ConnectionReader::expectInt32
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
yarp::os::Type::addProperty
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:137
Type.h
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::status_message
std::string status_message
Definition: SetCameraInfoReply.h:32
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
yarp::os::ConnectionReader::convertTextMode
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: SetCameraInfoReply.h:92
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::sensor_msgs::SetCameraInfoReply > bottleStyle
Definition: SetCameraInfoReply.h:132
yarp::os::idl::WirePortable
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:26
yarp::os::ConnectionWriter::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
yarp::os::ConnectionWriter::convertTextMode
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
yarp::os::ConnectionWriter::appendInt32
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
yarp::os::idl::WireReader
IDL-friendly connection reader.
Definition: WireReader.h:33
yarp::os::ConnectionReader
An interface for reading from a network connection.
Definition: ConnectionReader.h:40
yarp::os::idl::BareStyle
Definition: BareStyle.h:22
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::typeName
static constexpr const char * typeName
Definition: SetCameraInfoReply.h:135
yarp::os::idl::WireReader::expectInt8
std::int8_t expectInt8()
Definition: WireReader.h:87
yarp::os::ConnectionWriter::appendExternalBlock
virtual void appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::typeText
static constexpr const char * typeText
Definition: SetCameraInfoReply.h:141
yarp::os::ConnectionReader::expectBlock
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
sensor_msgs
Definition: BatteryState.h:22
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: SetCameraInfoReply.h:49
yarp::rosmsg::sensor_msgs::SetCameraInfoReply::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: SetCameraInfoReply.h:66
yarp::os::idl::WireReader::readListHeader
bool readListHeader()
Definition: WireReader.cpp:470
yarp::os::idl::WirePortable::write
virtual bool write(const yarp::os::idl::WireWriter &writer) const
Definition: WirePortable.cpp:20