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

#include <ScaleFactory.hpp>

Public Member Functions

ScaleConstant createScale (int exponent) const
 Creates a scale from an exponent. More...
 
ScaleConstant createScale (const std::string &abbr) const
 Creates a scale from an abbreviation. More...
 
std::vector< ScaleregisteredScales ()
 Returns a vector of Scale objects, one for each scale registered in the factory. More...
 
bool registerScale (ScaleConstant scale)
 Store a scale callback function for future lookup using the scale exponent or abbreviation. More...
 
 ~ScaleFactorySingleton ()
 Destructor. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const ScaleFactorySingleton &factory)
 Outputs the scales registered in the factory. More...
 

Detailed Description

Singleton that creates scales based on std::string or exponent.

Access using ScaleFactory::instance().

Constructor & Destructor Documentation

openstudio::ScaleFactorySingleton::~ScaleFactorySingleton ( )

Destructor.

Member Function Documentation

ScaleConstant openstudio::ScaleFactorySingleton::createScale ( int  exponent) const

Creates a scale from an exponent.

Throws if the factory does not have any scales registered. Returns ScaleConstant with ().value == 0.0 if exponent not in factory.

ScaleConstant openstudio::ScaleFactorySingleton::createScale ( const std::string &  abbr) const

Creates a scale from an abbreviation.

Throws if the factory does not have any scales registered. Returns ScaleConstant with ().value == 0.0 if abbr not in factory.

std::vector<Scale> openstudio::ScaleFactorySingleton::registeredScales ( )

Returns a vector of Scale objects, one for each scale registered in the factory.

bool openstudio::ScaleFactorySingleton::registerScale ( ScaleConstant  scale)

Store a scale callback function for future lookup using the scale exponent or abbreviation.

By default, SI scales are registered during factory construction.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const ScaleFactorySingleton factory 
)
friend

Outputs the scales registered in the factory.