Gazebo Msgs

API Reference

11.0.1
Vector3.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 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 GZ_MSGS_CONVERT_VECTOR3_HH_
18#define GZ_MSGS_CONVERT_VECTOR3_HH_
19
20#include <gz/msgs/config.hh>
21
22// Message Headers
23#include "gz/msgs/vector3d.pb.h"
24
25// Data Headers
26#include <gz/math/Vector3.hh>
27
28namespace gz::msgs {
29// Inline bracket to help doxygen filtering.
30inline namespace GZ_MSGS_VERSION_NAMESPACE {
31
33inline void Set(gz::msgs::Vector3d *_msg, const gz::math::Vector3d &_data)
34{
35 _msg->set_x(_data.X());
36 _msg->set_y(_data.Y());
37 _msg->set_z(_data.Z());
38}
39
40inline void Set(gz::math::Vector3d *_data, const gz::msgs::Vector3d &_msg)
41{
42 _data->Set(_msg.x(), _msg.y(), _msg.z());
43}
44
45inline gz::msgs::Vector3d Convert(const gz::math::Vector3d &_data)
46{
47 gz::msgs::Vector3d ret;
48 Set(&ret, _data);
49 return ret;
50}
51
52inline gz::math::Vector3d Convert(const gz::msgs::Vector3d &_msg)
53{
55 Set(&ret, _msg);
56 return ret;
57}
58} // namespace
59} // namespace gz::msgs
60#endif // GZ_MSGS_CONVERT_VECTOR3_HH_