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

#include <FahrenheitUnit.hpp>

+ Inheritance diagram for openstudio::FahrenheitUnit:

Public Member Functions

Constructors and Destructors
 FahrenheitUnit (int FExp=0, int scaleExponent=0, const std::string &prettyString="")
 Default constructor creates an absolute temperature. More...
 
 FahrenheitUnit (const std::string &scaleAbbreviation, int FExp=0, const std::string &prettyString="")
 Alternate constructor creates an absolute temperature. More...
 
virtual ~FahrenheitUnit ()=default
 
Mathematical Operators
FahrenheitUnitoperator/= (const FahrenheitUnit &rUnit)
 
- Public Member Functions inherited from openstudio::TemperatureUnit
virtual ~TemperatureUnit ()=default
 
bool isAbsolute () const
 
void setAsAbsolute ()
 
void setAsRelative ()
 
- 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 ()=default
 
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.)

using FahrenheitUnitVector = std::vector< FahrenheitUnit >
 
using OptionalFahrenheitUnit = boost::optional< FahrenheitUnit >
 
Create Functions Used by UnitFactory
FahrenheitUnit createFahrenheitTemperature ()
 

Detailed Description

FahrenheitUnit is a TemperatureUnit that supports absolute temperatures in degrees Fahrenheit.

Rankine and Fahrenheit are the same in situations of relative temperature, that is, when it is the difference in temperatures that matter, rather than the absolute value. This is normally the case when the temperature base unit shows up in combination with other units, and that is not the situation being addressed here. This class is for reporting actual temperatures in degrees Fahrenheit. Printing out R's as F's in the former situation is a feature that may be added to this library at a later date.

Constructor & Destructor Documentation

openstudio::FahrenheitUnit::FahrenheitUnit ( int  FExp = 0,
int  scaleExponent = 0,
const std::string &  prettyString = "" 
)

Default constructor creates an absolute temperature.

Parameters
[in]FExpexponent on baseUnit F.
[in]scaleExponentexponent for scale. For instance 3 for kilo.
[in]prettyStringoptional string to use in place of standardString.
openstudio::FahrenheitUnit::FahrenheitUnit ( const std::string &  scaleAbbreviation,
int  FExp = 0,
const std::string &  prettyString = "" 
)

Alternate constructor creates an absolute temperature.

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]FExpexponent on baseUnit F.
[in]prettyStringoptional string to use in place of standardString.
virtual openstudio::FahrenheitUnit::~FahrenheitUnit ( )
virtualdefault

Member Function Documentation

FahrenheitUnit& openstudio::FahrenheitUnit::operator/= ( const FahrenheitUnit rUnit)

Friends And Related Function Documentation

FahrenheitUnit createFahrenheitTemperature ( )
related
using FahrenheitUnitVector = std::vector<FahrenheitUnit>
related
using OptionalFahrenheitUnit = boost::optional<FahrenheitUnit>
related