src/utilities/units/CFMUnit.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_CFMUNIT_HPP | ||
| 7 | #define UTILITIES_UNITS_CFMUNIT_HPP | ||
| 8 | |||
| 9 | #include "../UtilitiesAPI.hpp" | ||
| 10 | #include "Unit.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | namespace detail { | ||
| 14 | |||
| 15 | class CFMUnit_Impl; | ||
| 16 | |||
| 17 | } // namespace detail | ||
| 18 | |||
| 19 | /** Structure to hold CFMUnit exponents needed for CFMUnit construction. \relates CFMUnit */ | ||
| 20 | struct UTILITIES_API CFMExpnt | ||
| 21 | { | ||
| 22 | public: | ||
| 23 | 1644 | CFMExpnt(int ft = 0, int min = 0, int ton = 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 | 1644 | : m_ft(ft), | |
| 26 | 1644 | m_min(min), | |
| 27 | 1644 | m_ton(ton), | |
| 28 | 1644 | m_R(R), | |
| 29 | 1644 | m_A(A), | |
| 30 | 1644 | m_cd(cd), | |
| 31 | 1644 | m_lbmol(lbmol), | |
| 32 | 1644 | m_deg(deg), | |
| 33 | 1644 | m_sr(sr), | |
| 34 | 1644 | m_people(people), | |
| 35 | 1644 | m_cycle(cycle), | |
| 36 | 1644 | m_dollar(dollar) {} | |
| 37 | |||
| 38 | private: | ||
| 39 | int m_ft; | ||
| 40 | int m_min; | ||
| 41 | int m_ton; | ||
| 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::CFMUnit_Impl; | ||
| 53 | }; | ||
| 54 | |||
| 55 | /** CFMUnit is a Unit with baseUnits fixed by its constructors, see CFMExpnt. | ||
| 56 | * setBaseUnitExponent throws an exception if any other string is passed in as a | ||
| 57 | * baseUnit. CFMUnit.hpp declares related operators and UnitFactory callback functions. | ||
| 58 | */ | ||
| 59 | class UTILITIES_API CFMUnit : public Unit | ||
| 60 | { | ||
| 61 | public: | ||
| 62 | /** @name Constructors and Destructors */ | ||
| 63 | //@{ | ||
| 64 | |||
| 65 | /** Default constructor. Example: \verbatim | ||
| 66 | CFMUnit myPower(CFMExpnt(0,0,1)); | ||
| 67 | std::cout << myPower; // produces "ton" \endverbatim | ||
| 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 | CFMUnit(const CFMExpnt& exponents = CFMExpnt(), 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 | CFMUnit(const std::string& scaleAbbreviation, const CFMExpnt& exponents = CFMExpnt(), const std::string& prettyString = ""); | ||
| 82 | |||
| 83 | 2565 | virtual ~CFMUnit() override = default; | |
| 84 | |||
| 85 | //@} | ||
| 86 | protected: | ||
| 87 | /// @cond | ||
| 88 | using ImplType = detail::CFMUnit_Impl; | ||
| 89 | |||
| 90 | explicit CFMUnit(std::shared_ptr<detail::CFMUnit_Impl> impl); | ||
| 91 | |||
| 92 | friend class Unit; | ||
| 93 | friend class detail::CFMUnit_Impl; | ||
| 94 | |||
| 95 | /// @endcond | ||
| 96 | private: | ||
| 97 | REGISTER_LOGGER("openstudio.units.CFMUnit"); | ||
| 98 | }; | ||
| 99 | |||
| 100 | /** \relates CFMUnit*/ | ||
| 101 | using OptionalCFMUnit = boost::optional<CFMUnit>; | ||
| 102 | |||
| 103 | /** \relates CFMUnit*/ | ||
| 104 | using CFMUnitVector = std::vector<CFMUnit>; | ||
| 105 | |||
| 106 | /** @name Create Functions Used by UnitFactory */ | ||
| 107 | //@{ | ||
| 108 | |||
| 109 | /** \relates CFMUnit */ | ||
| 110 | UTILITIES_API CFMUnit createCFMLength(); | ||
| 111 | /** \relates CFMUnit */ | ||
| 112 | UTILITIES_API CFMUnit createCFMTime(); | ||
| 113 | /** \relates CFMUnit */ | ||
| 114 | UTILITIES_API CFMUnit createCFMPower(); | ||
| 115 | /** \relates CFMUnit */ | ||
| 116 | UTILITIES_API CFMUnit createCFMTemperature(); | ||
| 117 | /** \relates CFMUnit */ | ||
| 118 | UTILITIES_API CFMUnit createCFMElectricCurrent(); | ||
| 119 | /** \relates CFMUnit */ | ||
| 120 | UTILITIES_API CFMUnit createCFMLuminousIntensity(); | ||
| 121 | /** \relates CFMUnit */ | ||
| 122 | UTILITIES_API CFMUnit createCFMAmountOfSubstance(); | ||
| 123 | /** \relates CFMUnit */ | ||
| 124 | UTILITIES_API CFMUnit createCFMAngle(); | ||
| 125 | /** \relates CFMUnit */ | ||
| 126 | UTILITIES_API CFMUnit createCFMSolidAngle(); | ||
| 127 | /** \relates CFMUnit */ | ||
| 128 | UTILITIES_API CFMUnit createCFMPeople(); | ||
| 129 | /** \relates CFMUnit */ | ||
| 130 | UTILITIES_API CFMUnit createCFMCycle(); | ||
| 131 | /** \relates CFMUnit */ | ||
| 132 | UTILITIES_API CFMUnit createCFMCurrency(); | ||
| 133 | |||
| 134 | /** Cubic feet per minute (cfm) = ft^3/min. \relates CFMUnit */ | ||
| 135 | UTILITIES_API CFMUnit createCFMVolumetricFlowrate(); | ||
| 136 | /** Lumen (lm) = cd*sr. \relates CFMUnit */ | ||
| 137 | UTILITIES_API CFMUnit createCFMLuminousFlux(); | ||
| 138 | /** Foot-candles (fc) = lm/ft^2 = cd*sr/ft^2. \relates CFMUnit */ | ||
| 139 | UTILITIES_API CFMUnit createCFMIlluminance(); | ||
| 140 | /** Rotations per minute (rpm) = cycles/min. \relates CFMUnit */ | ||
| 141 | UTILITIES_API CFMUnit createCFMFrequency(); | ||
| 142 | |||
| 143 | //@} | ||
| 144 | |||
| 145 | } // namespace openstudio | ||
| 146 | |||
| 147 | #endif // UTILITIES_UNITS_CFMUNIT_HPP | ||
| 148 |