GCC Code Coverage Report


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

src/utilities/units/ThermUnit.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_THERMUNIT_HPP
7 #define UTILITIES_UNITS_THERMUNIT_HPP
8
9 #include "../UtilitiesAPI.hpp"
10 #include "Unit.hpp"
11
12 namespace openstudio {
13 namespace detail {
14
15 class ThermUnit_Impl;
16
17 } // namespace detail
18
19 /** Structure to hold ThermUnit exponents needed for ThermUnit construction. \relates ThermUnit */
20 struct UTILITIES_API ThermExpnt
21 {
22 public:
23 1226 ThermExpnt(int therm = 0, int t_in = 0, int yr = 0, int R = 0, int A = 0, int cd = 0, int lbmol = 0, int deg = 0, int sr = 0, int people = 0,
24 int cycle = 0, int dollar = 0)
25 1226 : m_therm(therm),
26 1226 m_in(t_in),
27 1226 m_yr(yr),
28 1226 m_R(R),
29 1226 m_A(A),
30 1226 m_cd(cd),
31 1226 m_lbmol(lbmol),
32 1226 m_deg(deg),
33 1226 m_sr(sr),
34 1226 m_people(people),
35 1226 m_cycle(cycle),
36 1226 m_dollar(dollar) {}
37
38 private:
39 int m_therm;
40 int m_in;
41 int m_yr;
42 int m_R;
43 int m_A;
44 int m_cd;
45 int m_lbmol;
46 int m_deg;
47 int m_sr;
48 int m_people;
49 int m_cycle;
50 int m_dollar;
51
52 friend class detail::ThermUnit_Impl;
53 };
54
55 /** ThermUnit is a Unit with baseUnits Btu, ft, h, R, and people.
56 * setBaseUnitExponent throws and exception if any other string is passed in as a
57 * baseUnit. ThermUnit.hpp declares related operators and UnitFactory callback functions. */
58 class UTILITIES_API ThermUnit : public Unit
59 {
60 public:
61 /** @name Constructors and Destructors */
62 //@{
63
64 /** Default constructor. Example: \verbatim
65 ThermUnit myEnergy(ThermExpnt(1));
66 std::cout << myEnergy; // produces "therm" \endverbatim
67 *
68 * \param[in] exponents holds the exponents for each base unit.
69 * \param[in] scaleExponent exponent for scale. For instance 3 for kilo.
70 * \param[in] prettyString optional string to use in place of standardString. */
71 ThermUnit(const ThermExpnt& exponents = ThermExpnt(), int scaleExponent = 0, const std::string& prettyString = "");
72
73 /** Alternate constructor. Specify the abbreviation of the scale, rather than its
74 * exponent.
75 *
76 * \param[in] scaleAbbreviation is string equal to a scale abbreviation. For instance
77 * "k" for kilo.
78 * \param[in] exponents holds the exponents for each base unit.
79 * \param[in] prettyString optional string to use in place of standardString. */
80 ThermUnit(const std::string& scaleAbbreviation, const ThermExpnt& exponents = ThermExpnt(), const std::string& prettyString = "");
81
82 1359 virtual ~ThermUnit() override = default;
83
84 //@}
85 protected:
86 /// @cond
87 using ImplType = detail::ThermUnit_Impl;
88
89 explicit ThermUnit(std::shared_ptr<detail::ThermUnit_Impl> impl);
90
91 friend class Unit;
92 friend class detail::ThermUnit_Impl;
93
94 /// @endcond
95 private:
96 REGISTER_LOGGER("openstudio.units.ThermUnit");
97 };
98
99 /** \relates ThermUnit*/
100 using OptionalThermUnit = boost::optional<ThermUnit>;
101
102 /** \relates ThermUnit*/
103 using ThermUnitVector = std::vector<ThermUnit>;
104
105 /** @name Create Functions Used by UnitFactory */
106 //@{
107
108 /** \relates ThermUnit */
109 UTILITIES_API ThermUnit createThermEnergy();
110 /** \relates ThermUnit */
111 UTILITIES_API ThermUnit createThermLength();
112 /** \relates ThermUnit */
113 UTILITIES_API ThermUnit createThermTime();
114 /** \relates ThermUnit */
115 UTILITIES_API ThermUnit createThermTemperature();
116 /** \relates ThermUnit */
117 UTILITIES_API ThermUnit createThermElectricCurrent();
118 /** \relates ThermUnit */
119 UTILITIES_API ThermUnit createThermLuminousIntensity();
120 /** \relates ThermUnit */
121 UTILITIES_API ThermUnit createThermAmountOfSubstance();
122 /** \relates ThermUnit */
123 UTILITIES_API ThermUnit createThermAngle();
124 /** \relates ThermUnit */
125 UTILITIES_API ThermUnit createThermSolidAngle();
126 /** \relates ThermUnit */
127 UTILITIES_API ThermUnit createThermPeople();
128 /** \relates ThermUnit */
129 UTILITIES_API ThermUnit createThermCycle();
130 /** \relates ThermUnit */
131 UTILITIES_API ThermUnit createThermCurrency();
132
133 /** Lumen (lm) = cd*sr. \relates ThermUnit */
134 UTILITIES_API ThermUnit createThermLuminousFlux();
135
136 //@}
137
138 } // namespace openstudio
139
140 #endif // UTILITIES_UNITS_THERMUNIT_HPP
141