void ModelValidationHelper::applyFixes(void) { if(fix_mode) { bool validate_rels=false; while(!val_infos.empty() && !valid_canceled) { for(unsigned i=0; i < val_infos.size() && !valid_canceled; i++) { validate_rels=(val_infos[i].getValidationType()==ValidationInfo::BROKEN_REFERENCE || val_infos[i].getValidationType()==ValidationInfo::NO_UNIQUE_NAME); resolveConflict(val_infos[i]); } emit s_fixApplied(); validateModel(); sleepThread(5); } if(!valid_canceled && val_infos.empty()) { if(validate_rels) db_model->validateRelationships(); fix_mode=false; } } }
double MuscleChain::getSignal(int index) { if ((index > -1) && (index < chainSize) && (muscles[index] != 0)) { if (!isValid) validateModel(); return muscles[index]->getSignal(params[index].motorCommand, params[index].load, params[index].angle, params[index].speed, params[index].exAngle, params[index].disVec); } return 0; }
void ModelValidationWidget::applyFix(void) { try { ValidationInfo val_info; val_info=output_trw->topLevelItem(0)->data(0, Qt::UserRole).value<ValidationInfo>(); validation_helper.resolveConflict(val_info); model_wgt->setModified(true); //Every time the user apply some fix is necessary to revalidate the model validateModel(); if(fix_steps_chk->isChecked() && curr_step < fix_steps_sb->value() && validation_helper.getErrorCount() > 0) { curr_step++; this->applyFix(); } else curr_step=0; } catch(Exception &e) { QTreeWidgetItem *item=new QTreeWidgetItem; QLabel *label=new QLabel; label->setText(trUtf8("The validation process failed due to external errors! You can restart the validation by clicking <strong>Validate</strong> again.")); item->setIcon(0, QPixmap(QString(":/icones/icones/msgbox_erro.png"))); curr_step=0; output_trw->clear(); output_trw->insertTopLevelItem(0, item); output_trw->setItemWidget(item, 0, label); warn_count_lbl->setText(QString("%1").arg(0)); error_count_lbl->setText(QString("%1").arg(0)); fix_btn->setEnabled(false); throw Exception(e.getErrorMessage(), e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
Return<void> SampleDriverFloatSlow::getSupportedOperations_1_1(const V1_1::Model& model, getSupportedOperations_1_1_cb cb) { VLOG(DRIVER) << "getSupportedOperations()"; if (validateModel(model)) { const size_t count = model.operations.size(); std::vector<bool> supported(count); for (size_t i = 0; i < count; i++) { const Operation& operation = model.operations[i]; if (operation.inputs.size() > 0) { const Operand& firstOperand = model.operands[operation.inputs[0]]; supported[i] = firstOperand.type == OperandType::TENSOR_FLOAT32; } } cb(ErrorStatus::NONE, supported); } else { std::vector<bool> supported; cb(ErrorStatus::INVALID_ARGUMENT, supported); } return Void(); }
bool PresetCabinet::setCabinet(CabTypes cab) { model = validateModel(cab); return model==cab; }