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/Misc1Unit.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_MISC1UNIT_HPP
7 #define UTILITIES_UNITS_MISC1UNIT_HPP
8
9 #include "../UtilitiesAPI.hpp"
10 #include "Unit.hpp"
11
12 namespace openstudio {
13 namespace detail {
14
15 class Misc1Unit_Impl;
16
17 } // namespace detail
18
19 /** Structure to hold Misc1Unit exponents needed for Misc1Unit construction. For purposes of
20 * conversion we need a length base unit. Therefore, gal cannot be a base unit. For convenience
21 * of construction, Misc1Expnt takes a gal argument, but subsequently this is stored as a power of
22 * cube root of gallons (crgal). \relates Misc1Unit */
23 struct UTILITIES_API Misc1Expnt
24 {
25 public:
26 1351 Misc1Expnt(int ftH2O = 0, int L = 0, int day = 0, int K = 0, int A = 0, int cd = 0, int mol = 0, int rad = 0, int sr = 0, int people = 0,
27 int cycle = 0, int dollar = 0)
28 1351 : m_ftH2O(ftH2O),
29 1351 m_crL(3 * L),
30 1351 m_day(day),
31 1351 m_K(K),
32 1351 m_A(A),
33 1351 m_cd(cd),
34 1351 m_mol(mol),
35 1351 m_rad(rad),
36 1351 m_sr(sr),
37 1351 m_people(people),
38 1351 m_cycle(cycle),
39 1351 m_dollar(dollar) {}
40
41 private:
42 int m_ftH2O;
43 int m_crL;
44 int m_day;
45 int m_K;
46 int m_A;
47 int m_cd;
48 int m_mol;
49 int m_rad;
50 int m_sr;
51 int m_people;
52 int m_cycle;
53 int m_dollar;
54
55 friend class detail::Misc1Unit_Impl;
56 };
57
58 /** Misc1Unit is a Unit with baseUnits fixed by its constructors, see Misc1Expnt. setBaseUnitExponent
59 * throws an exception if any other string is passed in as a baseUnit. Misc1Unit.hpp declares
60 * related operators and UnitFactory callback functions. */
61 class UTILITIES_API Misc1Unit : public Unit
62 {
63 public:
64 /** @name Constructors and Destructors */
65 //@{
66
67 /** Default constructor.
68 *
69 * \param[in] exponents holds the exponents for each base unit.
70 * \param[in] scaleExponent exponent for scale. For instance 3 for kilo.
71 * \param[in] prettyString optional string to use in place of standardString. */
72 Misc1Unit(const Misc1Expnt& exponents = Misc1Expnt(), int scaleExponent = 0, const std::string& prettyString = "");
73
74 /** Alternate constructor. Specify the abbreviation of the scale, rather than its
75 * exponent.
76 *
77 * \param[in] scaleAbbreviation is string equal to a scale abbreviation. For instance
78 * "k" for kilo.
79 * \param[in] exponents holds the exponents for each base unit.
80 * \param[in] prettyString optional string to use in place of standardString. */
81 Misc1Unit(const std::string& scaleAbbreviation, const Misc1Expnt& exponents = Misc1Expnt(), const std::string& prettyString = "");
82
83 1594 virtual ~Misc1Unit() override = default;
84
85 //@}
86 protected:
87 /// @cond
88 using ImplType = detail::Misc1Unit_Impl;
89
90 explicit Misc1Unit(std::shared_ptr<detail::Misc1Unit_Impl> impl);
91
92 friend class Unit;
93 friend class detail::Misc1Unit_Impl;
94 /// @endcond
95 private:
96 REGISTER_LOGGER("openstudio.units.Misc1Unit");
97 };
98
99 /** \relates Misc1Unit*/
100 using OptionalMisc1Unit = boost::optional<Misc1Unit>;
101
102 /** \relates Misc1Unit*/
103 using Misc1UnitVector = std::vector<Misc1Unit>;
104
105 /** @name Create Functions Used by UnitFactory */
106 //@{
107
108 // base units
109
110 /** \relates Misc1Unit */
111 UTILITIES_API Misc1Unit createMisc1Pressure();
112 /** \relates Misc1Unit */
113 UTILITIES_API Misc1Unit createMisc1Length();
114 /** \relates Misc1Unit */
115 UTILITIES_API Misc1Unit createMisc1Time();
116 /** \relates Misc1Unit */
117 UTILITIES_API Misc1Unit createMisc1Temperature();
118 /** \relates Misc1Unit */
119 UTILITIES_API Misc1Unit createMisc1ElectricCurrent();
120 /** \relates Misc1Unit */
121 UTILITIES_API Misc1Unit createMisc1LuminousIntensity();
122 /** \relates Misc1Unit */
123 UTILITIES_API Misc1Unit createMisc1AmountOfSubstance();
124 /** \relates Misc1Unit */
125 UTILITIES_API Misc1Unit createMisc1Angle();
126 /** \relates Misc1Unit */
127 UTILITIES_API Misc1Unit createMisc1SolidAngle();
128 /** \relates Misc1Unit */
129 UTILITIES_API Misc1Unit createMisc1People();
130 /** relates Misc1Unit */
131 UTILITIES_API Misc1Unit createMisc1Cycle();
132 /** relates Misc1Unit */
133 UTILITIES_API Misc1Unit createMisc1Currency();
134
135 // first order derived units
136
137 /** Liters (L). \relates Misc1Unit */
138 UTILITIES_API Misc1Unit createMisc1Volume();
139 /** Lumen (lm) = cd*sr. \relates Misc1Unit */
140 UTILITIES_API Misc1Unit createMisc1LuminousFlux();
141
142 //@}
143 } // namespace openstudio
144
145 #endif // UTILITIES_UNITS_MISC1UNIT_HPP
146