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

#include <OSOptionalQuantity.hpp>

Public Member Functions

Constructors and Destructors
 OSOptionalQuantity (const UnitSystem &sys=UnitSystem::Mixed)
 
 OSOptionalQuantity (const Unit &units)
 
 OSOptionalQuantity (const Quantity &quantity)
 
 OSOptionalQuantity (const OSOptionalQuantity &oq)
 
OSOptionalQuantityoperator= (const OSOptionalQuantity &oq)
 
Getters and Queries
bool empty () const
 Returns true if there is no value. More...
 
bool isSet () const
 Returns true if there is a value. More...
 
Quantity get () const
 Returns the corresponding Quantity. More...
 
Unit units () const
 Returns a clone of this object's units. More...
 

Detailed Description

OSOptionalQuantity class to be used in OpenStudio ModelObject properties.

Always contains a Unit. Optionally contains a value. The constructors and assignment operator ensure that this class behaves as "plain old data" (POD) by cloning any units information (to avoid multiple objects pointing to the exact same unit data).

Constructor & Destructor Documentation

openstudio::OSOptionalQuantity::OSOptionalQuantity ( const UnitSystem sys = UnitSystem::Mixed)
explicit
openstudio::OSOptionalQuantity::OSOptionalQuantity ( const Unit units)
explicit
openstudio::OSOptionalQuantity::OSOptionalQuantity ( const Quantity quantity)
openstudio::OSOptionalQuantity::OSOptionalQuantity ( const OSOptionalQuantity oq)

Member Function Documentation

bool openstudio::OSOptionalQuantity::empty ( ) const

Returns true if there is no value.

Quantity openstudio::OSOptionalQuantity::get ( ) const

Returns the corresponding Quantity.

Throws if empty().

bool openstudio::OSOptionalQuantity::isSet ( ) const

Returns true if there is a value.

OSOptionalQuantity& openstudio::OSOptionalQuantity::operator= ( const OSOptionalQuantity oq)
Unit openstudio::OSOptionalQuantity::units ( ) const

Returns a clone of this object's units.