Gazebo Msgs

API Reference

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