bool Relationship::setRelatedModelObject(boost::optional<ModelObject> relatedModelObject) { assertSingular(true); bool result = false; if (isSettable()) { // handle ComponentData set if (relatedModelObject && relatedModelObject->optionalCast<ComponentData>()) { if (relatedModelObject->model() != m_object.model()) { if (relatedModelObject->model().optionalCast<Component>()) { return setRelatedModelObject(relatedModelObject->model().cast<Component>()); } } } QVariant value = QVariant::fromValue(relatedModelObject); m_object.getImpl<detail::ModelObject_Impl>()->setProperty(m_name.c_str(), value); // check set boost::optional<ModelObject> newValue = this->relatedModelObject(); if (relatedModelObject){ if (newValue){ result = (relatedModelObject->handle() == newValue->handle()); } }else{ result = !newValue; } } return result; }
bool BoilerHotWater_Impl::setNormalizedBoilerEfficiencyCurve( const boost::optional<Curve>& normalizedBoilerEfficiencyCurve) { if (normalizedBoilerEfficiencyCurve) { return setPointer(OS_Boiler_HotWaterFields::NormalizedBoilerEfficiencyCurveName,normalizedBoilerEfficiencyCurve->handle()); } else { return setString(OS_Boiler_HotWaterFields::NormalizedBoilerEfficiencyCurveName,""); } return false; }