#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< Scale > | registeredScales () |
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 ()=default | |
Destructor. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const ScaleFactorySingleton &factory) |
Outputs the scales registered in the factory. More... | |
Singleton that creates scales based on std::string or exponent.
Access using ScaleFactory::instance().
|
default |
Destructor.
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.
|
friend |
Outputs the scales registered in the factory.