本文整理汇总了C++中Site::name方法的典型用法代码示例。如果您正苦于以下问题:C++ Site::name方法的具体用法?C++ Site::name怎么用?C++ Site::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createAndRegisterIdfObject
boost::optional<IdfObject> ForwardTranslator::translateSite( Site & modelObject )
{
IdfObject site = createAndRegisterIdfObject(openstudio::IddObjectType::Site_Location,
modelObject);
OptionalString optS = modelObject.name();
if(optS) {
site.setName(*optS);
}
OptionalDouble od = modelObject.latitude();
if(od) {
site.setDouble(Site_LocationFields::Latitude, *od);
}
od = modelObject.longitude();
if(od) {
site.setDouble(Site_LocationFields::Longitude, *od);
}
od = modelObject.timeZone();
if(od) {
site.setDouble(Site_LocationFields::TimeZone, *od);
}
od = modelObject.elevation();
if(od) {
site.setDouble(Site_LocationFields::Elevation, *od);
}
// translate shading groups
ShadingSurfaceGroupVector shadingSurfaceGroups = modelObject.shadingSurfaceGroups();
std::sort(shadingSurfaceGroups.begin(), shadingSurfaceGroups.end(), WorkspaceObjectNameLess());
for (ShadingSurfaceGroup& shadingSurfaceGroup : shadingSurfaceGroups){
translateAndMapModelObject(shadingSurfaceGroup);
}
return boost::optional<IdfObject>(site);
}
示例2:
TEST_F(TestSite, Site)
{
Site s = Site::create(m_engine, "test");
ASSERT_TRUE(s);
EXPECT_EQ(string("test"), s.name());
EXPECT_EQ(m_engine, s.engine());
EXPECT_TRUE(s.memory_pool());
Location l = s.create_default_location();
EXPECT_EQ(l, s.default_location());
s.add_ip("1.2.3.4");
EXPECT_EQ(1UL, s.ips().size());
EXPECT_EQ(string("1.2.3.4"), s.ips().front());
s.add_host("foo");
EXPECT_EQ(1UL, s.hosts().size());
EXPECT_EQ(string("foo"), s.hosts().front());
l = s.create_location("/foo");
EXPECT_EQ(1UL, s.locations().size());
EXPECT_EQ(l, s.locations().front());
}