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