OpenStudio:utilities
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Related Functions | List of all members
openstudio::ThermUnit Class Reference

#include <ThermUnit.hpp>

+ Inheritance diagram for openstudio::ThermUnit:

Public Member Functions

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

Related Functions

(Note that these are not member functions.)

typedef boost::optional
< ThermUnit
OptionalThermUnit
 
typedef std::vector< ThermUnitThermUnitVector
 
Create Functions Used by UnitFactory
ThermUnit createThermEnergy ()
 
ThermUnit createThermLength ()
 
ThermUnit createThermTime ()
 
ThermUnit createThermTemperature ()
 
ThermUnit createThermElectricCurrent ()
 
ThermUnit createThermLuminousIntensity ()
 
ThermUnit createThermAmountOfSubstance ()
 
ThermUnit createThermAngle ()
 
ThermUnit createThermSolidAngle ()
 
ThermUnit createThermPeople ()
 
ThermUnit createThermCycle ()
 
ThermUnit createThermCurrency ()
 
ThermUnit createThermLuminousFlux ()
 Lumen (lm) = cd*sr. More...
 

Detailed Description

ThermUnit is a Unit with baseUnits Btu, ft, h, R, and people.

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

Constructor & Destructor Documentation

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

Default constructor.

Example:

ThermUnit myEnergy(ThermExpnt(1));
std::cout << myEnergy; // produces "therm" 
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.
openstudio::ThermUnit::ThermUnit ( const std::string &  scaleAbbreviation,
const ThermExpnt exponents = ThermExpnt(),
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.
virtual openstudio::ThermUnit::~ThermUnit ( )
inlinevirtual

Friends And Related Function Documentation

ThermUnit createThermAmountOfSubstance ( )
related
ThermUnit createThermAngle ( )
related
ThermUnit createThermCurrency ( )
related
ThermUnit createThermCycle ( )
related
ThermUnit createThermElectricCurrent ( )
related
ThermUnit createThermEnergy ( )
related
ThermUnit createThermLength ( )
related
ThermUnit createThermLuminousFlux ( )
related

Lumen (lm) = cd*sr.

ThermUnit createThermLuminousIntensity ( )
related
ThermUnit createThermPeople ( )
related
ThermUnit createThermSolidAngle ( )
related
ThermUnit createThermTemperature ( )
related
ThermUnit createThermTime ( )
related
typedef boost::optional<ThermUnit> OptionalThermUnit
related
typedef std::vector<ThermUnit> ThermUnitVector
related