当前位置: 首页>>代码示例>>C++>>正文


C++ IdfExtensibleGroup::empty方法代码示例

本文整理汇总了C++中IdfExtensibleGroup::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ IdfExtensibleGroup::empty方法的具体用法?C++ IdfExtensibleGroup::empty怎么用?C++ IdfExtensibleGroup::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IdfExtensibleGroup的用法示例。


在下文中一共展示了IdfExtensibleGroup::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setYearEscalation

bool LifeCycleCostUsePriceEscalation_Impl::setYearEscalation(unsigned index, double num) {
  IdfExtensibleGroup eg = getExtensibleGroup(index);
  if (!eg.empty()) {
    return eg.setDouble(OS_LifeCycleCost_UsePriceEscalationExtensibleFields::YearEscalation,num);
  }
  else {
    StringVector values(1u);
    eg = insertExtensibleGroup(index,values);
    if (!eg.empty()) { 
      return eg.setDouble(OS_LifeCycleCost_UsePriceEscalationExtensibleFields::YearEscalation,num);
    }
  }
  return false;
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:14,代码来源:LifeCycleCostUsePriceEscalation.cpp

示例2: getExtensibleGroup

boost::optional<std::string> UtilityCost_Computation_Impl::computeStep(unsigned index) const {
  IdfExtensibleGroup eg = getExtensibleGroup(index);
  if (!eg.empty()) {
    return eg.getString(OS_UtilityCost_ComputationExtensibleFields::ComputeStep,true);
  }
  return boost::none;
}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:7,代码来源:UtilityCost_Computation.cpp

示例3: designDay

TEST_F(ModelFixture, ComponentWatcher_InComponent) {
  // create Component. ComponentWatcher should work here too (since Component is Model)
  Model model;
  DesignDay designDay(model);
  EXPECT_EQ(1u,model.numObjects());
  Component designDayComponent = designDay.createComponent();
  EXPECT_EQ(2u,designDayComponent.numObjects());
  ComponentData cd = designDayComponent.componentData();
  UUID versionUUID = cd.versionUUID();
  designDay = designDayComponent.primaryObject().cast<DesignDay>();

  // data changes ok--changes version
  EXPECT_TRUE(designDay.setName("My Design Day"));
  EXPECT_NE(versionUUID,cd.versionUUID());
  versionUUID = cd.versionUUID();

  // trying to assign contents results in refresh of contents
  IdfExtensibleGroup eg = cd.getExtensibleGroup(0);
  ASSERT_FALSE(eg.empty());
  std::string originalValue = eg.getString(0).get();
  EXPECT_FALSE(eg.setString(0,"Material"));
  EXPECT_TRUE(cd.initialized());
  EXPECT_EQ(2u,designDayComponent.numObjects());
  EXPECT_EQ(originalValue,eg.getString(0).get());
}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:25,代码来源:Component_GTest.cpp

示例4: getExtensibleGroup

boost::optional<std::string> UtilityCost_Charge_Block_Impl::blockCostPerUnitValueOrVariableName(unsigned index) const {
  IdfExtensibleGroup eg = getExtensibleGroup(index);
  if (!eg.empty()) {
    return eg.getString(OS_UtilityCost_Charge_BlockExtensibleFields::BlockCostperUnitValueorVariableName,true);
  }
  return boost::none;
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:7,代码来源:UtilityCost_Charge_Block.cpp

示例5: insertLayer

  bool LayeredConstruction_Impl::insertLayer(unsigned layerIndex, 
                                             const Material& material) 
  {
    OS_ASSERT(material.model() == model());
    layerIndex = mf_clearNullLayers(layerIndex);

    unsigned n = numLayers();
    MaterialVector layers = this->layers();
    MaterialVector::iterator layersBegin = layers.begin();
    MaterialVector::iterator layersEnd = layers.end();
    MaterialVector::iterator insertAtIt = layersBegin;
    while ((static_cast<unsigned>(insertAtIt - layersBegin) < layerIndex) &&
           (insertAtIt != layersEnd)) 
    { ++insertAtIt; }
    layers.insert(insertAtIt, material);
    OS_ASSERT(layers.size() == ++n);
    if ((model().strictnessLevel() < StrictnessLevel::Final) || 
        LayeredConstruction::layersAreValid(layers)) 
    {
      IdfExtensibleGroup idfGroup = insertExtensibleGroup(layerIndex,StringVector());
      OS_ASSERT(!idfGroup.empty());
      ModelExtensibleGroup group = idfGroup.cast<ModelExtensibleGroup>();
      bool ok = group.setPointer(0,material.handle());
      OS_ASSERT(ok);
      return true;
    }

    return false;
  }
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:29,代码来源:LayeredConstruction.cpp

示例6: getExtensibleGroup

boost::optional<double> LifeCycleCostUsePriceEscalation_Impl::yearEscalation(unsigned index) const 
{
  IdfExtensibleGroup eg = getExtensibleGroup(index);
  if (!eg.empty()) {
    return eg.getDouble(OS_LifeCycleCost_UsePriceEscalationExtensibleFields::YearEscalation,true);
  }
  return boost::none;
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:8,代码来源:LifeCycleCostUsePriceEscalation.cpp

示例7: getClimateZone

 ClimateZone ClimateZones_Impl::getClimateZone(unsigned index) const {
   IdfExtensibleGroup eg = getExtensibleGroup(index);
   if (eg.empty()) {
     std::shared_ptr<ClimateZones_Impl> p;
     return ClimateZone(p,numFields());
   }
   return eg.cast<ClimateZone>();
 }      
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:8,代码来源:ClimateZones.cpp

示例8: getExtensibleGroup

 boost::optional<std::string> PeopleDefinition_Impl::getThermalComfortModelType(int i) const {
   OptionalString result;
   if (i < numThermalComfortModelTypes()) {
     IdfExtensibleGroup eg = getExtensibleGroup(i);
     OS_ASSERT(!eg.empty());
     result = eg.getString(OS_People_DefinitionExtensibleFields::ThermalComfortModelType,true);
   }
   return result;
 }
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:9,代码来源:PeopleDefinition.cpp

示例9: registerObject

 bool ComponentData_Impl::registerObject(const ModelObject& object) {
   IdfExtensibleGroup eg = pushExtensibleGroup(StringVector());
   bool result = !eg.empty();
   if (result) {
     ModelExtensibleGroup meg = eg.cast<ModelExtensibleGroup>();
     result = result && meg.setPointer(OS_ComponentDataExtensibleFields::NameofObject,
                                       object.handle());
   }
   return result;
 }
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:10,代码来源:ComponentData.cpp

示例10: setComputeStep

bool UtilityCost_Computation_Impl::setComputeStep(unsigned index, const std::string& str) {
  IdfExtensibleGroup eg = getExtensibleGroup(index);
  if (!eg.empty()) {
    return eg.setString(OS_UtilityCost_ComputationExtensibleFields::ComputeStep,str);
  }
  else {
    StringVector values(1u,str);
    return !insertExtensibleGroup(index,values).empty();
  }
  OS_ASSERT(false);
  return false;
}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:12,代码来源:UtilityCost_Computation.cpp

示例11: setBlockCostPerUnitValueOrVariableName

bool UtilityCost_Charge_Block_Impl::setBlockCostPerUnitValueOrVariableName(unsigned index, const std::string& str) {
  IdfExtensibleGroup eg = getExtensibleGroup(index);
  if (!eg.empty()) {
    return eg.setString(OS_UtilityCost_Charge_BlockExtensibleFields::BlockCostperUnitValueorVariableName,str);
  }
  else {
    StringVector values(2u);
    values[OS_UtilityCost_Charge_BlockExtensibleFields::BlockCostperUnitValueorVariableName] = str;
    return !insertExtensibleGroup(index,values).empty();
  }
  OS_ASSERT(false);
  return false;
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:13,代码来源:UtilityCost_Charge_Block.cpp

示例12: setProgram

 bool EnergyManagementSystemProgramCallingManager_Impl::setProgram(const EnergyManagementSystemProgram& program, unsigned index) {
   //add program to {index} of vector of programs
   bool result = false;
   auto groups = extensibleGroups();
   unsigned sizeOfGroup = numExtensibleGroups();
   if (index <= sizeOfGroup) {
     IdfExtensibleGroup idfGroup = insertExtensibleGroup(index, StringVector());
     OS_ASSERT(!idfGroup.empty());
     ModelExtensibleGroup group = idfGroup.cast<ModelExtensibleGroup>();
     result = group.setPointer(0, program.handle());
   }
   return result;
 }
开发者ID:chlimit,项目名称:OpenStudio,代码行数:13,代码来源:EnergyManagementSystemProgramCallingManager.cpp

示例13: typeLimits

TEST_F(ModelFixture, ComponentWatcher_FromScratch) {
  // create schedule component
  Model justASchedule;
  ScheduleTypeLimits typeLimits(justASchedule);
  typeLimits.setName("Fraction");
  typeLimits.setLowerLimitValue(0.0);
  typeLimits.setUpperLimitValue(1.0);
  typeLimits.setNumericType("Continuous");
  ScheduleCompact schedule(justASchedule);
  EXPECT_TRUE(schedule.setPointer(OS_Schedule_CompactFields::ScheduleTypeLimitsName,
                                  typeLimits.handle()));
  Component scheduleComponent = schedule.createComponent();

  // create model with Lights objects and insert schedule component
  Model justLights;
  LightsDefinition lightsDefinition(justLights);
  Lights light1(lightsDefinition);
  OptionalComponentData ocd = justLights.insertComponent(scheduleComponent);

  // get ComponentData object
  ASSERT_TRUE(ocd);
  ComponentData componentData = *ocd;
  UUID versionUUID = componentData.versionUUID();

  // setting lighting schedule does not invalidate schedule component, or change its version UUID
  OptionalScheduleCompact oSchedule = componentData.primaryComponentObject().optionalCast<ScheduleCompact>();
  ASSERT_TRUE(oSchedule);
  schedule = *oSchedule;
  EXPECT_TRUE(light1.setSchedule(schedule));
  ASSERT_TRUE(componentData.initialized());
  EXPECT_EQ(versionUUID,componentData.versionUUID());

  // changing data field in componentObject does not invalidate schedule component, but does change version UUID
  StringVector values;
  values.push_back("Through: 12/31");
  IdfExtensibleGroup eg = componentData.primaryComponentObject().pushExtensibleGroup(values);
  EXPECT_FALSE(eg.empty());
  ASSERT_TRUE(componentData.initialized());
  EXPECT_NE(versionUUID,componentData.versionUUID());
  versionUUID = componentData.versionUUID();

  // changing type limits used by schedule in component invalidates the component
  Handle h = componentData.handle();
  EXPECT_TRUE(justLights.isMember(h));
  ScheduleTypeLimits newTypeLimits = typeLimits.clone(justLights).cast<ScheduleTypeLimits>();
  EXPECT_FALSE(newTypeLimits.handle() == typeLimits.handle());
  EXPECT_TRUE(schedule.setPointer(OS_Schedule_CompactFields::ScheduleTypeLimitsName,newTypeLimits.handle()));
  EXPECT_FALSE(componentData.initialized());
  EXPECT_FALSE(justLights.isMember(h));
}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:50,代码来源:Component_GTest.cpp

示例14: setThermalComfortModelType

 bool PeopleDefinition_Impl::setThermalComfortModelType(
     int i, const std::string& thermalComfortModelType)
 {
   int n = numThermalComfortModelTypes();
   if (i == n) {
     return pushThermalComfortModelType(thermalComfortModelType);
   }
   if (i < n) {
     IdfExtensibleGroup eg = getExtensibleGroup(i);
     OS_ASSERT(!eg.empty());
     return eg.setString(OS_People_DefinitionExtensibleFields::ThermalComfortModelType,
                         thermalComfortModelType);
   }
   return false;
 }
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:15,代码来源:PeopleDefinition.cpp

示例15: addValue

  bool ScheduleDay_Impl::addValue(const openstudio::Time& untilTime, double value) {
    if (untilTime.totalMinutes() <= 0.5 || untilTime.totalDays() > 1.0) {
      return false;
    }

    int untilHours = untilTime.hours() + 24*untilTime.days();
    int untilMinutes = untilTime.minutes() + floor((untilTime.seconds()/60.0) + 0.5);

    if (untilMinutes >= 60){
      untilHours += 1;
      untilMinutes += -60;
    }

    // use set to determine whether to overwrite or insert, and where
    std::set<openstudio::Time> times;
    std::pair<std::set<openstudio::Time>::const_iterator,bool> insertResult;
    for (const openstudio::Time& time : this->times()) {
      insertResult = times.insert(time);
      OS_ASSERT(insertResult.second);
    }

    insertResult = times.insert(untilTime);
    unsigned index = std::distance<std::set<openstudio::Time>::const_iterator>(times.begin(),insertResult.first);
    OS_ASSERT(index <= numExtensibleGroups());
    bool result(true);
    if (insertResult.second) {
      // new time--insert an extensible group
      std::vector<std::string> groupValues;
      groupValues.push_back(boost::lexical_cast<std::string>(untilHours));
      groupValues.push_back(boost::lexical_cast<std::string>(untilMinutes));
      groupValues.push_back(toString(value));

      IdfExtensibleGroup group = insertExtensibleGroup(index, groupValues);
      OS_ASSERT(!group.empty());
    }
    else {
      // time already exists, overwrite value
      IdfExtensibleGroup group = getExtensibleGroup(index);
      result = group.setDouble(OS_Schedule_DayExtensibleFields::ValueUntilTime,value);
    }

    return result;
  }
开发者ID:pepsi7959,项目名称:OpenStudio,代码行数:43,代码来源:ScheduleDay.cpp


注:本文中的IdfExtensibleGroup::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。