Changeset 2187 in Sophya for trunk/ArchTOIPipe/Kernel/toiprocessor.cc
- Timestamp:
- Sep 9, 2002, 5:33:16 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/toiprocessor.cc
r2133 r2187 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: toiprocessor.cc,v 1.2 5 2002-07-26 08:52:43 vfebvreExp $5 // $Id: toiprocessor.cc,v 1.26 2002-09-09 15:33:15 aubourg Exp $ 6 6 7 7 #include "toiprocessor.h" … … 46 46 wontNeedValue = -1; 47 47 48 49 // ajout vf 23/07/2002 50 cout << "Creating processor" << endl; 48 51 // Pour referencer un TOIProcessor, il faut recuperer le TOIManager correspondant 49 52 TOIManager::getManager()->registerProcessor(this); 53 54 // initialisation des limites du sample (par defaut tout le fichier) 55 snBegin = 0; 56 snEnd = MAXINT; 57 snMin=MAXINT; 58 snMax=0; 59 // par defaut aucune condition 60 requestedSample = false; 50 61 51 62 } … … 83 94 84 95 int TOIProcessor::getMinOut() { 96 /* 85 97 //cout << name << "minout" << endl; 86 98 if (minOut < 0) minOut = calcMinOut(); 87 99 //cout << name << "minout=" << minOut << endl; 88 100 return minOut; 101 */ 102 return snBegin + lowExtra; 89 103 } 90 104 91 105 int TOIProcessor::getMaxOut() { 106 /* 92 107 //cout << name << "maxout" << endl; 93 108 if (maxOut < 0) maxOut = calcMaxOut(); 94 109 //cout << name << "maxout=" << maxOut << endl; 95 110 return maxOut; 111 */ 112 return snEnd - upExtra; 96 113 } 97 114 … … 105 122 106 123 int TOIProcessor::getMinIn() { 124 /* 107 125 int nIn = inIx.size(); 108 126 int minIn = 0; … … 115 133 if (forcedMinIn > 0 && forcedMinIn > minIn) minIn = forcedMinIn; 116 134 return minIn; 135 */ 136 return snBegin; 117 137 } 118 138 119 139 int TOIProcessor::getMaxIn() { 140 /* 120 141 int_4 nIn = inIx.size(); 121 142 int_4 maxIn = MAXINT; … … 128 149 if (forcedMaxIn > 0 && forcedMaxIn < maxIn) maxIn = forcedMaxIn; 129 150 return maxIn; 151 */ 152 return snEnd; 130 153 } 131 154 … … 447 470 448 471 449 450 451 452 453 454 455 472 // ajout vf 29/07/2002 473 474 // parametrage de l'echantillon a produire (sans verification) 475 void TOIProcessor::setRequestedSample(long begin, long end) { 476 requestedSample = true; 477 snBegin = begin; 478 snEnd = end; 479 // snMin = snBegin; 480 // snMax = snEnd; 481 } 482 483 484 bool TOIProcessor::checkSampleLimits(int pass) 485 { 486 long minTmp=MAXINT; 487 long maxTmp=-1; 488 489 return checkSampleLimits(minTmp, maxTmp, pass); 490 491 cout << "toiprocessor : limites verifiees : " << snBegin << " , " << snEnd << " : " << endl; 492 } 493 494 495 496 497 bool TOIProcessor::checkSampleLimits(long& min, long& max, int pass) 498 { 499 bool sample_input_ok=true; 500 bool sample_ok=true; 501 502 /* cout << "check " << pass << " " << name << " in " << min << " - " << max << " ; " 503 << snMin << " - " << snMax << " ; " 504 << snBegin << " - " << snEnd << endl;*/ 505 506 if (pass == 3) { 507 if (snMin < snMax) { 508 snBegin = snMin; 509 snEnd = snMax; 510 } 511 return true; 512 } 513 514 // on verifie qu'on peut effectivement produire 515 516 if (min < snBegin) { 517 min = snBegin; 518 } 519 520 if (max > snEnd) { 521 max = snEnd; 522 } 523 524 bool noConst = (min>max); 525 526 if (pass == 2 && noConst) { 527 min = snBegin; 528 max = snEnd; 529 } 530 531 532 int n = inIx.size(); 533 // parcours de toutes les entrees et mise a jour au plus restrictif 534 for (int i=0; i<n; i++) { 535 TOI* toi = inTOIs[i]; 536 if (toi) { 537 // mise a jour des limites avec les marges si definies 538 long min_Input; 539 long max_Input; 540 if (min>0) { 541 min_Input = min - lowExtra; 542 } else { 543 min_Input = min; 544 } 545 if (max<MAXINT) { 546 max_Input = max + upExtra; 547 } else { 548 max_Input = max; 549 } 550 // propagation des limites 551 sample_input_ok = toi->checkSampleLimits(min_Input, max_Input, pass); 552 553 //Ajustement des limites si plus restrictif 554 if (min < max) { 555 // On nous a demande des bornes -> 556 if ((min_Input + lowExtra) > min) { 557 min = min_Input + lowExtra; 558 } 559 if ((max_Input - upExtra) < max) { 560 max = max_Input - upExtra; 561 } 562 } else { 563 // On nous demande tout ce qu'on peut faire -> MAJ snBegin 564 if ((min_Input + lowExtra) > snBegin) { 565 snBegin = min_Input + lowExtra; 566 } 567 if ((max_Input - upExtra) < snEnd) { 568 snEnd = max_Input - upExtra; 569 } 570 } 571 if (sample_input_ok == false) { 572 sample_ok = false; 573 } 574 } 575 } 576 577 578 579 580 //Ajustement des limites si intervalle plus large 581 if (!noConst) { 582 if (min < snMin) { 583 snMin = min; 584 } 585 if (max > snMax) { 586 snMax = max; 587 } 588 } 589 590 min=min<snMin?snMin:min; 591 max=max>snMax?snMax:max; 592 593 594 // cas sans contraintes, on retourne nos bornes 595 if (min>max) { 596 min = snBegin; 597 max = snEnd; 598 } 599 600 /* cout << "check " << pass << " " << name << " out " << min << " - " << max << " ; " 601 << snMin << " - " << snMax << " ; " 602 << snBegin << " - " << snEnd << endl;*/ 603 return sample_ok; 604 } 605 606 607 608 609 // pour verification si le processeur est parametre 610 bool TOIProcessor::getRequested() 611 { 612 return requestedSample; 613 } 614 615 // affichage des limites 616 void TOIProcessor::printLimits() 617 { 618 cout << "toiprocessor " << name <<" : limites calculees : " << snBegin << " , " << snEnd << endl; 619 } 620 621 TOI* TOIProcessor::getOutToi(string sortie) 622 { 623 // recherche du nom de la sortie et verification si le toi existe deja 624 map<string, int>::iterator i = outIx.find(sortie); 625 if (i == outIx.end()) { 626 return NULL; 627 } else { 628 return outTOIs[(*i).second]; 629 } 630 } 631 632 633 634 635 636 637 638 639
Note:
See TracChangeset
for help on using the changeset viewer.