YARP
Yet Another Robot Platform
MarkerArray.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 "visualization_msgs/MarkerArray" msg definition:
9 // Marker[] markers
10 // Instances of this class can be read and written with YARP ports,
11 // using a ROS-compatible format.
12 
13 #ifndef YARP_ROSMSG_visualization_msgs_MarkerArray_h
14 #define YARP_ROSMSG_visualization_msgs_MarkerArray_h
15 
16 #include <yarp/os/Wire.h>
17 #include <yarp/os/Type.h>
18 #include <yarp/os/idl/WireTypes.h>
19 #include <string>
20 #include <vector>
22 
23 namespace yarp {
24 namespace rosmsg {
25 namespace visualization_msgs {
26 
28 {
29 public:
30  std::vector<yarp::rosmsg::visualization_msgs::Marker> markers;
31 
33  markers()
34  {
35  }
36 
37  void clear()
38  {
39  // *** markers ***
40  markers.clear();
41  }
42 
43  bool readBare(yarp::os::ConnectionReader& connection) override
44  {
45  // *** markers ***
46  int len = connection.expectInt32();
47  markers.resize(len);
48  for (int i=0; i<len; i++) {
49  if (!markers[i].read(connection)) {
50  return false;
51  }
52  }
53 
54  return !connection.isError();
55  }
56 
57  bool readBottle(yarp::os::ConnectionReader& connection) override
58  {
59  connection.convertTextMode();
60  yarp::os::idl::WireReader reader(connection);
61  if (!reader.readListHeader(1)) {
62  return false;
63  }
64 
65  // *** markers ***
66  if (connection.expectInt32() != BOTTLE_TAG_LIST) {
67  return false;
68  }
69  int len = connection.expectInt32();
70  markers.resize(len);
71  for (int i=0; i<len; i++) {
72  if (!markers[i].read(connection)) {
73  return false;
74  }
75  }
76 
77  return !connection.isError();
78  }
79 
81  bool read(yarp::os::ConnectionReader& connection) override
82  {
83  return (connection.isBareMode() ? readBare(connection)
84  : readBottle(connection));
85  }
86 
87  bool writeBare(yarp::os::ConnectionWriter& connection) const override
88  {
89  // *** markers ***
90  connection.appendInt32(markers.size());
91  for (size_t i=0; i<markers.size(); i++) {
92  if (!markers[i].write(connection)) {
93  return false;
94  }
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  // *** markers ***
106  connection.appendInt32(BOTTLE_TAG_LIST);
107  connection.appendInt32(markers.size());
108  for (size_t i=0; i<markers.size(); i++) {
109  if (!markers[i].write(connection)) {
110  return false;
111  }
112  }
113 
114  connection.convertTextMode();
115  return !connection.isError();
116  }
117 
119  bool write(yarp::os::ConnectionWriter& connection) const override
120  {
121  return (connection.isBareMode() ? writeBare(connection)
122  : writeBottle(connection));
123  }
124 
125  // This class will serialize ROS style or YARP style depending on protocol.
126  // If you need to force a serialization style, use one of these classes:
129 
130  // The name for this message, ROS will need this
131  static constexpr const char* typeName = "visualization_msgs/MarkerArray";
132 
133  // The checksum for this message, ROS will need this
134  static constexpr const char* typeChecksum = "d155b9ce5188fbaf89745847fd5882d7";
135 
136  // The source text for this message, ROS will need this
137  static constexpr const char* typeText = "\
138 Marker[] markers\n\
139 \n\
140 ================================================================================\n\
141 MSG: visualization_msgs/Marker\n\
142 # See http://www.ros.org/wiki/rviz/DisplayTypes/Marker and http://www.ros.org/wiki/rviz/Tutorials/Markers%3A%20Basic%20Shapes for more information on using this message with rviz\n\
143 \n\
144 uint8 ARROW=0\n\
145 uint8 CUBE=1\n\
146 uint8 SPHERE=2\n\
147 uint8 CYLINDER=3\n\
148 uint8 LINE_STRIP=4\n\
149 uint8 LINE_LIST=5\n\
150 uint8 CUBE_LIST=6\n\
151 uint8 SPHERE_LIST=7\n\
152 uint8 POINTS=8\n\
153 uint8 TEXT_VIEW_FACING=9\n\
154 uint8 MESH_RESOURCE=10\n\
155 uint8 TRIANGLE_LIST=11\n\
156 \n\
157 uint8 ADD=0\n\
158 uint8 MODIFY=0\n\
159 uint8 DELETE=2\n\
160 uint8 DELETEALL=3\n\
161 \n\
162 Header header # header for time/frame information\n\
163 string ns # Namespace to place this object in... used in conjunction with id to create a unique name for the object\n\
164 int32 id # object ID useful in conjunction with the namespace for manipulating and deleting the object later\n\
165 int32 type # Type of object\n\
166 int32 action # 0 add/modify an object, 1 (deprecated), 2 deletes an object, 3 deletes all objects\n\
167 geometry_msgs/Pose pose # Pose of the object\n\
168 geometry_msgs/Vector3 scale # Scale of the object 1,1,1 means default (usually 1 meter square)\n\
169 std_msgs/ColorRGBA color # Color [0.0-1.0]\n\
170 duration lifetime # How long the object should last before being automatically deleted. 0 means forever\n\
171 bool frame_locked # If this marker should be frame-locked, i.e. retransformed into its frame every timestep\n\
172 \n\
173 #Only used if the type specified has some use for them (eg. POINTS, LINE_STRIP, ...)\n\
174 geometry_msgs/Point[] points\n\
175 #Only used if the type specified has some use for them (eg. POINTS, LINE_STRIP, ...)\n\
176 #number of colors must either be 0 or equal to the number of points\n\
177 #NOTE: alpha is not yet used\n\
178 std_msgs/ColorRGBA[] colors\n\
179 \n\
180 # NOTE: only used for text markers\n\
181 string text\n\
182 \n\
183 # NOTE: only used for MESH_RESOURCE markers\n\
184 string mesh_resource\n\
185 bool mesh_use_embedded_materials\n\
186 \n\
187 ================================================================================\n\
188 MSG: std_msgs/Header\n\
189 # Standard metadata for higher-level stamped data types.\n\
190 # This is generally used to communicate timestamped data \n\
191 # in a particular coordinate frame.\n\
192 # \n\
193 # sequence ID: consecutively increasing ID \n\
194 uint32 seq\n\
195 #Two-integer timestamp that is expressed as:\n\
196 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
197 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
198 # time-handling sugar is provided by the client library\n\
199 time stamp\n\
200 #Frame this data is associated with\n\
201 # 0: no frame\n\
202 # 1: global frame\n\
203 string frame_id\n\
204 \n\
205 ================================================================================\n\
206 MSG: geometry_msgs/Pose\n\
207 # A representation of pose in free space, composed of position and orientation. \n\
208 Point position\n\
209 Quaternion orientation\n\
210 \n\
211 ================================================================================\n\
212 MSG: geometry_msgs/Point\n\
213 # This contains the position of a point in free space\n\
214 float64 x\n\
215 float64 y\n\
216 float64 z\n\
217 \n\
218 ================================================================================\n\
219 MSG: geometry_msgs/Quaternion\n\
220 # This represents an orientation in free space in quaternion form.\n\
221 \n\
222 float64 x\n\
223 float64 y\n\
224 float64 z\n\
225 float64 w\n\
226 \n\
227 ================================================================================\n\
228 MSG: geometry_msgs/Vector3\n\
229 # This represents a vector in free space. \n\
230 # It is only meant to represent a direction. Therefore, it does not\n\
231 # make sense to apply a translation to it (e.g., when applying a \n\
232 # generic rigid transformation to a Vector3, tf2 will only apply the\n\
233 # rotation). If you want your data to be translatable too, use the\n\
234 # geometry_msgs/Point message instead.\n\
235 \n\
236 float64 x\n\
237 float64 y\n\
238 float64 z\n\
239 ================================================================================\n\
240 MSG: std_msgs/ColorRGBA\n\
241 float32 r\n\
242 float32 g\n\
243 float32 b\n\
244 float32 a\n\
245 ";
246 
247  yarp::os::Type getType() const override
248  {
250  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
251  typ.addProperty("message_definition", yarp::os::Value(typeText));
252  return typ;
253  }
254 };
255 
256 } // namespace visualization_msgs
257 } // namespace rosmsg
258 } // namespace yarp
259 
260 #endif // YARP_ROSMSG_visualization_msgs_MarkerArray_h
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a 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 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.
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:45
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:23
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:30
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: MarkerArray.h:81
std::vector< yarp::rosmsg::visualization_msgs::Marker > markers
Definition: MarkerArray.h:30
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: MarkerArray.h:119
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: MarkerArray.h:100
yarp::os::idl::BottleStyle< yarp::rosmsg::visualization_msgs::MarkerArray > bottleStyle
Definition: MarkerArray.h:128
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: MarkerArray.h:57
yarp::os::Type getType() const override
Definition: MarkerArray.h:247
static constexpr const char * typeChecksum
Definition: MarkerArray.h:134
static constexpr const char * typeText
Definition: MarkerArray.h:137
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: MarkerArray.h:43
yarp::os::idl::BareStyle< yarp::rosmsg::visualization_msgs::MarkerArray > rosStyle
Definition: MarkerArray.h:127
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: MarkerArray.h:87
static constexpr const char * typeName
Definition: MarkerArray.h:131
The main, catch-all namespace for YARP.
Definition: dirs.h:16