Ignition Msgs

API Reference

5.6.0
Utility.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef IGNITION_MSGS_UTILITY_HH_
18 #define IGNITION_MSGS_UTILITY_HH_
19 
20 #include <string>
21 #include <utility>
22 #include <vector>
23 
25 #include <ignition/math/Color.hh>
27 #include <ignition/math/Pose3.hh>
28 #include <ignition/math/Plane.hh>
29 #include <ignition/math/Vector3.hh>
30 
31 #include "ignition/msgs/config.hh"
32 #include "ignition/msgs/Export.hh"
34 
38 
39 namespace ignition
40 {
41  namespace msgs
42  {
43  // Inline bracket to help doxygen filtering.
44  inline namespace IGNITION_MSGS_VERSION_NAMESPACE {
45  //
49  IGNITION_MSGS_VISIBLE
50  ignition::math::Vector3d Convert(const msgs::Vector3d &_v);
51 
55  IGNITION_MSGS_VISIBLE
56  ignition::math::Vector2d Convert(const msgs::Vector2d &_v);
57 
61  IGNITION_MSGS_VISIBLE
62  ignition::math::Quaterniond Convert(const msgs::Quaternion &_q);
63 
67  IGNITION_MSGS_VISIBLE
68  ignition::math::Pose3d Convert(const msgs::Pose &_p);
69 
73  IGNITION_MSGS_VISIBLE
74  math::Color Convert(const msgs::Color &_c);
75 
79  IGNITION_MSGS_VISIBLE
80  ignition::math::Planed Convert(const msgs::PlaneGeom &_p);
81 
85  IGNITION_MSGS_VISIBLE
86  math::Inertiald Convert(const msgs::Inertial &_i);
87 
92  IGNITION_MSGS_VISIBLE
93  math::AxisAlignedBox Convert(const msgs::AxisAlignedBox &_b);
94 
99  IGNITION_MSGS_VISIBLE
100  msgs::AxisAlignedBox Convert(const math::AxisAlignedBox &_b);
101 
105  IGNITION_MSGS_VISIBLE
106  std::string Convert(const msgs::StringMsg &_m);
107 
111  IGNITION_MSGS_VISIBLE
112  bool Convert(const msgs::Boolean &_m);
113 
117  IGNITION_MSGS_VISIBLE
118  int32_t Convert(const msgs::Int32 &_m);
119 
123  IGNITION_MSGS_VISIBLE
124  uint32_t Convert(const msgs::UInt32 &_m);
125 
129  IGNITION_MSGS_VISIBLE
130  int64_t Convert(const msgs::Int64 &_m);
131 
135  IGNITION_MSGS_VISIBLE
136  uint64_t Convert(const msgs::UInt64 &_m);
137 
141  IGNITION_MSGS_VISIBLE
142  double Convert(const msgs::Double &_m);
143 
147  IGNITION_MSGS_VISIBLE
148  float Convert(const msgs::Float &_m);
149 
153  IGNITION_MSGS_VISIBLE
154  msgs::Vector3d Convert(const ignition::math::Vector3d &_v);
155 
159  IGNITION_MSGS_VISIBLE
160  msgs::Vector2d Convert(const ignition::math::Vector2d &_v);
161 
165  IGNITION_MSGS_VISIBLE
166  msgs::Quaternion Convert(const ignition::math::Quaterniond &_q);
167 
171  IGNITION_MSGS_VISIBLE
172  msgs::Pose Convert(const ignition::math::Pose3d &_p);
173 
177  IGNITION_MSGS_VISIBLE
178  msgs::Color Convert(const math::Color &_c);
179 
183  IGNITION_MSGS_VISIBLE
184  msgs::Inertial Convert(const math::Inertiald &_i);
185 
189  IGNITION_MSGS_VISIBLE
190  msgs::Inertial Convert(const math::MassMatrix3d &_m);
191 
195  IGNITION_MSGS_VISIBLE
196  msgs::PlaneGeom Convert(const ignition::math::Planed &_p);
197 
201  IGNITION_MSGS_VISIBLE
202  msgs::StringMsg Convert(const std::string &_s);
203 
207  IGNITION_MSGS_VISIBLE
208  msgs::Boolean Convert(const bool &_b);
209 
213  IGNITION_MSGS_VISIBLE
214  msgs::Int32 Convert(const int32_t &_i);
215 
219  IGNITION_MSGS_VISIBLE
220  msgs::UInt32 Convert(const uint32_t &_u);
221 
225  IGNITION_MSGS_VISIBLE
226  msgs::Int64 Convert(const int64_t &_i);
227 
231  IGNITION_MSGS_VISIBLE
232  msgs::UInt64 Convert(const uint64_t &_u);
233 
237  IGNITION_MSGS_VISIBLE
238  msgs::Double Convert(const double &_d);
239 
243  IGNITION_MSGS_VISIBLE
244  msgs::Float Convert(const float &_f);
245 
250  IGNITION_MSGS_VISIBLE
252 
257  IGNITION_MSGS_VISIBLE
259 
263  IGNITION_MSGS_VISIBLE
265 
269  IGNITION_MSGS_VISIBLE
271 
275  IGNITION_MSGS_VISIBLE
277 
280  // \param[in] _t PixelFormatType enum value.
282  IGNITION_MSGS_VISIBLE
284 
289  IGNITION_MSGS_VISIBLE
291 
296  IGNITION_MSGS_VISIBLE
298 
302  IGNITION_MSGS_VISIBLE
303  void Set(msgs::Vector3d *_pt, const ignition::math::Vector3d &_v);
304 
308  IGNITION_MSGS_VISIBLE
309  void Set(msgs::Vector2d *_pt, const ignition::math::Vector2d &_v);
310 
314  IGNITION_MSGS_VISIBLE
315  void Set(msgs::Quaternion *_q, const ignition::math::Quaterniond &_v);
316 
320  IGNITION_MSGS_VISIBLE
321  void Set(msgs::Pose *_p, const ignition::math::Pose3d &_v);
322 
326  IGNITION_MSGS_VISIBLE
327  void Set(msgs::Color *_c, const math::Color &_v);
328 
332  IGNITION_MSGS_VISIBLE
333  void Set(msgs::Inertial *_i, const math::Inertiald &_m);
334 
338  IGNITION_MSGS_VISIBLE
339  void Set(msgs::Inertial *_i, const math::MassMatrix3d &_m);
340 
344  IGNITION_MSGS_VISIBLE
345  void Set(msgs::PlaneGeom *_p, const ignition::math::Planed &_v);
346 
350  IGNITION_MSGS_VISIBLE
351  void Set(msgs::StringMsg *_p, const std::string &_v);
352 
356  IGNITION_MSGS_VISIBLE
357  void Set(msgs::Boolean *_p, const bool &_v);
358 
362  IGNITION_MSGS_VISIBLE
363  void Set(msgs::Int32 *_p, const int32_t &_v);
364 
368  IGNITION_MSGS_VISIBLE
369  void Set(msgs::UInt32 *_p, const uint32_t &_v);
370 
374  IGNITION_MSGS_VISIBLE
375  void Set(msgs::Int64 *_p, const int64_t &_v);
376 
380  IGNITION_MSGS_VISIBLE
381  void Set(msgs::UInt64 *_p, const uint64_t &_v);
382 
386  IGNITION_MSGS_VISIBLE
387  void Set(msgs::Double *_p, const double &_v);
388 
392  IGNITION_MSGS_VISIBLE
393  void Set(msgs::Float *_p, const float &_v);
394 
398  IGNITION_MSGS_VISIBLE
399  void Set(msgs::AxisAlignedBox *_b, const math::AxisAlignedBox &_v);
400 
416  IGNITION_MSGS_VISIBLE
417  void InitPointCloudPacked(msgs::PointCloudPacked &_msg,
418  const std::string &_frameId, bool _memoryAligned,
421 
424  // \param[in] _t Type of the discovery message.
426  IGNITION_MSGS_VISIBLE
428 
440  IGNITION_MSGS_VISIBLE
441  bool ConvertFuelMetadata(const std::string &_modelConfigStr,
442  msgs::FuelMetadata &_meta);
443 
455  IGNITION_MSGS_VISIBLE
456  bool ConvertFuelMetadata(const msgs::FuelMetadata &_meta,
457  std::string &_modelConfigStr);
458  }
459  }
460 }
461 #endif
#define IGNITION_MSGS_VERSION_NAMESPACE
Definition: config.hh:11
void InitPointCloudPacked(msgs::PointCloudPacked &_msg, const std::string &_frameId, bool _memoryAligned, const std::vector< std::pair< std::string, msgs::PointCloudPacked::Field::DataType >> &_fields)
This function will set the header and field members of a PointCloudPacked message. This will clear existing values in the PointCloudPacked field and header.
msgs::Joint::Type ConvertJointType(const std::string &_str)
Convert a string to a msgs::Joint::Type enum.
PixelFormatType
Definition: image.pb.h:55
Joint_Type Type
Definition: joint.pb.h:326
PointCloudPacked_Field_DataType DataType
Definition: pointcloud_packed.pb.h:143
STL class.
Material_ShaderType ShaderType
Definition: material.pb.h:509
bool ConvertFuelMetadata(const std::string &_modelConfigStr, msgs::FuelMetadata &_meta)
Convert the contents of a model.config file, in the form of an XML string, to a FuelMetadata message...
Discovery_Type Type
Definition: discovery.pb.h:778
Geometry_Type Type
Definition: geometry.pb.h:154
msgs::Material::ShaderType ConvertShaderType(const std::string &_str)
Convert a string to a msgs::Material::ShaderType enum.
std::string ToString(const msgs::Discovery::Type &_t)
Convert a Discovery::Type to a string. This can be used for debugging purposes.
msgs::Geometry::Type ConvertGeometryType(const std::string &_str)
Convert a string to a msgs::Geometry::Type enum.
STL class.
msgs::PixelFormatType ConvertPixelFormatType(const std::string &_str)
Convert a string to a msgs::PixelFormatType enum.
void Set(msgs::Vector3d *_pt, const ignition::math::Vector3d &_v)
Set a msgs::Vector3d from an ignition::math::Vector3d.
ignition::math::Vector3d Convert(const msgs::Vector3d &_v)
Convert a msgs::Vector3d to an ignition::math::Vector.
Inertial< double > Inertiald
MassMatrix3< double > MassMatrix3d