src/utilities/units/FahrenheitUnit.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_FAHRENHEITUNIT_HPP | ||
| 7 | #define UTILITIES_UNITS_FAHRENHEITUNIT_HPP | ||
| 8 | |||
| 9 | #include "../UtilitiesAPI.hpp" | ||
| 10 | #include "TemperatureUnit.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | namespace detail { | ||
| 14 | |||
| 15 | class FahrenheitUnit_Impl; | ||
| 16 | |||
| 17 | } // namespace detail | ||
| 18 | |||
| 19 | /** FahrenheitUnit is a TemperatureUnit that supports absolute temperatures in degrees Fahrenheit. | ||
| 20 | * Rankine and Fahrenheit 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 | * Fahrenheit. Printing out R's as F's in the former situation is a feature that may be added to this | ||
| 25 | * library at a later date. */ | ||
| 26 | class UTILITIES_API FahrenheitUnit : public TemperatureUnit | ||
| 27 | { | ||
| 28 | public: | ||
| 29 | /** @name Constructors and Destructors */ | ||
| 30 | //@{ | ||
| 31 | |||
| 32 | /** Default constructor creates an absolute temperature. | ||
| 33 | * | ||
| 34 | * \param[in] FExp exponent on baseUnit F. | ||
| 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 | FahrenheitUnit(int FExp = 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] FExp exponent on baseUnit F. | ||
| 45 | * \param[in] prettyString optional string to use in place of standardString. */ | ||
| 46 | FahrenheitUnit(const std::string& scaleAbbreviation, int FExp = 0, const std::string& prettyString = ""); | ||
| 47 | |||
| 48 | 485 | virtual ~FahrenheitUnit() override = default; | |
| 49 | |||
| 50 | //@} | ||
| 51 | /** @name Mathematical Operators */ | ||
| 52 | //@{ | ||
| 53 | |||
| 54 | // needed to take advantage of base class *= while retaining System check | ||
| 55 | FahrenheitUnit& operator/=(const FahrenheitUnit& rUnit); | ||
| 56 | |||
| 57 | //@} | ||
| 58 | protected: | ||
| 59 | /// @cond | ||
| 60 | using ImplType = detail::FahrenheitUnit_Impl; | ||
| 61 | |||
| 62 | explicit FahrenheitUnit(std::shared_ptr<detail::FahrenheitUnit_Impl> impl); | ||
| 63 | |||
| 64 | friend class Unit; | ||
| 65 | friend class detail::FahrenheitUnit_Impl; | ||
| 66 | |||
| 67 | /// @endcond | ||
| 68 | private: | ||
| 69 | REGISTER_LOGGER("openstudio.units.FahrenheitUnit"); | ||
| 70 | }; | ||
| 71 | |||
| 72 | /** \relates FahrenheitUnit*/ | ||
| 73 | using OptionalFahrenheitUnit = boost::optional<FahrenheitUnit>; | ||
| 74 | |||
| 75 | /** \relates FahrenheitUnit*/ | ||
| 76 | using FahrenheitUnitVector = std::vector<FahrenheitUnit>; | ||
| 77 | |||
| 78 | /** @name Create Functions Used by UnitFactory */ | ||
| 79 | //@{ | ||
| 80 | |||
| 81 | /** \relates FahrenheitUnit */ | ||
| 82 | UTILITIES_API FahrenheitUnit createFahrenheitTemperature(); | ||
| 83 | |||
| 84 | //@} | ||
| 85 | |||
| 86 | } // namespace openstudio | ||
| 87 | |||
| 88 | #endif // UTILITIES_UNITS_FAHRENHEITUNIT_HPP | ||
| 89 |