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


C++ OS_ASSERT函数代码示例

本文整理汇总了C++中OS_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ OS_ASSERT函数的具体用法?C++ OS_ASSERT怎么用?C++ OS_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: ConstructionBase_Impl

 FFactorGroundFloorConstruction_Impl::FFactorGroundFloorConstruction_Impl(
     const openstudio::detail::WorkspaceObject_Impl& other,Model_Impl* model,bool keepHandle)
   : ConstructionBase_Impl(other,model,keepHandle)
 {
   OS_ASSERT(other.iddObject().type() == FFactorGroundFloorConstruction::iddObjectType());
 }
开发者ID:CheyenneBerlin,项目名称:OpenStudio,代码行数:6,代码来源:FFactorGroundFloorConstruction.cpp

示例2: LOG

OptionalModelObject ReverseTranslator::translateElectricEquipment( const WorkspaceObject & workspaceObject )
{
  if( workspaceObject.iddObject().type() != IddObjectType::ElectricEquipment ){
    LOG(Error, "WorkspaceObject is not IddObjectType: ElectricEquipment");
    return boost::none;
  }

  // create the definition
  openstudio::model::ElectricEquipmentDefinition definition(m_model);
  
  OptionalString s = workspaceObject.name();
  if(s){
    definition.setName(*s + " Definition");
  }

  s = workspaceObject.getString(openstudio::ElectricEquipmentFields::DesignLevelCalculationMethod, true);
  OS_ASSERT(s);

  OptionalDouble d;
  if (istringEqual("EquipmentLevel", *s)){
    d = workspaceObject.getDouble(openstudio::ElectricEquipmentFields::DesignLevel);
    if (d){
      definition.setDesignLevel(*d);
    }else{
      LOG(Error, "EquipmentLevel value not found for workspace object " << workspaceObject);
    }
  }else if(istringEqual("Watts/Area", *s)){
    d = workspaceObject.getDouble(openstudio::ElectricEquipmentFields::WattsperZoneFloorArea);
    if (d){
      definition.setWattsperSpaceFloorArea(*d);
    }else{
      LOG(Error, "Watts/Area value not found for workspace object " << workspaceObject);
    }
  }else if(istringEqual("Watts/Person", *s)){
    d = workspaceObject.getDouble(openstudio::ElectricEquipmentFields::WattsperPerson);
    if (d){
      definition.setWattsperPerson(*d);
    }else{
      LOG(Error, "Watts/Person value not found for workspace object " << workspaceObject);
    }
  }else{
    LOG(Error, "Unknown DesignLevelCalculationMethod value for workspace object" << workspaceObject);
  }

  d = workspaceObject.getDouble(openstudio::ElectricEquipmentFields::FractionLatent);
  if (d){
    definition.setFractionLatent(*d);
  }

  d = workspaceObject.getDouble(openstudio::ElectricEquipmentFields::FractionRadiant);
  if (d){
    definition.setFractionRadiant(*d);
  }

  d = workspaceObject.getDouble(openstudio::ElectricEquipmentFields::FractionLost);
  if (d){
    definition.setFractionLost(*d);
  }

  // create the instance
  ElectricEquipment electricEquipment(definition);

  s = workspaceObject.name();
  if(s){
    electricEquipment.setName(*s);
  }

  OptionalWorkspaceObject target = workspaceObject.getTarget(openstudio::ElectricEquipmentFields::ZoneorZoneListName);
  if (target){
    OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
    if (modelObject){
      if (modelObject->optionalCast<Space>()){
        electricEquipment.setSpace(modelObject->cast<Space>());
      }else if (modelObject->optionalCast<SpaceType>()){
        electricEquipment.setSpaceType(modelObject->cast<SpaceType>());
      }
    }
  }

  target = workspaceObject.getTarget(openstudio::ElectricEquipmentFields::ScheduleName);
  if (target){
    OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
    if (modelObject){
      if (OptionalSchedule intermediate = modelObject->optionalCast<Schedule>()){
        Schedule schedule = *intermediate;
        electricEquipment.setSchedule(schedule);
      }
    }
  }

  s = workspaceObject.getString(openstudio::ElectricEquipmentFields::EndUseSubcategory);
  if(s){
    electricEquipment.setEndUseSubcategory(*s);
  }
       
  return electricEquipment;
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:97,代码来源:ReverseTranslateElectricEquipment.cpp

示例3: getString

 std::string GasEquipment_Impl::endUseSubcategory() const {
   boost::optional<std::string> value = getString(OS_GasEquipmentFields::EndUseSubcategory,true);
   OS_ASSERT(value);
   return value.get();
 }
开发者ID:NREL,项目名称:OpenStudio,代码行数:5,代码来源:GasEquipment.cpp

示例4: QWidget

OSGridView::OSGridView(OSGridController * gridController,
  const QString & headerText,
  const QString & dropZoneText,
  bool useHeader,
  QWidget * parent)
  : QWidget(parent),
    m_dropZone(nullptr),
    m_contentLayout(nullptr),
    m_CollapsibleView(nullptr),
    m_gridController(gridController)
{
  auto buttonGroup = new QButtonGroup();
  connect(buttonGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &OSGridView::selectCategory);

  auto buttonLayout = new QHBoxLayout();
  buttonLayout->setSpacing(3);
  buttonLayout->setContentsMargins(10,10,10,10);
  buttonLayout->setAlignment(Qt::AlignCenter | Qt::AlignLeft);

  auto vectorController = new GridViewDropZoneVectorController();
  m_dropZone = new OSDropZone(vectorController, dropZoneText);
  m_dropZone->setMaxItems(1);

  connect(m_dropZone, &OSDropZone::itemDropped, m_gridController, &OSGridController::onItemDropped);

  buttonLayout->addWidget(m_dropZone);

  std::vector<QString> categories = m_gridController->categories();
  for(unsigned i=0; i<categories.size(); i++){
    auto button = new QPushButton(categories.at(i));
    button->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::MinimumExpanding);
    button->setCheckable(true);
    buttonLayout->addWidget(button);
    buttonGroup->addButton(button,buttonGroup->buttons().size());
  }

  auto layout = new QVBoxLayout();
  layout->setSpacing(0);
  layout->setContentsMargins(0,0,0,0);
  setLayout(layout);

  auto widget = new QWidget;

  if (useHeader) {
    auto header = new DarkGradientHeader();
    header->label->setText(headerText); 
    auto collabsibleView = new OSCollapsibleView(true);
    collabsibleView->setHeader(header);
    collabsibleView->setContent(widget);
    collabsibleView->setExpanded(true); 
    layout->addWidget(collabsibleView);
  } else {
    layout->addWidget(widget);
  }

  m_contentLayout = new QVBoxLayout();
  m_contentLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
  m_contentLayout->setSpacing(0);
  m_contentLayout->setContentsMargins(0,0,0,0);
  widget->setLayout(m_contentLayout);
  m_contentLayout->addLayout(buttonLayout);
  widget->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Fixed);

  setGridController(m_gridController);

  std::vector<QAbstractButton *> buttons = buttonGroup->buttons().toVector().toStdVector();
  if(buttons.size() > 0){
    QPushButton * button = qobject_cast<QPushButton *>(buttons.at(0));
    OS_ASSERT(button);
    button->setChecked(true);
    selectCategory(0);
  }

  m_timer.setSingleShot(true);
  connect(&m_timer, &QTimer::timeout, this, &OSGridView::doRefresh);

  if (this->isVisible()) {
    m_gridController->connectToModel();
    refreshAll();
  }
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:81,代码来源:OSGridView.cpp

示例5: setString

 void AirGap_Impl::resetThermalResistance() {
   bool result = setString(OS_Material_AirGapFields::ThermalResistance, "");
   OS_ASSERT(result);
 }
开发者ID:NREL,项目名称:OpenStudio,代码行数:4,代码来源:AirGap.cpp

示例6: ResourceObject

ScheduleTypeLimits::ScheduleTypeLimits(const Model& model)
  : ResourceObject(ScheduleTypeLimits::iddObjectType(),model)
{
  OS_ASSERT(getImpl<detail::ScheduleTypeLimits_Impl>());
}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:5,代码来源:ScheduleTypeLimits.cpp

示例7: ResourceObject

DefaultSurfaceConstructions::DefaultSurfaceConstructions(const Model& model)
  : ResourceObject(DefaultSurfaceConstructions::iddObjectType(),model)
{
  OS_ASSERT(getImpl<detail::DefaultSurfaceConstructions_Impl>());
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:5,代码来源:DefaultSurfaceConstructions.cpp

示例8: ModelObjectInspectorView


//.........这里部分代码省略.........

  mainGridLayout->addLayout(vLayout,1,1);

  // outside boundary condition and object
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Outside Boundary Condition: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_outsideBoundaryCondition = new OSComboBox();
  vLayout->addWidget(m_outsideBoundaryCondition);

  vLayout->addStretch();

  mainGridLayout->addLayout(vLayout,2,0);

  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Outside Boundary Condition Object: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_surfaceOutsideBoundaryConditionObjectVectorController = new SurfaceOutsideBoundaryConditionObjectVectorController();
  m_outsideBoundaryConditionObjectDropZone = new OSDropZone(m_surfaceOutsideBoundaryConditionObjectVectorController);
  m_outsideBoundaryConditionObjectDropZone->setMinItems(0);
  m_outsideBoundaryConditionObjectDropZone->setMaxItems(1);
  m_outsideBoundaryConditionObjectDropZone->setItemsAcceptDrops(true);
  vLayout->addWidget(m_outsideBoundaryConditionObjectDropZone);

  vLayout->addStretch();

  mainGridLayout->addLayout(vLayout,2,1);

  // sun and wind exposure
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Sun Exposure: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_sunExposure = new OSComboBox();
  vLayout->addWidget(m_sunExposure);

  vLayout->addStretch();

  mainGridLayout->addLayout(vLayout,3,0);

  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Wind Exposure: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_windExposure = new OSComboBox();
  vLayout->addWidget(m_windExposure);

  vLayout->addStretch();

  mainGridLayout->addLayout(vLayout,3,1);

  // separator
  vLayout = new QVBoxLayout();
  vLayout->setContentsMargins(0,0,0,0);

  QWidget * hLine = new QWidget();
  hLine->setObjectName("HLine");
  hLine->setStyleSheet("QWidget#HLine { background: #445051;}");
  hLine->setFixedHeight(2);
  vLayout->addWidget(hLine);
  
  label = new QLabel();
  label->setText("Vertices: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  mainGridLayout->addLayout(vLayout,4,0,1,2);

  // planar surface widget
  m_planarSurfaceWidget = new PlanarSurfaceWidget(m_isIP);
  bool isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), m_planarSurfaceWidget, SLOT(toggleUnits(bool)));
  OS_ASSERT(isConnected);

  mainGridLayout->addWidget(m_planarSurfaceWidget,5,0,1,2);

  mainGridLayout->setColumnMinimumWidth(0, 80);
  mainGridLayout->setColumnMinimumWidth(1, 80);
  mainGridLayout->setColumnStretch(2,1);
  mainGridLayout->setRowMinimumHeight(0, 30);
  mainGridLayout->setRowMinimumHeight(1, 30);
  mainGridLayout->setRowMinimumHeight(2, 30);
  mainGridLayout->setRowMinimumHeight(3, 30);
  mainGridLayout->setRowMinimumHeight(4, 30);
  mainGridLayout->setRowMinimumHeight(5, 30);
  mainGridLayout->setRowStretch(6,1);
}
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:101,代码来源:SurfaceInspectorView.cpp

示例9: setString

 void CoilHeatingGasMultiStageStageData_Impl::autosizeNominalCapacity() {
   bool result = setString(OS_Coil_Heating_Gas_MultiStage_StageDataFields::NominalCapacity, "autosize");
   OS_ASSERT(result);
 }
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:4,代码来源:CoilHeatingGasMultiStageStageData.cpp

示例10: ParentObject

/// constructor
UtilityCost_Ratchet::UtilityCost_Ratchet(const Model& model)
  : ParentObject(UtilityCost_Ratchet::iddObjectType(),model)
{
  OS_ASSERT(getImpl<detail::UtilityCost_Ratchet_Impl>());
}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:6,代码来源:UtilityCost_Ratchet.cpp

示例11: ParentObject_Impl

UtilityCost_Ratchet_Impl::UtilityCost_Ratchet_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
  : ParentObject_Impl(idfObject, model, keepHandle)
{
  OS_ASSERT(idfObject.iddObject().type() == UtilityCost_Ratchet::iddObjectType());
}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:5,代码来源:UtilityCost_Ratchet.cpp

示例12: setWorkflowSteps

 void WorkflowJSON_Impl::resetWorkflowSteps()
 {
   bool test = setWorkflowSteps(std::vector<WorkflowStep>()); // will hit onUpdate in setWorkflowSteps
   OS_ASSERT(test);
 }
开发者ID:NREL,项目名称:OpenStudio,代码行数:5,代码来源:WorkflowJSON.cpp

示例13: UncertaintyDescription

PoissonDistribution::PoissonDistribution(std::shared_ptr<detail::UncertaintyDescription_Impl> impl)
  : UncertaintyDescription(impl)
{
  OS_ASSERT(type() == PoissonDistribution::type());
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:5,代码来源:PoissonDistribution.cpp

示例14: getQuantity

 Quantity FFactorGroundFloorConstruction_Impl::getFFactor(bool returnIP) const {
   OSOptionalQuantity value = getQuantity(OS_Construction_FfactorGroundFloorFields::FFactor,true,returnIP);
   OS_ASSERT(value.isSet());
   return value.get();
 }
开发者ID:CheyenneBerlin,项目名称:OpenStudio,代码行数:5,代码来源:FFactorGroundFloorConstruction.cpp

示例15: setString

 void ScheduleTypeLimits_Impl::resetUpperLimitValue() {
   bool result = setString(OS_ScheduleTypeLimitsFields::UpperLimitValue, "");
   OS_ASSERT(result);
 }
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:4,代码来源:ScheduleTypeLimits.cpp


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