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

#include <CelsiusUnit.hpp>

+ Inheritance diagram for openstudio::CelsiusUnit:

Public Member Functions

Constructors and Destructors
 CelsiusUnit (int CExp=0, int scaleExponent=0, const std::string &prettyString="")
 Default constructor creates an absolute temperature. More...
 
 CelsiusUnit (const std::string &scaleAbbreviation, int CExp=0, const std::string &prettyString="")
 Alternate constructor creates an absolute temperature. More...
 
virtual ~CelsiusUnit ()
 
- Public Member Functions inherited from openstudio::TemperatureUnit
virtual ~TemperatureUnit ()
 
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 ()
 
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 std::vector< CelsiusUnitCelsiusUnitVector
 
typedef boost::optional
< CelsiusUnit
OptionalCelsiusUnit
 
Create Functions Used by UnitFactory
CelsiusUnit createCelsiusTemperature ()
 

Detailed Description

CelsiusUnit is a TemperatureUnit that supports absolute temperatures in degrees Celsius.

Kelvin and Celsius 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 Celsius. Printing out K's as C's in the former situation is a feature that may be added to this library at a later date.

Constructor & Destructor Documentation

openstudio::CelsiusUnit::CelsiusUnit ( int  CExp = 0,
int  scaleExponent = 0,
const std::string &  prettyString = "" 
)

Default constructor creates an absolute temperature.

Parameters
[in]CExpexponent on baseUnit C.
[in]scaleExponentexponent for scale. For instance 3 for kilo.
[in]prettyStringoptional string to use in place of standardString.
openstudio::CelsiusUnit::CelsiusUnit ( const std::string &  scaleAbbreviation,
int  CExp = 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]CExpexponent on baseUnit C.
[in]prettyStringoptional string to use in place of standardString.
virtual openstudio::CelsiusUnit::~CelsiusUnit ( )
inlinevirtual

Friends And Related Function Documentation

typedef std::vector<CelsiusUnit> CelsiusUnitVector
related
CelsiusUnit createCelsiusTemperature ( )
related
typedef boost::optional<CelsiusUnit> OptionalCelsiusUnit
related