Gazebo Sim

API Reference

7.7.0
include/gz/sim/components/JointType.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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_JOINTTYPE_HH_
18 #define GZ_SIM_COMPONENTS_JOINTTYPE_HH_
19 
20 #include <memory>
21 #include <sdf/Joint.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 serializers
33 {
35  {
40  public: static std::ostream &Serialize(std::ostream &_out,
41  const sdf::JointType &_type)
42  {
43  _out << static_cast<int>(_type);
44  return _out;
45  }
46 
51  public: static std::istream &Deserialize(std::istream &_in,
52  sdf::JointType &_type)
53  {
54  int type;
55  _in >> type;
56  _type = sdf::JointType(type);
57  return _in;
58  }
59  };
60 }
61 namespace components
62 {
65  using JointType = Component<sdf::JointType, class JointTypeTag,
66  serializers::JointTypeSerializer>;
68  "gz_sim_components.JointType", JointType)
69 }
70 }
71 }
72 }
73 
74 #endif