OpenStudio:utilities
Loading...
Searching...
No Matches
openstudio::MPHUnit Class Reference

#include <MPHUnit.hpp>

+ Inheritance diagram for openstudio::MPHUnit:

Related Symbols

(Note that these are not member symbols.)

using MPHUnitVector = std::vector<MPHUnit>
 
using OptionalMPHUnit = boost::optional<MPHUnit>
 
Create Functions Used by UnitFactory
MPHUnit createMPHPressure ()
 
MPHUnit createMPHLength ()
 
MPHUnit createMPHTime ()
 
MPHUnit createMPHTemperature ()
 
MPHUnit createMPHElectricCurrent ()
 
MPHUnit createMPHLuminousIntensity ()
 
MPHUnit createMPHAmountOfSubstance ()
 
MPHUnit createMPHAngle ()
 
MPHUnit createMPHSolidAngle ()
 
MPHUnit createMPHPeople ()
 
MPHUnit createMPHCycle ()
 
MPHUnit createMPHCurrency ()
 
MPHUnit createMPHVelocity ()
 Miles per hour (mph) = mi/h.
 
MPHUnit createMPHLuminousFlux ()
 Lumen (lm) = cd*sr.
 

Constructors and Destructors

 MPHUnit (const MPHExpnt &exponents=MPHExpnt(), int scaleExponent=0, const std::string &prettyString="")
 Default constructor.
 
 MPHUnit (const std::string &scaleAbbreviation, const MPHExpnt &exponents=MPHExpnt(), const std::string &prettyString="")
 Alternate constructor.
 
virtual ~MPHUnit () override=default
 

Additional Inherited Members

- Public Member Functions inherited from openstudio::Unit
 Unit (int scaleExponent=0, const std::string &prettyString="")
 Default constructor.
 
 Unit (const std::string &scaleAbbreviation, const std::string &prettyString="")
 Constructor using scale abbreviations registered in ScaleFactory.
 
virtual ~Unit ()=default
 
Unit clone () const
 Deep copy constructor.
 
Unit cloneToMixed () const
 Deep copy constructor that discards system designation.
 
std::vector< std::string > baseUnits () const
 Returns base units already available in Unit.
 
bool isBaseUnit (const std::string &baseUnit) const
 Returns true if baseUnit is available in Unit.
 
int baseUnitExponent (const std::string &baseUnit) const
 Base unit exponent getter. Returns 0 if baseUnit not present. *‍/.
 
void setBaseUnitExponent (const std::string &baseUnit, int exponent)
 Sets baseUnit^exponent. If baseUnit not yet present, is added and return value is true.
 
Scale scale () const
 Scale getter.
 
bool setScale (int scaleExponent)
 Sets the scale to the one registered in ScaleFactory for 10^scaleExponent.
 
bool setScale (const std::string &scaleAbbreviation)
 Sets the scale to the one registered in ScaleFactory under scaleAbbreviation.
 
std::string standardString (bool withScale=true) const
 Returns the standard output string for this unit.
 
std::string prettyString (bool withScale=true) const
 Returns the preferred output string for this unit.
 
void setPrettyString (const std::string &str)
 Setter for prettyString (do not include scale abbreviation).
 
std::string print (bool withScale=true) const
 Returns prettyString(withScale) if it exists; otherwise returns standardString(withScale).
 
UnitSystem system () const
 Getter for this Unit's system.
 
bool operator== (const Unit &rUnit) const
 Equality for units.
 
Unitoperator*= (const Unit &rUnit)
 Multiply-assign operator.
 
Unitoperator/= (const Unit &rUnit)
 Divide-assign operator.
 
Unitpow (int expNum, int expDenom=1, bool okToCallFactory=true)
 Raise Unit to a rational power.
 
template<typename T >
cast () const
 Cast to type T.
 
template<typename T >
boost::optional< T > optionalCast () const
 Cast to boost::optional<T>.
 

Detailed Description

MPHUnit is a Unit with baseUnits fixed by its constructors, see MPHExpnt.

setBaseUnitExponent throws an exception if any other string is passed in as a baseUnit. MPHUnit.hpp declares related operators and UnitFactory callback functions.

Constructor & Destructor Documentation

◆ MPHUnit() [1/2]

openstudio::MPHUnit::MPHUnit ( const MPHExpnt & exponents = MPHExpnt(),
int scaleExponent = 0,
const std::string & prettyString = "" )

Default constructor.

Parameters
[in]exponentsholds the exponents for each base unit.
[in]scaleExponentexponent for scale. For instance 3 for kilo.
[in]prettyStringoptional string to use in place of standardString.

◆ MPHUnit() [2/2]

openstudio::MPHUnit::MPHUnit ( const std::string & scaleAbbreviation,
const MPHExpnt & exponents = MPHExpnt(),
const std::string & prettyString = "" )

Alternate constructor.

Specify the abbreviation of the scale, rather than its exponent.

Parameters
[in]scaleAbbreviationis string equal to a scale abbreviation. For instance "k" for kilo.
[in]exponentsholds the exponents for each base unit.
[in]prettyStringoptional string to use in place of standardString.

◆ ~MPHUnit()

virtual openstudio::MPHUnit::~MPHUnit ( )
overridevirtualdefault

Friends And Related Symbol Documentation

◆ createMPHAmountOfSubstance()

MPHUnit createMPHAmountOfSubstance ( )
related

◆ createMPHAngle()

MPHUnit createMPHAngle ( )
related

◆ createMPHCurrency()

MPHUnit createMPHCurrency ( )
related

◆ createMPHCycle()

MPHUnit createMPHCycle ( )
related

◆ createMPHElectricCurrent()

MPHUnit createMPHElectricCurrent ( )
related

◆ createMPHLength()

MPHUnit createMPHLength ( )
related

◆ createMPHLuminousFlux()

MPHUnit createMPHLuminousFlux ( )
related

Lumen (lm) = cd*sr.

◆ createMPHLuminousIntensity()

MPHUnit createMPHLuminousIntensity ( )
related

◆ createMPHPeople()

MPHUnit createMPHPeople ( )
related

◆ createMPHPressure()

MPHUnit createMPHPressure ( )
related

◆ createMPHSolidAngle()

MPHUnit createMPHSolidAngle ( )
related

◆ createMPHTemperature()

MPHUnit createMPHTemperature ( )
related

◆ createMPHTime()

MPHUnit createMPHTime ( )
related

◆ createMPHVelocity()

MPHUnit createMPHVelocity ( )
related

Miles per hour (mph) = mi/h.

◆ MPHUnitVector

using MPHUnitVector = std::vector<MPHUnit>
related

◆ OptionalMPHUnit

using OptionalMPHUnit = boost::optional<MPHUnit>
related