YARP
Yet Another Robot Platform
SetCameraInfo.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2018 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/SetCameraInfo" msg definition:
12 // # This service requests that a camera stores the given CameraInfo
13 // # as that camera's calibration information.
14 // #
15 // # The width and height in the camera_info field should match what the
16 // # camera is currently outputting on its camera_info topic, and the camera
17 // # will assume that the region of the imager that is being referred to is
18 // # the region that the camera is currently capturing.
19 //
20 // sensor_msgs/CameraInfo camera_info # The camera_info to store
21 // ---
22 // bool success # True if the call succeeded
23 // string status_message # Used to give details about success
24 // Instances of this class can be read and written with YARP ports,
25 // using a ROS-compatible format.
26 
27 #ifndef YARP_ROSMSG_sensor_msgs_SetCameraInfo_h
28 #define YARP_ROSMSG_sensor_msgs_SetCameraInfo_h
29 
30 #include <yarp/os/Wire.h>
31 #include <yarp/os/Type.h>
32 #include <yarp/os/idl/WireTypes.h>
33 #include <string>
34 #include <vector>
36 
37 namespace yarp {
38 namespace rosmsg {
39 namespace sensor_msgs {
40 
42 {
43 public:
45 
47  camera_info()
48  {
49  }
50 
51  void clear()
52  {
53  // *** camera_info ***
54  camera_info.clear();
55  }
56 
57  bool readBare(yarp::os::ConnectionReader& connection) override
58  {
59  // *** camera_info ***
60  if (!camera_info.read(connection)) {
61  return false;
62  }
63 
64  return !connection.isError();
65  }
66 
67  bool readBottle(yarp::os::ConnectionReader& connection) override
68  {
69  connection.convertTextMode();
70  yarp::os::idl::WireReader reader(connection);
71  if (!reader.readListHeader(1)) {
72  return false;
73  }
74 
75  // *** camera_info ***
76  if (!camera_info.read(connection)) {
77  return false;
78  }
79 
80  return !connection.isError();
81  }
82 
84  bool read(yarp::os::ConnectionReader& connection) override
85  {
86  return (connection.isBareMode() ? readBare(connection)
87  : readBottle(connection));
88  }
89 
90  bool writeBare(yarp::os::ConnectionWriter& connection) const override
91  {
92  // *** camera_info ***
93  if (!camera_info.write(connection)) {
94  return false;
95  }
96 
97  return !connection.isError();
98  }
99 
100  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
101  {
102  connection.appendInt32(BOTTLE_TAG_LIST);
103  connection.appendInt32(1);
104 
105  // *** camera_info ***
106  if (!camera_info.write(connection)) {
107  return false;
108  }
109 
110  connection.convertTextMode();
111  return !connection.isError();
112  }
113 
115  bool write(yarp::os::ConnectionWriter& connection) const override
116  {
117  return (connection.isBareMode() ? writeBare(connection)
118  : writeBottle(connection));
119  }
120 
121  // This class will serialize ROS style or YARP style depending on protocol.
122  // If you need to force a serialization style, use one of these classes:
125 
126  // Give source text for class, ROS will need this
127  static std::string typeText()
128  {
129  return std::string("\
130 # This service requests that a camera stores the given CameraInfo \n\
131 # as that camera's calibration information.\n\
132 #\n\
133 # The width and height in the camera_info field should match what the\n\
134 # camera is currently outputting on its camera_info topic, and the camera\n\
135 # will assume that the region of the imager that is being referred to is\n\
136 # the region that the camera is currently capturing.\n\
137 \n\
138 sensor_msgs/CameraInfo camera_info # The camera_info to store\n\
139 ---\n\
140 bool success # True if the call succeeded\n\
141 string status_message # Used to give details about success\n\
142 ") + std::string("\n\
143 ================================================================================\n\
144 MSG: sensor_msgs/CameraInfo\n\
146  }
147 
148  std::string getTypeText() const
149  {
151  }
152 
153  // Name the class, ROS will need this
154  yarp::os::Type getType() const override
155  {
156  yarp::os::Type typ = yarp::os::Type::byName("sensor_msgs/SetCameraInfo", "sensor_msgs/SetCameraInfo");
157  typ.addProperty("md5sum", yarp::os::Value("ee34be01fdeee563d0d99cd594d5581d"));
158  typ.addProperty("message_definition", yarp::os::Value(getTypeText()));
159  return typ;
160  }
161 };
162 
163 } // namespace sensor_msgs
164 } // namespace rosmsg
165 } // namespace yarp
166 
167 #endif // YARP_ROSMSG_sensor_msgs_SetCameraInfo_h
yarp::rosmsg::sensor_msgs::CameraInfo camera_info
Definition: SetCameraInfo.h:44
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: CameraInfo.h:374
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: SetCameraInfo.h:90
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static Type byName(const char *name)
Definition: Type.cpp:165
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:127
virtual bool isError() const =0
The main, catch-all namespace for YARP.
Definition: numeric.h:47
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary...
yarp::os::Type getType() const override
virtual bool isBareMode() const =0
Check if the connection is bare mode.
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: SetCameraInfo.h:57
yarp::os::idl::BottleStyle< yarp::rosmsg::sensor_msgs::SetCameraInfo > bottleStyle
An interface for writing to a network connection.
virtual bool write(const yarp::os::idl::WireWriter &writer) const
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
virtual bool read(yarp::os::idl::WireReader &reader)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: SetCameraInfo.h:84
virtual bool isError() const =0
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: CameraInfo.h:501
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:30
An interface for reading from a network connection.
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: SetCameraInfo.h:67
yarp::os::idl::BareStyle< yarp::rosmsg::sensor_msgs::SetCameraInfo > rosStyle
A single value (typically within a Bottle).
Definition: Value.h:40
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
IDL-friendly connection reader.
Definition: WireReader.h:37