int main(void) { SPI_MasterInit(); btInit(); interruptINT1_init(); sei(); btTransmit(0); //moveRobot(ACTIVATE_HIT); while(1) { BT_SensorValues(); getSensorValues(); setVariables(); dataValues[LIFE] = lifeCount; //Start of AI program that should keep the robot within the boundaries of the tape track moveRobot(LED | lifeCount); if(!lifeCount) { sensorControlDead(); if(TapeFlag >= 0x03 && counting == 0) { counting = 1; timerValue = TIMER_1A_SECOND; timer_init(); } else if(counting == 2) { while(1) { moveRobot(STOP); } } } else { if(hit == 0) { activateHitFlag = 0; hitFlag = 1; } if (hit == 1 && activateHitFlag) { moveRobot(IR_ON); moveRobot(ACTIVATE_HIT); } else if(hit == 1 && hitFlag == 1) { hitFlag = 0; lifeCount = lifeCount >> 1; timer0_init(); } else if (hit == 1 && !activateHitFlag) { moveRobot(IR_OFF); } if(!sprayPray) { idle(); } }
static void PrepareConfigurationDialog() { gcc_unused ScopeBusyIndicator busy; wf = LoadDialog(CallBackTable, XCSoarInterface::main_window, Layout::landscape ? _T("IDR_XML_CONFIGURATION_L") : _T("IDR_XML_CONFIGURATION")); if (wf == NULL) return; wf->SetKeyDownNotify(FormKeyDown); bool expert_mode = false; Profile::Get(szProfileUserLevel, expert_mode); CheckBox *cb = (CheckBox *)wf->FindByName(_T("Expert")); cb->set_checked(expert_mode); wf->FilterAdvanced(expert_mode); ((WndButton *)wf->FindByName(_T("cmdClose")))->SetOnClickNotify(OnCloseClicked); configuration_tabbed = ((TabbedControl *)wf->FindByName(_T("tabbed"))); assert(configuration_tabbed != NULL); setVariables(); /* restore previous page */ configuration_tabbed->SetCurrentPage((unsigned)current_page); PageSwitched(); }
bool ComputeShaderChunk::addNodeProceduralVariable( const Char8 *name, ProcVarNodeFunctor pFunc, UInt32 uiDependency) { if(_sfVariables.getValue() == NULL) { ShaderProgramVariablesUnrecPtr pParam = ShaderProgramVariables::createDependent( this->getFieldFlags()->_bNamespaceMask); setVariables(pParam); if(_mfComputeShader.size() > 0) { _mfComputeShader[0]->setVariables(this->getVariables()); } } return _sfVariables.getValue()->addNodeProceduralVariable( name, pFunc, uiDependency, editMFProceduralVariableLocations()); }
void dlgMultimapsShowModal(void){ WndProperty *wp; char filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgMultimaps.xml")); wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_MULTIMAPS")); if (!wf) return; setVariables(); wf->ShowModal(); wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap1")); if (wp) Multimap1 = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap2")); if (wp) Multimap2 = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap3")); if (wp) Multimap3 = (wp->GetDataField()->GetAsInteger()); UpdateMultimapOrient(); delete wf; wf = NULL; }
bool ShaderProgram::addNodeProceduralVariable( const Char8 *name, ProcVarNodeFunctor pFunc, UInt32 uiDependency) { if(_sfVariables.getValue() == NULL) { ShaderProgramVariablesUnrecPtr pParam = ShaderProgramVariables::create(); setVariables(pParam); } #if 0 return _sfVariables.getValue()->addNodeProceduralVariable( name, pFunc, uiDependency, editMFProceduralVariableLocations()); #else return _sfVariables.getValue()->addNodeProceduralVariable( name, pFunc, uiDependency, NULL); #endif }
void dlgWaypointFilesShowModal(void){ TCHAR temptext[MAX_PATH]; TCHAR tmp[MAX_PATH]; WndProperty *wp; wf = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_FILES_L : IDR_XML_FILES_P); if (!wf) return; setVariables(); wf->SetCaption(MsgToken(2340)); wf->ShowModal(); for (unsigned int i=0 ; i < NO_WP_FILES; i++) { _tcscpy(temptext,szWaypointFile[i]); _sntprintf(tmp,MAX_PATH,_T("prpFile%1u"),i+1); wp = (WndProperty*)wf->FindByName(tmp); if (wp) { DataFieldFileReader* dfe = (DataFieldFileReader*)wp->GetDataField(); _tcscpy(temptext, dfe->GetPathFile()); if (_tcscmp(temptext,szWaypointFile[i])) { _tcscpy(szWaypointFile[i],temptext); } } } delete wf; wf = NULL; }
void FSISPOptimizerWCP::calculateBlockAssignment() { clear(); generateBlockCostsConstraints(); generateBlockSizeConstraint(); generateFunctionMembershipConstraints(); generateOptimalILPFormulation(); stringstream ilp_formulation; vector<string>::iterator it; ilp_formulation << "\n// Objective function:\n"; if(!conf->getBool(CONF_BBSISP_WCP_FILL_ISP_UP)) { ilp_formulation << "min: wentry;\n"; } else { ilp_formulation << "min: 1e10 wentry - sp;\n"; } ilp_formulation << "\n// Flow constraints:\n"; // sort(cfg_ilps.begin(),cfg_ilps.end()); for(it = cfg_ilps.begin(); it != cfg_ilps.end(); it++) { ilp_formulation << *it; } ilp_formulation << "\n// Basic block cost contraints:\n"; // sort(block_cost_contraints.begin(),block_cost_contraints.end()); for(it = block_cost_contraints.begin(); it != block_cost_contraints.end(); it++) { ilp_formulation << *it; } ilp_formulation << "\n// Basic block size contraints:\n"; // sort(block_size_constraints.begin(),block_size_constraints.end()); for(it = block_size_constraints.begin(); it != block_size_constraints.end(); it++) { ilp_formulation << *it; } ilp_formulation << "\n// Function membership constraints:\n"; for(it = function_membership_constraints.begin(); it != function_membership_constraints.end(); it++) { ilp_formulation << *it; } ilp_formulation << "\n// Binary domains:\n"; // sort(binary_domains.begin(),binary_domains.end()); for(it = binary_domains.begin(); it != binary_domains.end(); it++) { ilp_formulation << *it; } LOG_INFO(logger, "Formulation: " << ilp_formulation.str()); vector<lp_result_set> lp_result = writeAndSolveILPFile(ilp_formulation.str()); setAssignment(lp_result); setFunctionAssignment(lp_result); setVariables(lp_result); }
double RateGammaInvar::optimizeParameters(double gradient_epsilon) { int ndim = getNDim(); // return if nothing to be optimized if (ndim == 0) return phylo_tree->computeLikelihood(); if (verbose_mode >= VB_MED) cout << "Optimizing " << name << " model parameters by " << optimize_alg << " algorithm..." << endl; if (optimize_alg.find("EM_RR") != string::npos) { return randomRestartOptimization(gradient_epsilon); } else if (optimize_alg.find("Brent") != string::npos || phylo_tree->aln->frac_const_sites == 0.0 || isFixPInvar() || isFixGammaShape()) { double lh = phylo_tree->computeLikelihood(); cur_optimize = 0; double gamma_lh = RateGamma::optimizeParameters(gradient_epsilon); ASSERT(gamma_lh >= lh-0.1); cur_optimize = 1; double invar_lh = -DBL_MAX; invar_lh = RateInvar::optimizeParameters(gradient_epsilon); ASSERT(invar_lh >= gamma_lh-0.1); cur_optimize = 0; return invar_lh; } else if (optimize_alg.find("EM") != string::npos) { return optimizeWithEM(gradient_epsilon); } else if (optimize_alg.find("BFGS") != string::npos) { //if (freq_type == FREQ_ESTIMATE) scaleStateFreq(false); double *variables = new double[ndim+1]; double *upper_bound = new double[ndim+1]; double *lower_bound = new double[ndim+1]; bool *bound_check = new bool[ndim+1]; double score; // by BFGS algorithm setVariables(variables); setBounds(lower_bound, upper_bound, bound_check); score = -minimizeMultiDimen(variables, ndim, lower_bound, upper_bound, bound_check, max(gradient_epsilon, TOL_GAMMA_SHAPE)); getVariables(variables); phylo_tree->clearAllPartialLH(); score = phylo_tree->computeLikelihood(); delete [] bound_check; delete [] lower_bound; delete [] upper_bound; delete [] variables; return score; } else { string errMsg = "Unknown optimization algorithm: " + optimize_alg; outError(errMsg.c_str()); return 0.0; } }
static void OnResetTopologyClicked(WndButton* pWnd){ ChangeZoomTopology(1,1,4); setVariables(); //LKTOKEN _@M1223_ "Topology reset to default values" MessageBoxX ( gettext(TEXT("_@M1223_")), TEXT(""), mbOk); }
static void OnResetTopologyClicked(WindowControl * Sender){ (void)Sender; ChangeZoomTopology(1,1,4); setVariables(); //LKTOKEN _@M1223_ "Topology reset to default values" MessageBoxX (hWndMainWindow, gettext(TEXT("_@M1223_")), TEXT(""), MB_OK); }
/////////////////////////////////////Creation obj Canny void MainWindow::on_pushButton_clicked() { if(setVariables()) { _canny = new Canny(&_index, &_file, &_threshold1, &_threshold2, &_apertureSize, &_l2gradient, &_rho, &_theta, &_threshold, &_srn, &_stn, &_min_theta, &_max_theta); _canny->setAttribute(Qt::WA_DeleteOnClose); _canny->show(); } }
void VariablesModel::invalidatePython() { return setVariables(0); beginResetModel(); lock(); mMutex->lock(); mItems->clear(); mLocals->invalidatePython(); mMutex->unlock(); unlock(); endResetModel(); }
void dlgOverlaysShowModal(void){ WndProperty *wp; TCHAR filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgOverlays.xml")); wf = dlgLoadFromXML(CallBackTable, filename, TEXT("IDR_XML_OVERLAYS")); if (!wf) return; setVariables(); wf->ShowModal(); wp = (WndProperty*)wf->FindByName(TEXT("prpTopLeft")); if (wp) Overlay_TopLeft = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpTopMid")); if (wp) Overlay_TopMid = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpTopRight")); if (wp) Overlay_TopRight = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpTopDown")); if (wp) Overlay_TopDown = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpLeftTop")); if (wp) Overlay_LeftTop = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpLeftMid")); if (wp) Overlay_LeftMid = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpLeftBottom")); if (wp) Overlay_LeftBottom = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpLeftDown")); if (wp) Overlay_LeftDown = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpRightTop")); if (wp) Overlay_RightTop = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpRightMid")); if (wp) Overlay_RightMid = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpRightBottom")); if (wp) Overlay_RightBottom = (wp->GetDataField()->GetAsInteger()); delete wf; wf = NULL; }
int main() { int isNormal; setVariables(); while (1) { calibrateInit(); displayCalibrate(); if(isCalibrated(&gAccRead)) { standbyInit(); countDown(); while(1) { if (resetFlag) break; sendReadySignal(); runTemp(&isNormal); if (isSafe && isNormal && hasEstablished) { initActive(); while(1) { int freq = calculateFreq(); runActive(freq); runTemp(&isNormal); if (resetFlag) break; if(isMayDay) { switchDisplayToMayDay(); break; } if(!isNormal || !isSafe || standbyFlag) { standbyFlag = 0; switchDisplayToStandby(); countDown(); break; } } if(resetFlag) { switchDisplayToCalibrate(); break; } if(isMayDay) { initMayDay(); runMayDay(); initLight(); switchDisplayToStandby(); countDown(); } } } } } }
void TSelectionClass::MakeSelection(UInt_t nEvents) {if(nEvents==0) this->nEvents=eventReader->GetEntries(); else if(nEvents>eventReader->GetEntries()){ cerr<<"nEvents is bigger than entries in eventReader tree: \""<<eventReader->getTree()->GetName()<<"\""<<endl; } else this->nEvents=nEvents; if(verbosity)cout<<"Make Selection"<<endl; if(verbosity)cout<<"goToSelectionTreeDir"<<endl; settings->goToSelectionTreeDir(); histSaver->SetNumberOfEvents(this->nEvents); createdTree=createSelectionTree(nEvents); if(!createdTree) return; this->setBranchAdressess(); createFiducialCut(); hFiducialCutSilicon->Reset(); hFiducialCutSiliconDiamondHit->Reset(); hFiducialCutSiliconOneAndOnlyOneDiamondHit->Reset(); hAnalysisFraction->Reset(); hSelectedEvents->Reset(); nUseForAlignment=0; nUseForAnalysis=0; nUseForSiliconAlignment=0; nValidButMoreThanOneDiaCluster=0; nValidSiliconNoDiamondHit=0; nNoValidSiliconTrack=0; nValidSiliconTrack=0; nValidSiliconAndDiamondCluster=0; nValidDiamondTrack=0; nSiliconTrackNotFiducialCut=0; nToBigDiamondCluster=0; cout<<"start selection in "<<nEvents<<" Events."<<endl; if(settings->getTrainingMethod()==TSettings::enumFraction) cout<<"Use Fraction Training, with fraction: "<<settings->getAlignment_training_track_fraction()*100.<<"%"<<endl; else cout<<"Use the first "<<settings->getAlignmentTrainingTrackNumber()<<" Events for Alignment!"<<endl; for(nEvent=0;nEvent<nEvents;nEvent++){ TRawEventSaver::showStatusBar(nEvent,nEvents,100,verbosity>=20); eventReader->LoadEvent(nEvent); if(verbosity>10)cout<<"Loaded Event "<<nEvent<<flush; resetVariables(); if(verbosity>10)cout<<"."<<flush; setVariables(); if(verbosity>10)cout<<"."<<flush; selectionTree->Fill(); if(verbosity>10)cout<<"DONE"<<endl; } createCutFlowDiagramm(); }
void perspectiveTransform() { processImage = windowImage; setVariables(); //设置四个预设的点 setPoints(); //选取图片上的点 cvDestroyWindow("monitor"); windowImage = cvCreateImage(cvSize(squareWindowSize,squareWindowSize), IPL_DEPTH_8U, 3); cvGetPerspectiveTransform(originalPoints, transPoints, transmat); //计算transmat的值 cvWarpPerspective(processImage , windowImage , transmat); //这一句利用transmat进行变换 cvNamedWindow("control"); cvMoveWindow("control", middlewindowX, middlewindowY); cvShowImage("control", windowImage); cvWaitKey(); cvDestroyWindow("control"); }
bool ShaderProgram::updateProceduralVariable(const Char8 *name, ProcVarFunctor pFunc, UInt32 uiDependency) { if(_sfVariables.getValue() == NULL) { ShaderProgramVariablesUnrecPtr pParam = ShaderProgramVariables::create(); setVariables(pParam); } return _sfVariables.getValue()->updateProceduralVariable(name, pFunc, uiDependency); }
//////////////////////////////////////// Creation obj Capture void MainWindow::on_pushButton_4_clicked() { if(setVariables()) { _capture = new Capture(); _capture->setAttribute(Qt::WA_DeleteOnClose); _capture->show(); _capture->startThreadsAndTransformHough(&_index, &_threshold1, &_threshold2, &_apertureSize, &_l2gradient, &_rho, &_theta, &_threshold, &_srn, &_stn, &_min_theta, &_max_theta); // Set Disable Button then Capture will be opened ui->pushButton_4->setEnabled(false); // Set Enabled Button then Capture will be closed connect(_capture, SIGNAL(quit()), this, SLOT(pushButton_4())); } }
void dlgCustomMenuShowModal(void){ WndProperty *wp; wf = dlgLoadFromXML(CallBackTable, IDR_XML_CUSTOMMENU); if (!wf) return; setVariables(); wf->ShowModal(); wp = (WndProperty*)wf->FindByName(TEXT("prpCustomMenu1")); if (wp) CustomMenu1 = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpCustomMenu2")); if (wp) CustomMenu2 = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpCustomMenu3")); if (wp) CustomMenu3 = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpCustomMenu4")); if (wp) CustomMenu4 = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpCustomMenu5")); if (wp) CustomMenu5 = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpCustomMenu6")); if (wp) CustomMenu6 = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpCustomMenu7")); if (wp) CustomMenu7 = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpCustomMenu8")); if (wp) CustomMenu8 = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpCustomMenu9")); if (wp) CustomMenu9 = (wp->GetDataField()->GetAsInteger()); wp = (WndProperty*)wf->FindByName(TEXT("prpCustomMenu10")); if (wp) CustomMenu10 = (wp->GetDataField()->GetAsInteger()); delete wf; wf = NULL; }
void BBSISPOptimizerJP::calculateBlockAssignment(void) { clear(); generateBBRecords(); generateBBConnections(); generateKnapsackILPFormulation(); stringstream str; for(uint32_t i = 0; i < ilp_knapsack_formulation.size(); i++) { str << ilp_knapsack_formulation[i]; } LOG_INFO(logger, "Formulation: " << str.str()); vector<lp_result_set> lp_result = writeAndSolveILPFile(ilp_knapsack_formulation); setAssignment(lp_result); setVariables(lp_result); }
bool ShaderProgram::addOSGVariable(const Char8 *name) { if(_sfVariables.getValue() == NULL) { ShaderProgramVariablesUnrecPtr pVar = ShaderProgramVariables::create(); setVariables(pVar); } #if 0 return _sfVariables.getValue()->addOSGVariable( name, editMFProceduralVariableLocations()); #else return _sfVariables.getValue()->addOSGVariable(name, NULL); #endif }
void TSelectionClass::createFiducialCut(){ // std::vector<std::pair<Float_t,Float_t> > xInt,yInt; // xInt.push_back( make_pair(settings->getSi_avg_fidcut_xlow(),settings->getSi_avg_fidcut_xhigh())); // yInt.push_back( make_pair(settings->getSi_avg_fidcut_ylow(),settings->getSi_avg_fidcut_yhigh())); // fiducialCuts = new TFidCutRegions(xInt,yInt,1); fiducialCuts = settings->getSelectionFidCuts(); cout<<"Create AutoFidCut with "<<endl; fiducialCuts->Print(1); UInt_t nEvents = settings->getAutoFidCutEvents(); if(nEvents>eventReader->GetEntries())nEvents=eventReader->GetEntries(); cout<<" "<<nEvents<<endl; for(nEvent=0;nEvent<nEvents;nEvent++){ TRawEventSaver::showStatusBar(nEvent,nEvents,100,verbosity>=20); eventReader->LoadEvent(nEvent); if(verbosity>10)cout<<"Loaded Event "<<nEvent<<flush; resetVariables(); if(verbosity>10)cout<<"."<<flush; setVariables(); } // findFiducialCut(hFiducialCutSiliconDiamondHit); if(settings->getUseAutoFidCut()==true){ delete fiducialCuts; fiducialCuts = new TFidCutRegions(hFiducialCutSiliconDiamondHit,settings->getNDiamonds(),settings->getAutoFidCutPercentage()); fiducialCuts->setRunDescription(settings->getRunDescription()); } else{ fiducialCuts->setHistogramm(hFiducialCutSiliconDiamondHit); } histSaver->SaveCanvas(fiducialCuts->getFiducialCutCanvas(TPlaneProperties::X_COR)); histSaver->SaveCanvas(fiducialCuts->getFiducialCutCanvas(TPlaneProperties::Y_COR)); TCanvas *c1 = fiducialCuts->getFiducialCutCanvas(TPlaneProperties::XY_COR); c1->SetTitle(Form("Fiducial Cut of Run %i with \"%s\"",settings->getRunNumber(),settings->getRunDescription().c_str())); c1->SetName("cFidCutCanvasXY"); histSaver->SaveCanvas(c1); if(verbosity) fiducialCuts->Print(1); if (verbosity>3&&verbosity%2==1){ cout<<"Press a key and enter to continue..."<<flush; char t; cin >>t; }
void HttpInterface::sendSetVariable(const std::string nodeName, const strings& args) { // get node id, variable position and length if (verbose) cerr << "setVariables " << nodeName << " " << args[0]; unsigned nodePos, varPos; const bool exists(getNodeAndVarPos(nodeName, args[0], nodePos, varPos)); if (!exists) return; if (verbose) cerr << " (" << nodePos << "," << varPos << "):" << args.size()-1 << endl; // send the message SetVariables::VariablesVector data; for (size_t i=1; i<args.size(); ++i) data.push_back(atoi(args[i].c_str())); SetVariables setVariables(nodePos, varPos, data); setVariables.serialize(asebaStream); asebaStream->flush(); }
bool ComputeShaderChunk::addOSGVariable(const Char8 *name) { if(_sfVariables.getValue() == NULL) { ShaderProgramVariablesUnrecPtr pVar = ShaderProgramVariables::createDependent( this->getFieldFlags()->_bNamespaceMask); setVariables(pVar); if(_mfComputeShader.size() > 0) { _mfComputeShader[0]->setVariables(this->getVariables()); } } return _sfVariables.getValue()->addOSGVariable( name, editMFProceduralVariableLocations()); }
double NGSRateCat::optimizeParameters(double epsilon) { int ndim = getNDim(); // return if nothing to be optimized if (ndim == 0) return 0.0; cout << "Optimizing " << name << " model parameters..." << endl; double *variables = new double[ndim+1]; double *upper_bound = new double[ndim+1]; double *lower_bound = new double[ndim+1]; bool *bound_check = new bool[ndim+1]; int i; double score; // by BFGS algorithm setVariables(variables); for (i = 1; i <= ndim; i++) { //cout << variables[i] << endl; lower_bound[i] = 1e-4; upper_bound[i] = 100.0; bound_check[i] = false; } for (i = ndim-ncategory+2; i <= ndim; i++) upper_bound[i] = 1.0; //packData(variables, lower_bound, upper_bound, bound_check); score = -minimizeMultiDimen(variables, ndim, lower_bound, upper_bound, bound_check, max(epsilon, 1e-6)); getVariables(variables); delete [] bound_check; delete [] lower_bound; delete [] upper_bound; delete [] variables; return score; }
void *runMasterSlave(char* myAddress){ //Hier gaan we een rij van laadpalen bijhouden en tegelijk een server runnen waarop nieuwe laadpalen zich kunnen "aanmelden". //Verder moeten de clients zich met deze server connecteren waarna de maser de clients verbindt met de auto. char* tekst=malloc(tekstlengte*sizeof(char*)); char* buffer=malloc(bufferlengte*sizeof(char*)); struct sockaddr_storage client_addr; socklen_t clilen; int socket2, error; struct arg input=startServer(poort-2,myAddress); IPAdressen=malloc(max_laadpalen*sizeof(char*)); aantal=1; IPAdressen[0]=malloc(IPLengte); sprintf(IPAdressen[0],"%s",myAddress); while(1){ //We nemen aan dat de client/andere laadpaal maar 1 boodschap verzend en ontvangt, zodat we hiervoor geen nieuwe thread gaan aanmaken input.hints.ai_flags=AI_PASSIVE; memset(&client_addr, 0, sizeof(client_addr)); clilen=16; socket2=accept(input.socket1, (struct sockaddr *)&client_addr, &clilen); if(socket2<0){ printf("problemen bij accept, error nummer %i, boodschap: %s\n",socket2, gai_strerror(socket2)); return NULL; } printf("de clilen is %i\n",clilen); //Hier moeten we het tekstobject omvormen tot een json object en dit json object vervolgens uitlezen en verwerken. error=read(socket2,buffer,255); tekst=setVariables(buffer); error=send(socket2,tekst,strlen(tekst)*sizeof(char),input.hints.ai_flags); if(error<0){ printf("problemen bij verzenden van hetpakket\n"); } close(socket2); } }
TestOptiCluster::TestOptiCluster() { //setup m = MothurOut::getInstance(); TestDataSet data; filenames = data.getSubsetFNGFiles(100); //Fasta, name, group returned string inputString = "fasta=" + filenames[0]; m->mothurOut("/******************************************/"); m->mothurOutEndLine(); m->mothurOut("Running command: dist.seqs(" + inputString + ")"); m->mothurOutEndLine(); m->mothurCalling = true; Command* distCommand = new DistanceCommand(inputString); distCommand->execute(); map<string, vector<string> > outputFilenames = distCommand->getOutputFiles(); delete distCommand; m->mothurCalling = false; columnFile = outputFilenames["column"][0]; matrix = new OptiMatrix(columnFile, filenames[1], "name", "column", 0.03, false); setVariables(matrix, "mcc"); }
void Wreath::ClearOrder() { d_ords.erase(d_ords.begin(),d_ords.end()); vector<vector<Variable> > empty; // do not delete setVariables(empty); };
void dlgInfoPagesShowModal(void){ WndProperty *wp; TCHAR filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgInfoPages.xml")); wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_INFOPAGES")); if (!wf) return; setVariables(); changed = false; wf->ShowModal(); wp = (WndProperty*)wf->FindByName(TEXT("prpIP11")); if (wp) { if (ConfIP11 != (wp->GetDataField()->GetAsBoolean())) { ConfIP11 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP12")); if (wp) { if (ConfIP12 != (wp->GetDataField()->GetAsBoolean())) { ConfIP12 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP13")); if (wp) { if (ConfIP13 != (wp->GetDataField()->GetAsBoolean())) { ConfIP13 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP14")); if (wp) { if (ConfIP14 != (wp->GetDataField()->GetAsBoolean())) { ConfIP14 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP15")); if (wp) { if (ConfIP15 != (wp->GetDataField()->GetAsBoolean())) { ConfIP15 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP16")); if (wp) { if (ConfIP16 != (wp->GetDataField()->GetAsBoolean())) { ConfIP16 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP17")); if (wp) { if (ConfIP17 != (wp->GetDataField()->GetAsBoolean())) { ConfIP17 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP21")); if (wp) { if (ConfIP21 != (wp->GetDataField()->GetAsBoolean())) { ConfIP21 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP22")); if (wp) { if (ConfIP22 != (wp->GetDataField()->GetAsBoolean())) { ConfIP22 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP23")); if (wp) { if (ConfIP23 != (wp->GetDataField()->GetAsBoolean())) { ConfIP23 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP24")); if (wp) { if (ConfIP24 != (wp->GetDataField()->GetAsBoolean())) { ConfIP24 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP31")); if (wp) { if (ConfIP31 != (wp->GetDataField()->GetAsBoolean())) { ConfIP31 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP32")); if (wp) { if (ConfIP32 != (wp->GetDataField()->GetAsBoolean())) { ConfIP32 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpIP33")); if (wp) { if (ConfIP33 != (wp->GetDataField()->GetAsBoolean())) { ConfIP33 = (wp->GetDataField()->GetAsBoolean()); changed=true; } } if (changed) { UpdateConfIP(); MessageBoxX (hWndMainWindow, gettext(TEXT("_@M1608_")), // infopages config saved TEXT(""), MB_OK); } delete wf; wf = NULL; }
void dlgTopologyShowModal(void){ if (LKTopo<1) { MessageBoxX (hWndMainWindow, // LKTOKEN _@M502_ = "Only LKMaps can be configured, sorry!" gettext(TEXT("_@M502_")), TEXT(""), MB_OK); return; } WndProperty *wp; char filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgTopology.xml")); wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_TOPOLOGY")); if (!wf) return; setVariables(); changed = false; wf->ShowModal(); wp = (WndProperty*)wf->FindByName(TEXT("prpCat10")); if (wp) { if (HaveZoomTopology(5)) if ( LKTopoZoomCat05 != wp->GetDataField()->GetAsFloat()) { LKTopoZoomCat05 = wp->GetDataField()->GetAsFloat()/RZC; ChangeZoomTopology(5,LKTopoZoomCat05,0); changed = true; } } if (wp) { if (HaveZoomTopology(10)) if ( LKTopoZoomCat10 != wp->GetDataField()->GetAsFloat()) { LKTopoZoomCat10 = wp->GetDataField()->GetAsFloat()/RZC; ChangeZoomTopology(10,LKTopoZoomCat10,0); changed = true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpCat20")); if (wp) { if (HaveZoomTopology(20)) if ( LKTopoZoomCat20 != wp->GetDataField()->GetAsFloat()) { LKTopoZoomCat20 = wp->GetDataField()->GetAsFloat()/RZC; ChangeZoomTopology(20,LKTopoZoomCat20,0); changed = true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpCat30")); if (wp) { if (HaveZoomTopology(30)) if ( LKTopoZoomCat30 != wp->GetDataField()->GetAsFloat()) { LKTopoZoomCat30 = wp->GetDataField()->GetAsFloat()/RZC; ChangeZoomTopology(30,LKTopoZoomCat30,0); changed = true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpCat40")); if (wp) { if (HaveZoomTopology(40)) if ( LKTopoZoomCat40 != wp->GetDataField()->GetAsFloat()) { LKTopoZoomCat40 = wp->GetDataField()->GetAsFloat()/RZC; ChangeZoomTopology(40,LKTopoZoomCat40,0); changed = true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpCat50")); if (wp) { if (HaveZoomTopology(50)) if ( LKTopoZoomCat50 != wp->GetDataField()->GetAsFloat()) { LKTopoZoomCat50 = wp->GetDataField()->GetAsFloat()/RZC; ChangeZoomTopology(50,LKTopoZoomCat50,0); changed = true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpCat60")); if (wp) { if (HaveZoomTopology(60)) if ( LKTopoZoomCat60 != wp->GetDataField()->GetAsFloat()) { LKTopoZoomCat60 = wp->GetDataField()->GetAsFloat()/RZC; ChangeZoomTopology(60,LKTopoZoomCat60,0); changed = true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpCat70")); if (wp) { if (HaveZoomTopology(70)) if ( LKTopoZoomCat70 != wp->GetDataField()->GetAsFloat()) { LKTopoZoomCat70 = wp->GetDataField()->GetAsFloat()/RZC; ChangeZoomTopology(70,LKTopoZoomCat70,0); changed = true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpCat80")); if (wp) { if (HaveZoomTopology(80)) if ( LKTopoZoomCat80 != wp->GetDataField()->GetAsFloat()) { LKTopoZoomCat80 = wp->GetDataField()->GetAsFloat()/RZC; ChangeZoomTopology(80,LKTopoZoomCat80,0); changed = true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpCat90")); if (wp) { if (HaveZoomTopology(90)) if ( LKTopoZoomCat90 != wp->GetDataField()->GetAsFloat()) { LKTopoZoomCat90 = wp->GetDataField()->GetAsFloat()/RZC; ChangeZoomTopology(90,LKTopoZoomCat90,0); changed = true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpCat100")); if (wp) { if (HaveZoomTopology(100)) if ( LKTopoZoomCat100 != wp->GetDataField()->GetAsFloat()) { LKTopoZoomCat100 = wp->GetDataField()->GetAsFloat()/RZC; ChangeZoomTopology(100,LKTopoZoomCat100,0); changed = true; } } wp = (WndProperty*)wf->FindByName(TEXT("prpCat110")); if (wp) { if (HaveZoomTopology(110)) if ( LKTopoZoomCat110 != wp->GetDataField()->GetAsFloat()) { LKTopoZoomCat110 = wp->GetDataField()->GetAsFloat()/RZC; ChangeZoomTopology(110,LKTopoZoomCat110,0); changed = true; } } delete wf; wf = NULL; }