//------------------------------------------------------------------------------ void MoleculeElDensSurfaceWidget::ComputeSteps() { if( !ValidateData() ) return; int steps[ 3 ]; // nx, ny, nz double bboxSize[ 3 ]; // dx, dy, dz bboxSize[ 0 ] = dxSpinBox_->value(); bboxSize[ 1 ] = dySpinBox_->value(); bboxSize[ 2 ] = dzSpinBox_->value(); steps[ 0 ] = int( bboxSize[ 0 ] / stepSizeSpinBox_->value() + .5 ); steps[ 1 ] = int( bboxSize[ 1 ] / stepSizeSpinBox_->value() + .5 ); steps[ 2 ] = int( bboxSize[ 2 ] / stepSizeSpinBox_->value() + .5 ); nxLineEdit_->setText( QString( "%1" ).arg( steps[ 0 ] ) ); nyLineEdit_->setText( QString( "%1" ).arg( steps[ 1 ] ) ); nzLineEdit_->setText( QString( "%1" ).arg( steps[ 2 ] ) ); //Emit signal only in case of user input QSettings s; s.setValue( STEP_SIZE_KEY, stepSizeSpinBox_->value() ); s.setValue( ISOVALUE_KEY, valueSpinBox_->value() ); #ifdef PERSISTENT_ISOBBOX s.setValue( BBOX_DX_KEY, dxSpinBox_->value() ); s.setValue( BBOX_DY_KEY, dySpinBox_->value() ); s.setValue( BBOX_DZ_KEY, dzSpinBox_->value() ); #endif if( mol_ != 0 ) { mol_->SetIsoBoundingBoxSize( dxSpinBox_->value(), dySpinBox_->value(), dzSpinBox_->value() ); } if( !updatingGUI_ ) emit ValuesChanged(); }
void KTestGenerateList::TestGenerateSuccess() { int nResult = false; int nRetCode = false; KVersionParser Parser; TCHAR szTestRes[MAX_PATH]; TCHAR szCurVersion[] = _T("1.0.8.1493"); nRetCode = KTestCommon::PrepareTestResoure(AUTOUPDATE_ENTRY_1); KGLOG_PROCESS_ERROR(nRetCode != -1); //输入更新列表和在列表范围内的版本号,生成下载列表 nRetCode = _sntprintf(szTestRes, MAX_PATH, _T("%s\\%s"), g_szTestingSpaceDir, AUTOUPDATE_ENTRY_1); KGLOG_PROCESS_ERROR(nRetCode != -1); szTestRes[MAX_PATH - 1] = _T('\0'); nRetCode = Parser.Parse(szTestRes, szCurVersion); KGLOG_PROCESS_ERROR(nRetCode); //验证生成的下载列表 nRetCode = ValidateData(&Parser, ZIP_FILE_1, ZIP_COUNT_1, szTestRes, szCurVersion); KGLOG_PROCESS_ERROR(nRetCode); nResult = true; Exit0: Parser.CleanUp(); CPPUNIT_ASSERT(nResult); }
//////////////////////////////////////////////////////////////////////////// // DoShellSetup() //////////////////////////////////////////////////////////////////////////// void clWeibullClimateQuadratGrowth::DoShellSetup( xercesc::DOMDocument * p_oDoc ) { try { clTreePopulation * p_oPop = ( clTreePopulation * ) mp_oSimManager->GetPopulationObject( "treepopulation" ); FormatQuery( p_oPop ); ReadParameterFile( p_oDoc, p_oPop ); ValidateData( p_oPop ); SetupGrid( p_oPop ); } catch ( modelErr & err ) { throw( err ); } catch ( modelMsg & msg ) { throw( msg ); } //non-fatal error catch ( ... ) { modelErr stcErr; stcErr.iErrorCode = UNKNOWN; strcpy( stcErr.cFunction, "clWeibullClimateQuadratGrowth::DoShellSetup" ); throw( stcErr ); } }
bool FileDataCacheItem::FromString( const String& s ) { path.Clear(); lastUsed = 0; time.year = 0; StringList tokens; s.Break( tokens, char16_type( '\n' ) ); for ( StringList::const_iterator i = tokens.Begin(); i != tokens.End(); ) { if ( *i == "path" ) { if ( ++i == tokens.End() ) return false; path = i->Trimmed(); ++i; } else if ( *i == "lastUsed" ) { if ( ++i == tokens.End() ) return false; lastUsed = i->ToUInt(); ++i; } else if ( *i == "time" ) { if ( tokens.End() - i < 3 ) return false; int y, m, d; double f; JDToComplexTime( y, m, d, f, i[1].ToUInt()+0.5 ); unsigned t = i[2].ToUInt(); time.year = y; time.month = m; time.day = d; time.milliseconds = t - 86399000; time.hour = TruncI( (t = TruncI( t/1000.0 ))/3600.0 ); time.minute = TruncI( (t -= time.hour*3600)/60.0 ); time.second = t - time.minute*60; i += 3; } else if ( *i == "data" ) { if ( !GetDataFromTokens( tokens ) ) return false; ++i; } else { ++i; } } return !path.IsEmpty() && lastUsed > 0 && time.year > 0 && ValidateData(); }
Flare::Flare(pTagObjClass pClass_, pchar TagIn, pTaggedObject pAttach, TagObjAttachment eAttach) : MN_SrcSnk(pClass_, TagIn, pAttach, eAttach)//, { AttachClassInfo(nc_Process, FlareIOAreaList); FlareDrum=NULL; FlareTag="VG1601"; ValidateDataBlk VDB; ValidateData(VDB); };
//------------------------------------------------------------------------------ bool MoleculeElDensSurfaceWidget::GetBBoxSize( double bboxSize[ 3 ] ) const { if( !ValidateData() ) { // Shall we handle the error condition here or inside the enclosing widget ? QMessageBox::critical( 0, "Error", "Invalid Data", "Close" ); /// @todo fill status message with info on error condition and make this /// information accessible from outside. return false; } bboxSize[ 0 ] = dxSpinBox_->value(); bboxSize[ 1 ] = dySpinBox_->value(); bboxSize[ 2 ] = dzSpinBox_->value(); return true; }
//------------------------------------------------------------------------------ bool MoleculeElDensSurfaceWidget::GetSteps( int steps[ 3 ] ) const { if( !ValidateData() ) { // Shall we handle the error condition here or inside the enclosing widget ? QMessageBox::critical( 0, "Error", "Invalid Data", "Close" ); /// @todo fill status message with info on error condition and make this /// information accessible from outside. return false; } steps[ 0 ] = nxLineEdit_->text().toInt(); steps[ 1 ] = nyLineEdit_->text().toInt(); steps[ 2 ] = nzLineEdit_->text().toInt(); return true; }
//------------------------------------------------------------------------------ bool MoleculeElDensSurfaceWidget::GetData( double& v, double bboxSize[ 3 ], int steps[ 3 ], bool& bothSigns, bool& nodalSurface, MolekelMolecule::RenderingStyle& rs, double& dmTransparency, double& negTransparency, double& nodalTransparency, double& posTransparency ) const { if( !ValidateData() ) { // Shall we handle the error condition here or inside the enclosing widget ? QMessageBox::critical( 0, "Error", "Invalid Data", "Close" ); /// @todo fill status message with info on error condition and make this /// information accessible from outside. return false; } v = valueSpinBox_->value(); bboxSize[ 0 ] = dxSpinBox_->value(); bboxSize[ 1 ] = dySpinBox_->value(); bboxSize[ 2 ] = dzSpinBox_->value(); steps[ 0 ] = nxLineEdit_->text().toInt(); steps[ 1 ] = nyLineEdit_->text().toInt(); steps[ 2 ] = nzLineEdit_->text().toInt(); if( signCheckBox_->checkState() == Qt::Checked ) bothSigns = true; else bothSigns = false; if( nodalSurfaceCheckBox_->checkState() == Qt::Checked ) nodalSurface = true; else nodalSurface = false; rs = MolekelMolecule::RenderingStyle ( renderingStyleComboBox_->itemData( renderingStyleComboBox_->currentIndex() ).toInt() ); dmTransparency = dmTransparencyWidget_->value(); negTransparency = negTransparencyWidget_->value(); nodalTransparency = nodTransparencyWidget_->value(); posTransparency = posTransparencyWidget_->value(); return true; }
//////////////////////////////////////////////////////////////////////////// // DoShellSetup() //////////////////////////////////////////////////////////////////////////// void clLaggedPostHarvestGrowth::DoShellSetup( xercesc::DOMDocument * p_oDoc ) { try { clTreePopulation *p_oPop = ( clTreePopulation * ) mp_oSimManager->GetPopulationObject( "treepopulation" ); m_iNumberYearsPerTimestep = mp_oSimManager->GetNumberOfYearsPerTimestep(); AssembleUniqueTypes(); ReadParameterFile( p_oDoc ); ValidateData(); GetTreeMemberCodes(); SetupTimeSinceHarvestGrid(); //Get the expected growth values at the start in case there's harvesting in the first timestep PreGrowthCalcs(p_oPop); } catch ( modelErr & err ) { throw( err ); } catch ( modelMsg & msg ) { throw( msg ); } //non-fatal error catch ( ... ) { modelErr stcErr; stcErr.iErrorCode = UNKNOWN; stcErr.sFunction = "clLaggedPostHarvestGrowth::DoShellSetup" ; throw( stcErr ); } }
void udfTrainersMngrDlg::OnUpdate(wxCommandEvent& event) { do { CTrainersTable::tDATA* pData = NULL; if(! GetSelectedItemData(pData)) break; if(! ValidateData()) break; int nItem = m_listTrainers->FindString(pData->name, true); pData->clubId = *(int*)m_comboClub->GetClientData(GetSelectedClub()); pData->name = m_textName->GetValue(); pData->additionalInfo = m_textInfo->GetValue(); pData->phone = m_textPhone->GetValue(); pData->email = m_textEmail->GetValue(); pData->bd = m_dateBd->GetValue().GetTicks(); m_listTrainers->SetString(nItem, pData->name); }while(0); }
void CSetDialog::OnPrevButton() { int prev_idx; int len, max_idx; // if the current data is wrong, don't change if( ! ValidateData() ) { return; } len = set_variables.GetSize(); max_idx = len-1; ASSERT( m_CurrentInstanceIdx > 0 ); if( m_CurrentInstanceIdx <= 0 ) { // shouldn't happen (we should have disabled the prev button so we // can't go beyond the front of the list) return; } prev_idx = m_CurrentInstanceIdx - 1; // if we're going to be on the first entry, disable the prev button so we // can't try to go beyond the first of the list if( prev_idx == 0 ) { m_PrevButton.EnableWindow( FALSE ); } // if we were on the last entry, reenable the next button if( m_CurrentInstanceIdx == max_idx ) { m_NextButton.EnableWindow( TRUE ); } m_CurrentInstanceIdx = prev_idx; UpdateVariableDisplay(); }
void udfTrainersMngrDlg::OnAddTrainer( wxCommandEvent& event ) { do { int nItem = m_listTrainers->GetCount(); if(! ValidateData()) break; CTrainersTable::tDATA data = {0}; data.id = -nItem; data.clubId = *(int*)m_comboClub->GetClientData(GetSelectedClub()); data.name = m_textName->GetValue(); data.additionalInfo = m_textInfo->GetValue(); data.email = m_textEmail->GetValue(); data.bd = m_dateBd->GetValue().GetTicks(); data.phone = m_textPhone->GetValue(); CTrainersTable::tTableIt it = m_Trainers.insert(std::make_pair(data.id, data)).first; m_listTrainers->Insert(data.name, nItem, (void*)&it->first); m_listTrainers->SetSelection(nItem); }while(0); }
void CUT_PBASE_T_USBDI_0490::TransferCompleteL(TInt aTransferId,TInt aCompletionCode) { OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0490_TRANSFERCOMPLETEL_ENTRY, this ); Cancel(); TInt err(KErrNone); TBuf<256> msg; OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0490_TRANSFERCOMPLETEL, "Transfer completed (id=%d), aCompletionCode = %d",aTransferId, aCompletionCode); switch(iCaseStep) { case ETransferOut: { if(aCompletionCode != KErrNone) { err = KErrCorrupt; msg.Format(_L("<Error %d> No data sent on bulk OUT request"),aCompletionCode); break; } if(aTransferId != KBulkTransferOutId) { err = KUnexpectedTransferID; msg.Format(_L("<Error %d> Unexpected transfer ID, wanted %d, got %d"), err, KBulkTransferOutId, aTransferId); break; } OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0490_TRANSFERCOMPLETEL_DUP01, "Try to receive back sent data"); iCaseStep = ETransferIn; TWriteSynchronousCachedReadDataRequest request(1,1,1); //Use first read EP and first write EP (on interface 1) iControlEp0->SendRequest(request,this); } break; case ETransferIn: { if(aCompletionCode != KErrNone) { err = KErrCorrupt; msg.Format(_L("<Error %d> No data sent on bulk IN request"),aCompletionCode); break; } if(aTransferId != KBulkTransferInId) { err = KUnexpectedTransferID; msg.Format(_L("<Error %d> Unexpected transfer ID, wanted %d, got %d"), err, KBulkTransferInId, aTransferId); break; } // Compare the data to what is expected if(ValidateData(iInTransfer[0]->DataPolled(), KPayloadPattern, KBulkTransferSize) == EFalse) { err = KErrCompletion; //indicates data validation failure msg.Format(_L("<Error %d> Bulk transfer IN data received does not match Bulk Transfer OUT data"), err); break; } if(err == KErrNone) { // Comparison is a match OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0490_TRANSFERCOMPLETEL_DUP02, "Comparison for IN transfer is a match"); iCaseStep = EPassed; TTestCasePassed request; iControlEp0->SendRequest(request,this); break; } } break; default: err = KUndefinedStep; msg.Format(_L("<Error %d> Undefined case step %d reached"),KUndefinedStep, iCaseStep); break; } if(err!=KErrNone) { OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0490_TRANSFERCOMPLETEL_DUP03, msg); iCaseStep = EFailed; TTestCaseFailed request(err,msg); return iControlEp0->SendRequest(request,this); } OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0490_TRANSFERCOMPLETEL_EXIT, this ); }
void CSetDialog::OnOK() { if( ValidateData() ) { CDialog::OnOK(); } }
void CLimnStream::CFeed::ValidateData() { ValidateData(m_OreSizeFeed); ValidateData(m_DmdSizeFeed); ValidateData(m_DmdSGFeed); };
void CUT_PBASE_T_USBDI_0498::TransferCompleteL(TInt aTransferId,TInt aCompletionCode) { OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_ENTRY, this ); Cancel(); TInt err(KErrNone); TBuf<256> msg; OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL, "Transfer completed (id=%d), aCompletionCode = %d, test step = %d",aTransferId, aCompletionCode, iCaseStep); switch(iCaseStep) { case ETransfer: if(aCompletionCode != KErrNone) { iIfc1OutTransfer[0]->Cancel(); iIfc1OutTransfer[1]->Cancel(); iIfc2OutTransfer[0]->Cancel(); iIfc2OutTransfer[1]->Cancel(); iIfc1InTransfer[0]->Cancel(); iIfc1InTransfer[1]->Cancel(); iIfc2InTransfer[0]->Cancel(); iIfc2InTransfer[1]->Cancel(); err = KErrCorrupt; msg.Format(_L("<Error %d> The transfer completed with an error."), aCompletionCode); break; //switch(iCaseStep) } switch(aTransferId) { case KIfc1BulkTransferOutId1: case KIfc1BulkTransferOutId2: case KIfc2BulkTransferOutId1: case KIfc2BulkTransferOutId2: iTransferComplete |= aTransferId; OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP01, "Transfer OUT %d completed (Transfer Completion Aggregation Mask 0x%x)", aTransferId, iTransferComplete); break; //switch(aTransferId) case KIfc1BulkTransferInId1: case KIfc1BulkTransferInId2: case KIfc2BulkTransferInId1: case KIfc2BulkTransferInId2: iTransferComplete |= aTransferId; OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP02, "Transfer OUT %d completed (Transfer Completion Aggregation Mask 0x%x)", aTransferId, iTransferComplete); break; //switch(aTransferId) default: iTransferComplete = 0; //reset err = KUnexpectedTransferID; msg.Format(_L("<Error %d> Unexpected transfer ID, GOT %d, (wanted one of:- %d, %d, %d, %d, %d, %d, %d, or%d)"), err, aTransferId, KIfc1BulkTransferInId1, KIfc1BulkTransferInId2, KIfc2BulkTransferInId1, KIfc2BulkTransferInId2, KIfc1BulkTransferOutId1, KIfc1BulkTransferOutId2, KIfc2BulkTransferOutId1, KIfc2BulkTransferOutId2 ); break; //switch(aTransferId) } // Transfer Out Response if(err==KErrNone && iTimeElapsed[0] == 0 && (iTransferComplete & KIfc1BulkTransferOutIdMask) == KIfc1BulkTransferOutIdMask) //Record time elapsed for Interface 1 if not yet recorded. { RecordTime(0); } if(err==KErrNone && iTimeElapsed[1] == 0 && (iTransferComplete & KIfc2BulkTransferOutIdMask) == KIfc2BulkTransferOutIdMask) //Record time elapsed for Interface 2 if not yet recorded. { RecordTime(1); } if(err==KErrNone && (iTransferComplete & KBulkTransferOutIdMask) == KBulkTransferOutIdMask) { OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP03, "All OUT Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete); //Leave validation to the point at which all transfers have completed. } // Transfer In Response if(err==KErrNone && iTimeElapsed[2] == 0 && (iTransferComplete & KIfc1BulkTransferInIdMask) == KIfc1BulkTransferInIdMask) //Record time elapsed for Interface 1 if not yet recorded. { RecordTime(2); } if(err==KErrNone && iTimeElapsed[3] == 0 && (iTransferComplete & KIfc2BulkTransferInIdMask) == KIfc2BulkTransferInIdMask) //Record time elapsed for Interface 2 if not yet recorded. { RecordTime(3); } if(err==KErrNone && (iTransferComplete & KBulkTransferInIdMask) == KBulkTransferInIdMask) { // ok, compare data rcvd now OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP04, "All IN Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete); TPtrC8 data1(iIfc1InTransfer[0]->DataPolled()); TPtrC8 data2(iIfc1InTransfer[1]->DataPolled()); TPtrC8 data3(iIfc2InTransfer[0]->DataPolled()); TPtrC8 data4(iIfc2InTransfer[1]->DataPolled()); //Validate first transfer on Interface 1 for number of bytes originally written. if(ValidateData(data1, KLiteralFrench4(), KHostNumWriteBytes1) == EFalse) { OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP05, "Validation failure 1st transfer, Interface 1"); err = KErrCompletion; //indicates data validation failure break; //switch(iCaseStep) } //Validate second transfer on Interface 1 for number of bytes originally written. if(ValidateData(data2, KLiteralFrench4(), KHostNumWriteBytes1, KHostNumWriteBytes2) == EFalse) { OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP06, "Validation failure 2nd transfer, Interface 1"); err = KErrCompletion; //indicates data validation failure break; //switch(iCaseStep) } //Validate first transfer on Interface 2 for number of bytes originally written. if(ValidateData(data3, KLiteralEnglish2(), KHostNumWriteBytes1) == EFalse) { OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP07, "Validation failure 1st transfer, Interface 2"); err = KErrCompletion; //indicates data validation failure break; //switch(iCaseStep) } //Validate second transfer on Interface 2 for number of bytes originally written. if(ValidateData(data4, KLiteralEnglish2(), KHostNumWriteBytes1, KHostNumWriteBytes2) == EFalse) { OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP08, "Validation failure 2nd transfer, Interface 2"); err = KErrCompletion; //indicates data validation failure break; //switch(iCaseStep) } // Comparison is a match OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP09, "Comparison for IN transfer is a match"); } break; //switch(iCaseStep) default: err = KUndefinedStep; msg.Format(_L("<Error %d> Undefined case step %d reached"),KUndefinedStep, iCaseStep); break; //switch(iCaseStep) } if(err == KErrNone && iTransferComplete == KBulkTransferIdMask) /* Transfers all complete - now ask device to validate first interface's transfer OUT */ { OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP10, "Checking all times against each other"); err = CheckTimes(0, 1, KMaxTimeDiffPercentage); err = err?err:CheckTimes(0, 2, KMaxTimeDiffPercentage); err = err?err:CheckTimes(0, 3, KMaxTimeDiffPercentage); err = err?err:CheckTimes(1, 2, KMaxTimeDiffPercentage); err = err?err:CheckTimes(1, 3, KMaxTimeDiffPercentage); err = err?err:CheckTimes(2, 3, KMaxTimeDiffPercentage); ResetTimes(0); ResetTimes(1); ResetTimes(2); ResetTimes(3); if(err==KErrNone) { OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP11, "Asking client for 'Validate' data written on interface 1"); iCaseStep = ERequestDeviceValidateIFC1; TEndpointStringValidationRequest request(1,1,KLiteralFrench4(),KDeviceNumReadBytes); iControlEp0->SendRequest(request,this); } } if(err == KErrCompletion) //indicates data validation failure { msg.Format(_L("<Error %d> Bulk transfer IN data received does not match Bulk Transfer OUT data"), err); } if(err == KErrTooBig) //indicates timing validation failure { msg.Format(_L("<Error %d> Timer comparison showed too great a difference in transfer times between the two interfaces"), err); } if(err!=KErrNone) { OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP12, msg); iCaseStep = EFailed; TTestCaseFailed request(err,msg); return iControlEp0->SendRequest(request,this); } OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_EXIT, this ); }
void SumForm::OnOKClick(wxCommandEvent& event) { if(ValidateData()) EndModal(wxID_OK); }