src/utilities/units/SIUnit_Impl.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_SIUNIT_IMPL_HPP | ||
| 7 | #define UTILITIES_UNITS_SIUNIT_IMPL_HPP | ||
| 8 | |||
| 9 | #include "../UtilitiesAPI.hpp" | ||
| 10 | #include "Unit_Impl.hpp" | ||
| 11 | #include "SIUnit.hpp" | ||
| 12 | |||
| 13 | namespace openstudio { | ||
| 14 | namespace detail { | ||
| 15 | |||
| 16 | /** SIUnit_Impl is a Unit_Impl that is the implementation class for SIUnit.*/ | ||
| 17 | class UTILITIES_API SIUnit_Impl : public Unit_Impl | ||
| 18 | { | ||
| 19 | public: | ||
| 20 | /** @name Constructors and Destructors */ | ||
| 21 | //@{ | ||
| 22 | |||
| 23 | /** Default constructor. Example: \verbatim | ||
| 24 | SIUnit myEnergy(SIExpnt(1,2,-2),3,"J"); | ||
| 25 | std::cout << myEnergy; // produces "kJ" \endverbatim | ||
| 26 | * | ||
| 27 | * \param[in] exponents holds the exponents for each base unit. | ||
| 28 | * \param[in] scaleExponent exponent for scale. For instance 3 for kilo. | ||
| 29 | * \param[in] prettyString optional string to use in place of standardString. */ | ||
| 30 | SIUnit_Impl(const SIExpnt& exponents = SIExpnt(), int scaleExponent = 0, const std::string& prettyString = ""); | ||
| 31 | |||
| 32 | /** Alternate constructor. Specify the abbreviation of the scale, rather than its | ||
| 33 | * exponent. Example: \verbatim | ||
| 34 | SIUnit myEnergy("k",SIExpnt(1,2,-2),"J"); | ||
| 35 | std::cout << myEnergy; // produces "kJ \endverbatim | ||
| 36 | * | ||
| 37 | * \param[in] scaleAbbreviation is string equal to a scale abbreviation. For instance | ||
| 38 | * "k" for kilo. | ||
| 39 | * \param[in] exponents holds the exponents for each base unit. | ||
| 40 | * \param[in] prettyString optional string to use in place of standardString. */ | ||
| 41 | SIUnit_Impl(const std::string& scaleAbbreviation, const SIExpnt& exponents = SIExpnt(), const std::string& prettyString = ""); | ||
| 42 | |||
| 43 | 4989920 | virtual ~SIUnit_Impl() override = default; | |
| 44 | |||
| 45 | /** Deep copy constructor. */ | ||
| 46 | virtual Unit clone() const override; | ||
| 47 | |||
| 48 | //@} | ||
| 49 | /** @name Base Units and Scale */ | ||
| 50 | //@{ | ||
| 51 | |||
| 52 | /** Throws if baseUnit is not a valid for SIUnit. */ | ||
| 53 | virtual void setBaseUnitExponent(const std::string& baseUnit, int exponent) override; | ||
| 54 | |||
| 55 | //@} | ||
| 56 | private: | ||
| 57 | − | REGISTER_LOGGER("openstudio.units.SIUnit"); | |
| 58 | }; | ||
| 59 | |||
| 60 | } // namespace detail | ||
| 61 | } // namespace openstudio | ||
| 62 | |||
| 63 | #endif // UTILITIES_UNITS_SIUNIT_IMPL_HPP | ||
| 64 |