MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / valueAsDouble

Method valueAsDouble

src/measure/OSArgument.cpp:152–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150 }
151
152 double OSArgument::valueAsDouble() const {
153 if (!hasValue()) {
154 LOG_AND_THROW("This argument does not have a value set.")
155 }
156 if ((type() != OSArgumentType::Double) && (type() != OSArgumentType::Integer)) {
157 LOG_AND_THROW("This argument is of type " << type().valueName() << ", not of type Double.");
158 }
159
160 double result = 0.0;
161 if (type() == OSArgumentType::Double) {
162 result = std::get<double>(m_value);
163 } else {
164 result = std::get<int>(m_value);
165 LOG(Warn, "This argument is of type 'Integer' but returning as a Double as requested. You should consider using valueAsInteger instead");
166 }
167
168 return result;
169 }
170
171 int OSArgument::valueAsInteger() const {
172 if (!hasValue()) {

Callers 11

measure_hashMethod · 0.45
test_attributeMethod · 0.45
addAttributesMethod · 0.45
getBSDFMethod · 0.45
validateUserArgumentsMethod · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
applyArgumentsMethod · 0.45
outputAttributesToJSONFunction · 0.45

Calls 2

valueNameMethod · 0.80
typeFunction · 0.50

Tested by 3

test_attributeMethod · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36