Gazebo Math
API Reference
7.4.0
insert_drive_file
Tutorials
library_books
Classes
toc
Namespaces
insert_drive_file
Files
launch
Gazebo Website
Index
List
Hierarchy
Members: All
Members: Functions
Members: Variables
Members: Typedefs
Members: Enumerations
Members: Enumerator
List
Members
Functions
Typedefs
Variables
Enumerations
Enumerator
include
gz
math
gz/math/Temperature.hh
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2016 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_MATH_TEMPERATURE_HH_
18
#define GZ_MATH_TEMPERATURE_HH_
19
20
#include <istream>
21
#include <ostream>
22
23
#include <gz/math/config.hh>
24
#include "
gz/math/Helpers.hh
"
25
#include <gz/utils/ImplPtr.hh>
26
27
28
namespace
gz
29
{
30
namespace
math
31
{
32
// Inline bracket to help doxygen filtering.
33
inline
namespace
GZ_MATH_VERSION_NAMESPACE {
76
class
GZ_MATH_VISIBLE
Temperature
77
{
79
public
:
Temperature
();
80
84
// cppcheck-suppress noExplicitConstructor
85
public
:
Temperature
(
double
_temp);
86
90
public
:
static
double
KelvinToCelsius
(
double
_temp);
91
95
public
:
static
double
KelvinToFahrenheit
(
double
_temp);
96
100
public
:
static
double
CelsiusToFahrenheit
(
double
_temp);
101
105
public
:
static
double
CelsiusToKelvin
(
double
_temp);
106
110
public
:
static
double
FahrenheitToCelsius
(
double
_temp);
111
115
public
:
static
double
FahrenheitToKelvin
(
double
_temp);
116
119
public
:
void
SetKelvin
(
double
_temp);
120
123
public
:
void
SetCelsius
(
double
_temp);
124
127
public
:
void
SetFahrenheit
(
double
_temp);
128
131
public
:
double
Kelvin
()
const
;
132
135
public
:
double
Celsius
()
const
;
136
139
public
:
double
Fahrenheit
()
const
;
140
144
public
:
double
operator()
()
const
;
145
149
public
:
Temperature
&
operator=
(
double
_temp);
150
154
public
:
Temperature
operator+
(
double
_temp)
const
;
155
159
public
:
Temperature
operator+
(
const
Temperature
&_temp)
const
;
160
165
public
:
friend
Temperature
operator+
(
double
_t,
const
Temperature
&_temp)
166
{
167
return
_t + _temp.
Kelvin
();
168
}
169
173
public
:
const
Temperature
&
operator+=
(
double
_temp);
174
178
public
:
const
Temperature
&
operator+=
(
const
Temperature
&_temp);
179
183
public
:
Temperature
operator-
(
double
_temp)
const
;
184
188
public
:
Temperature
operator-
(
const
Temperature
&_temp)
const
;
189
194
public
:
friend
Temperature
operator-
(
double
_t,
const
Temperature
&_temp)
195
{
196
return
_t - _temp.
Kelvin
();
197
}
198
202
public
:
const
Temperature
&
operator-=
(
double
_temp);
203
207
public
:
const
Temperature
&
operator-=
(
const
Temperature
&_temp);
208
212
public
:
Temperature
operator*
(
double
_temp)
const
;
213
217
public
:
Temperature
operator*
(
const
Temperature
&_temp)
const
;
218
223
public
:
friend
Temperature
operator*
(
double
_t,
const
Temperature
&_temp)
224
{
225
return
_t * _temp.
Kelvin
();
226
}
227
231
public
:
const
Temperature
&
operator*=
(
double
_temp);
232
236
public
:
const
Temperature
&
operator*=
(
const
Temperature
&_temp);
237
241
public
:
Temperature
operator/
(
double
_temp)
const
;
242
246
public
:
Temperature
operator/
(
const
Temperature
&_temp)
const
;
247
252
public
:
friend
Temperature
operator/
(
double
_t,
const
Temperature
&_temp)
253
{
254
return
_t / _temp.
Kelvin
();
255
}
256
260
public
:
const
Temperature
&
operator/=
(
double
_temp);
261
265
public
:
const
Temperature
&
operator/=
(
const
Temperature
&_temp);
266
270
public
:
bool
operator==
(
const
Temperature
&_temp)
const
;
271
276
public
:
bool
operator==
(
double
_temp)
const
;
277
281
public
:
bool
operator!=
(
const
Temperature
&_temp)
const
;
282
287
public
:
bool
operator!=
(
double
_temp)
const
;
288
292
public
:
bool
operator<
(
const
Temperature
&_temp)
const
;
293
298
public
:
bool
operator<
(
double
_temp)
const
;
299
303
public
:
bool
operator<=
(
const
Temperature
&_temp)
const
;
304
309
public
:
bool
operator<=
(
double
_temp)
const
;
310
314
public
:
bool
operator>
(
const
Temperature
&_temp)
const
;
315
320
public
:
bool
operator>
(
double
_temp)
const
;
321
325
public
:
bool
operator>=
(
const
Temperature
&_temp)
const
;
326
331
public
:
bool
operator>=
(
double
_temp)
const
;
332
337
public
:
friend
std::ostream
&
operator<<
(
std::ostream
&_out,
338
const
gz::math::Temperature
&_temp)
339
{
340
_out << _temp.
Kelvin
();
341
return
_out;
342
}
343
349
public
:
friend
std::istream
&
operator>>
(
std::istream
&_in,
350
gz::math::Temperature
&_temp)
351
{
352
// Skip white spaces
353
_in.
setf
(std::ios_base::skipws);
354
355
double
kelvin;
356
_in >> kelvin;
357
358
if
(!_in.
fail
())
359
{
360
_temp.
SetKelvin
(kelvin);
361
}
362
return
_in;
363
}
364
365
GZ_UTILS_IMPL_PTR(dataPtr)
366
};
367
}
368
}
369
}
370
#endif