本文整理汇总了C++中OptionalQuantity::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionalQuantity::setValue方法的具体用法?C++ OptionalQuantity::setValue怎么用?C++ OptionalQuantity::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionalQuantity
的用法示例。
在下文中一共展示了OptionalQuantity::setValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convert
TEST_F(IdfFixture, IdfObject_GetQuantity)
{
std::string text = "Building, !- Building \n\
Building, !- Name \n\
30., !- North Axis {deg} \n\
City, !- Terrain \n\
0.04, !- Loads Convergence Tolerance Value \n\
0.4, !- Temperature Convergence Tolerance Value {deltaC} \n\
FullExterior, !- Solar Distribution \n\
25; !- Maximum Number of Warmup Days";
// make an idf object
OptionalIdfObject oObj = IdfObject::load(text);
ASSERT_TRUE(oObj);
// Test get.
OSOptionalQuantity ooq = oObj->getQuantity (4);
ASSERT_TRUE(ooq.isSet());
Quantity q = ooq.get();
EXPECT_TRUE(q.value() == 0.4);
EXPECT_TRUE(q.system() == UnitSystem::SI);
EXPECT_TRUE(q.standardUnitsString() == "K");
// Test set.
OptionalQuantity oq = convert(q,UnitSystem(UnitSystem::IP));
ASSERT_TRUE(oq);
EXPECT_TRUE(oq->system() == UnitSystem::IP);
EXPECT_DOUBLE_EQ(0.72,oq->value());
oq->setValue(1.5);
EXPECT_TRUE(oObj->setQuantity(4, *oq));
ooq = oObj->getQuantity(4);
ASSERT_TRUE(ooq.isSet());
q = ooq.get();
EXPECT_DOUBLE_EQ(0.83333333333333333,q.value());
EXPECT_TRUE(q.system() == UnitSystem::SI);
EXPECT_TRUE(q.standardUnitsString() == "K");
}