Gazebo Sim

API Reference

8.7.0
include/gz/sim/components/DetachableJoint.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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_SIM_COMPONENTS_DETACHABLE_JOINT_HH_
18 #define GZ_SIM_COMPONENTS_DETACHABLE_JOINT_HH_
19 
20 #include <string>
21 #include <gz/sim/Entity.hh>
24 #include <gz/sim/config.hh>
25 
26 namespace gz
27 {
28 namespace sim
29 {
30 // Inline bracket to help doxygen filtering.
31 inline namespace GZ_SIM_VERSION_NAMESPACE {
32 namespace components
33 {
37  {
42  // \brief Type of joint. Only the "fixed" joint type is currently supported.
43  std::string jointType = {"fixed"};
44 
45  public: bool operator==(const DetachableJointInfo &_info) const
46  {
47  return (this->parentLink == _info.parentLink) &&
48  (this->childLink == _info.childLink) &&
49  (this->jointType == _info.jointType);
50  }
51 
52  public: bool operator!=(const DetachableJointInfo &_info) const
53  {
54  return !(*this == _info);
55  }
56  };
57 }
58 
59 namespace serializers
60 {
63  {
68  public: static std::ostream &Serialize(
69  std::ostream &_out,
71  {
72  _out << _info.parentLink << " " << _info.childLink << " "
73  << _info.jointType;
74  return _out;
75  }
76 
81  public: static std::istream &Deserialize(
83  {
84  _in >> _info.parentLink >> _info.childLink >> _info.jointType;
85  return _in;
86  }
87  };
88 }
89 
90 namespace components
91 {
95  Component<DetachableJointInfo, class DetachableJointTag,
96  serializers::DetachableJointInfoSerializer>;
97  GZ_SIM_REGISTER_COMPONENT("gz_sim_components.DetachableJoint",
98  DetachableJoint)
99 }
100 }
101 }
102 }
103 
104 #endif