Gazebo Sim

API Reference

7.7.0
gz/sim/components/TemperatureRange.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 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_TEMPERATURERANGE_HH_
18 #define GZ_SIM_COMPONENTS_TEMPERATURERANGE_HH_
19 
20 #include <istream>
21 #include <ostream>
22 
23 #include <gz/math/Temperature.hh>
24 
27 #include <gz/sim/config.hh>
28 
29 namespace gz
30 {
31 namespace sim
32 {
33 // Inline bracket to help doxygen filtering.
34 inline namespace GZ_SIM_VERSION_NAMESPACE {
35 namespace components
36 {
39  {
44 
45  public: bool operator==(const TemperatureRangeInfo &_info) const
46  {
47  return (this->min == _info.min) &&
48  (this->max == _info.max);
49  }
50 
51  public: bool operator!=(const TemperatureRangeInfo &_info) const
52  {
53  return !(*this == _info);
54  }
55  };
56 }
57 
58 namespace serializers
59 {
62  {
67  public: static std::ostream &Serialize(std::ostream &_out,
69  {
70  _out << _info.min << " " << _info.max;
71  return _out;
72  }
73 
78  public: static std::istream &Deserialize(std::istream &_in,
80  {
81  _in >> _info.min >> _info.max;
82  return _in;
83  }
84  };
85 }
86 
87 namespace components
88 {
90  using TemperatureRange = Component<TemperatureRangeInfo,
91  class TemperatureRangeTag, serializers::TemperatureRangeInfoSerializer>;
92  GZ_SIM_REGISTER_COMPONENT("gz_sim_components.TemperatureRange",
93  TemperatureRange)
94 }
95 }
96 }
97 }
98 
99 #endif