GCC Code Coverage Report


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

src/utilities/units/IPUnit_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_IPUNIT_IMPL_HPP
7 #define UTILITIES_UNITS_IPUNIT_IMPL_HPP
8
9 #include "../UtilitiesAPI.hpp"
10 #include "Unit_Impl.hpp"
11
12 namespace openstudio {
13 namespace detail {
14
15 /** IPUnit_Impl is a Unit_Impl that is the implementation class for IPUnit.*/
16 class UTILITIES_API IPUnit_Impl : public Unit_Impl
17 {
18 public:
19 /** @name Constructors and Destructors */
20 //@{
21
22 /** Default constructor. Example: \verbatim
23 IPUnit myEnergy(IPExpnt(0,1,0,0,1));
24 std::cout << myEnergy; // produces "ft*lb_f" \endverbatim
25 *
26 * \param[in] exponents holds the exponents for each base unit.
27 * \param[in] scaleExponent exponent for scale. For instance 3 for kilo.
28 * \param[in] prettyString optional string to use in place of standardString. */
29 IPUnit_Impl(const IPExpnt& exponents = IPExpnt(), int scaleExponent = 0, const std::string& prettyString = "");
30
31 /** Alternate constructor. Specify the abbreviation of the scale, rather than its
32 * exponent.
33 *
34 * \param[in] scaleAbbreviation is string equal to a scale abbreviation. For instance
35 * "k" for kilo.
36 * \param[in] exponents holds the exponents for each base unit.
37 * \param[in] prettyString optional string to use in place of standardString. */
38 IPUnit_Impl(const std::string& scaleAbbreviation, const IPExpnt& exponents = IPExpnt(), const std::string& prettyString = "");
39
40 7462 virtual ~IPUnit_Impl() override = default;
41
42 /** Deep copy constructor. */
43 virtual Unit clone() const override;
44
45 //@}
46 /** @name Base Units and Scale */
47 //@{
48
49 /** Throws if baseUnit is not a valid for IPUnit. */
50 virtual void setBaseUnitExponent(const std::string& baseUnit, int exponent) override;
51
52 //@}
53 /** @name Mathematical Operators */
54 //@{
55
56 /** Overloaded operator to account for relationship between lb_m and lb_f. */
57 virtual bool operator==(const Unit& rUnit) const override;
58
59 /** Convert any non-zero lb_m exponent to lb_f. */
60 void lbmToLbf();
61
62 /** Convert any non-zero lb_f exponent to lb_m. */
63 void lbfToLbm();
64
65 //@}
66 private:
67 − REGISTER_LOGGER("openstudio.units.IPUnit");
68 };
69
70 } // namespace detail
71
72 } // namespace openstudio
73
74 #endif // UTILITIES_UNITS_IPUNIT_IMPL_HPP
75