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

#include <TemperatureUnit.hpp>

+ Inheritance diagram for openstudio::TemperatureUnit:

Public Member Functions

Constructors and Destructors
virtual ~TemperatureUnit () override=default
 
Mathematical Operators
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 OptionalTemperatureUnit = boost::optional< TemperatureUnit >
 
using TemperatureUnitVector = std::vector< TemperatureUnit >
 

Detailed Description

TemperatureUnit is an abstract Unit for handling temperatures.

Temperatures can be absolute or relative. The temperature of a material is absolute temperature. Temperature differences are relative temperatures. In the former case C != K (F != R), but in the latter, C == K (F == R).

There are no public constructors, because this is an abstract class. By default, derived classes should set absoute=true. Temperatures that start as relative should be handled by regular Unit classes.

Constructor & Destructor Documentation

virtual openstudio::TemperatureUnit::~TemperatureUnit ( )
overridevirtualdefault

Member Function Documentation

bool openstudio::TemperatureUnit::isAbsolute ( ) const
void openstudio::TemperatureUnit::setAsAbsolute ( )
void openstudio::TemperatureUnit::setAsRelative ( )

Friends And Related Function Documentation

using OptionalTemperatureUnit = boost::optional<TemperatureUnit>
related
using TemperatureUnitVector = std::vector<TemperatureUnit>
related