GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 1 / 0 / 1
Functions: 100.0% 1 / 0 / 1
Branches: -% 0 / 0 / 0

src/utilities/units/CelsiusUnit.hpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #ifndef UTILITIES_UNITS_CELSIUSUNIT_HPP
7 #define UTILITIES_UNITS_CELSIUSUNIT_HPP
8
9 #include "../UtilitiesAPI.hpp"
10 #include "TemperatureUnit.hpp"
11
12 namespace openstudio {
13 namespace detail {
14
15 class CelsiusUnit_Impl;
16
17 } // namespace detail
18
19 /** CelsiusUnit is a TemperatureUnit that supports absolute temperatures in degrees Celsius.
20 * Kelvin and Celsius are the same in situations of relative temperature, that is, when it is the
21 * difference in temperatures that matter, rather than the absolute value. This is normally the
22 * case when the temperature base unit shows up in combination with other units, and that is not
23 * the situation being addressed here. This class is for reporting actual temperatures in degrees
24 * Celsius. Printing out K's as C's in the former situation is a feature that may be added to this
25 * library at a later date. */
26 class UTILITIES_API CelsiusUnit : public TemperatureUnit
27 {
28 public:
29 /** @name Constructors and Destructors */
30 //@{
31
32 /** Default constructor creates an absolute temperature.
33 *
34 * \param[in] CExp exponent on baseUnit C.
35 * \param[in] scaleExponent exponent for scale. For instance 3 for kilo.
36 * \param[in] prettyString optional string to use in place of standardString. */
37 CelsiusUnit(int CExp = 0, int scaleExponent = 0, const std::string& prettyString = "");
38
39 /** Alternate constructor creates an absolute temperature. Specify the abbreviation of the scale,
40 * rather than its exponent.
41 *
42 * \param[in] scaleAbbreviation is string equal to a scale abbreviation. For instance
43 * "k" for kilo.
44 * \param[in] CExp exponent on baseUnit C.
45 * \param[in] prettyString optional string to use in place of standardString. */
46 CelsiusUnit(const std::string& scaleAbbreviation, int CExp = 0, const std::string& prettyString = "");
47
48 3340 virtual ~CelsiusUnit() override = default;
49
50 //@}
51 protected:
52 /// @cond
53 using ImplType = detail::CelsiusUnit_Impl;
54
55 explicit CelsiusUnit(std::shared_ptr<detail::CelsiusUnit_Impl> impl);
56
57 friend class Unit;
58 friend class detail::CelsiusUnit_Impl;
59
60 /// @endcond
61 private:
62 REGISTER_LOGGER("openstudio.units.CelsiusUnit");
63 };
64
65 /** \relates CelsiusUnit*/
66 using OptionalCelsiusUnit = boost::optional<CelsiusUnit>;
67
68 /** \relates CelsiusUnit*/
69 using CelsiusUnitVector = std::vector<CelsiusUnit>;
70
71 /** @name Create Functions Used by UnitFactory */
72 //@{
73
74 /** \relates CelsiusUnit */
75 UTILITIES_API CelsiusUnit createCelsiusTemperature();
76
77 //@}
78
79 } // namespace openstudio
80
81 #endif // UTILITIES_UNITS_CELSIUSUNIT_HPP
82