src/utilities/units/TemperatureUnit.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_TEMPERATUREUNIT_HPP | ||
| 7 | #define UTILITIES_UNITS_TEMPERATUREUNIT_HPP | ||
| 8 | |||
| 9 | #include "../UtilitiesAPI.hpp" | ||
| 10 | #include "Unit.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | namespace detail { | ||
| 14 | |||
| 15 | class TemperatureUnit_Impl; | ||
| 16 | |||
| 17 | } // namespace detail | ||
| 18 | |||
| 19 | /** TemperatureUnit is an abstract Unit for handling temperatures. Temperatures can be absolute | ||
| 20 | * or relative. The temperature of a material is absolute temperature. Temperature differences are | ||
| 21 | * relative temperatures. In the former case C != K (F != R), but in the latter, C == K (F == R). | ||
| 22 | * | ||
| 23 | * There are no public constructors, because this is an abstract class. By default, derived | ||
| 24 | * classes should set absoute=true. Temperatures that start as relative should be handled by regular | ||
| 25 | * Unit classes. */ | ||
| 26 | class UTILITIES_API TemperatureUnit : public Unit | ||
| 27 | { | ||
| 28 | public: | ||
| 29 | /** @name Constructors and Destructors */ | ||
| 30 | //@{ | ||
| 31 | |||
| 32 | 8613 | virtual ~TemperatureUnit() override = default; | |
| 33 | |||
| 34 | //@} | ||
| 35 | /** @name Mathematical Operators */ | ||
| 36 | //@{ | ||
| 37 | |||
| 38 | bool isAbsolute() const; | ||
| 39 | |||
| 40 | void setAsAbsolute(); | ||
| 41 | |||
| 42 | void setAsRelative(); | ||
| 43 | |||
| 44 | //@} | ||
| 45 | protected: | ||
| 46 | /// @cond | ||
| 47 | using ImplType = detail::TemperatureUnit_Impl; | ||
| 48 | |||
| 49 | explicit TemperatureUnit(std::shared_ptr<detail::TemperatureUnit_Impl> impl); | ||
| 50 | |||
| 51 | friend class Unit; | ||
| 52 | friend class detail::TemperatureUnit_Impl; | ||
| 53 | |||
| 54 | /// @endcond | ||
| 55 | private: | ||
| 56 | REGISTER_LOGGER("openstudio.units.TemperatureUnit"); | ||
| 57 | }; | ||
| 58 | |||
| 59 | /** \relates TemperatureUnit*/ | ||
| 60 | using OptionalTemperatureUnit = boost::optional<TemperatureUnit>; | ||
| 61 | |||
| 62 | /** \relates TemperatureUnit*/ | ||
| 63 | using TemperatureUnitVector = std::vector<TemperatureUnit>; | ||
| 64 | |||
| 65 | } // namespace openstudio | ||
| 66 | |||
| 67 | #endif // UTILITIES_UNITS_TEMPERATUREUNIT_HPP | ||
| 68 |