Gazebo Msgs

API Reference

10.1.1
Vector2.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_VECTOR2_HH_
18#define GZ_MSGS_CONVERT_VECTOR2_HH_
19
20// Message Headers
21#include "gz/msgs/vector2d.pb.h"
22
23// Data Headers
24#include <gz/math/Vector2.hh>
25
26namespace gz::msgs {
27// Inline bracket to help doxygen filtering.
28inline namespace GZ_MSGS_VERSION_NAMESPACE {
29
31inline void Set(gz::msgs::Vector2d *_msg, const gz::math::Vector2d &_data)
32{
33 _msg->set_x(_data.X());
34 _msg->set_y(_data.Y());
35}
36
37inline void Set(gz::math::Vector2d *_data, const gz::msgs::Vector2d &_msg)
38{
39 _data->Set(_msg.x(), _msg.y());
40}
41
42inline gz::msgs::Vector2d Convert(const gz::math::Vector2d &_data)
43{
44 gz::msgs::Vector2d ret;
45 Set(&ret, _data);
46 return ret;
47}
48
49inline gz::math::Vector2d Convert(const gz::msgs::Vector2d &_msg)
50{
52 Set(&ret, _msg);
53 return ret;
54}
55} // namespce
56} // namespace gz::msgs
57#endif // GZ_MSGS_CONVERT_VECTOR3_HH_