Changeset 2187 in Sophya for trunk/ArchTOIPipe/Kernel/toimanager.cc
- Timestamp:
- Sep 9, 2002, 5:33:16 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/toimanager.cc
r2133 r2187 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: toimanager.cc,v 1.1 6 2002-07-26 08:52:43 vfebvreExp $5 // $Id: toimanager.cc,v 1.17 2002-09-09 15:33:15 aubourg Exp $ 6 6 7 7 #include "toimanager.h" … … 10 10 #include <iostream.h> 11 11 #include <unistd.h> 12 #include <map> 12 13 13 14 #ifndef MAXINT … … 18 19 reqBegin = 0; 19 20 reqEnd = MAXINT; 21 22 // -----------ajout cgt vf 19/08/2002 23 // par defaut TOISegmented 24 selectTOISegmented(1024, 20); 25 // ----------- fin ajout cgt 26 20 27 } 21 28 … … 27 34 } 28 35 36 // ajout vf 26/07/2002 37 29 38 // enregistrement d'un processeur dans la liste des processeurs pour une execution en groupe 30 39 … … 37 46 38 47 39 // demarrage de tous les processeurs 48 // demarrage de tous les processeurs et verification auto des samplenum pour chaque processeur parametre 40 49 41 50 void TOIManager::startAll() { 51 // verification des samplenum 52 bool samples_ok=checkSamplesLimits(1); 53 if (samples_ok) { 54 cout << "All limits ok" << endl << "Starting processors" << endl; 55 } else { 56 cout << "One or more limits ajusted for execution" << endl << "Starting processors" << endl; 57 } 58 59 // mise a jour des limites apres verification 60 checkSamplesLimits(2); 61 checkSamplesLimits(3); 62 63 // debogage affichage des limites apres calcul 42 64 for (vector<TOIProcessor*>::iterator i = processors.begin(); 43 65 i != processors.end(); i++) { 44 66 TOIProcessor* proc = *i; 45 cout << "******************" << endl; 46 cout << "starting processor " << endl; 47 cout << "******************" << endl; 67 proc->printLimits(); 68 } 69 70 // demarrage 71 for (vector<TOIProcessor*>::iterator i = processors.begin(); 72 i != processors.end(); i++) { 73 TOIProcessor* proc = *i; 74 cout << "**********************" << endl; 75 cout << "starting processor " << endl; 48 76 proc->start(); 49 77 cout << "processor started " << endl; 50 cout << "******************" << endl; 51 } 52 } 53 54 78 } 79 cout << "**********************" << endl; 80 } 81 82 bool TOIManager::checkSamplesLimits(int pass) 83 { 84 bool processor_ok=true; 85 bool samples_ok=true; 86 for (vector<TOIProcessor*>::iterator i = processors.begin(); 87 i != processors.end(); i++) { 88 TOIProcessor* proc = *i; 89 cout << "testing processor limits " << endl; 90 // test du processeur 91 92 // test seulement pour les processor cle 93 //if (proc->getRequested()) { 94 processor_ok = proc->checkSampleLimits(pass); 95 //} 96 97 if (processor_ok) { 98 cout << "processor limits ok " << endl; 99 } else { 100 cout << "processor limits ajusted" << endl; 101 samples_ok = false; 102 } 103 } 104 return samples_ok; 105 } 106 107 // fin ajout vf 55 108 56 109 void TOIManager::setRequestedSample(int begin, int end) { … … 85 138 } 86 139 } 140 141 142 // -----------ajout cgt vf 19/08/2002 143 144 145 void TOIManager::selectTOISegmented(int bufsz, int maxseg) 146 { 147 fgSegmented = true; 148 segBuffsz = bufsz; 149 segMaxseg = maxseg; 150 } 151 152 void TOIManager::selectTOISeqBuffered(int wsz) 153 { 154 fgSegmented = false; 155 segBuffsz = wsz; 156 } 157 158 // methode connect de cgt simplifiee et corrigee 159 TOI& TOIManager::connect(TOIProcessor& prout, string& out, 160 TOIProcessor& prin, string& in, string nom, int wbsz, bool withFlag) 161 { 162 TOI* toi; 163 if (nom.length() < 1) { 164 char buff[128]; 165 sprintf(buff, "TOI%s_[%s-%s]", nom, in, out); 166 nom = buff; 167 } 168 if (wbsz < 16) wbsz = segBuffsz; 169 170 // ajout test pour eviter de creer 2 tois en sortie 171 if ((toi=prout.getOutToi(out)) == NULL) { 172 //cout << "toi cree" << endl; 173 if (fgSegmented) toi = new TOISegmented(nom, wbsz, segMaxseg); 174 else toi = new TOISeqBuffered(nom, wbsz); 175 // on ajoute le toi de sortie 176 prout.addOutput(out, toi); 177 } else { 178 //cout << "toi deja cree stop" << endl; 179 } 180 181 if (withFlag) { // Si c'est un FITSTOIWriter 182 FITSTOIWriter* ftw = dynamic_cast< FITSTOIWriter* >(&prin); 183 if (ftw) ftw->addInput(in, toi, withFlag); 184 else prin.addInput(in, toi); 185 } 186 else prin.addInput(in, toi); 187 return(*toi); 188 } 189 190 191 TOI& TOIManager::connect(TOIProcessor& prout, const char* out, 192 TOIProcessor& prin, const char* in, string nom, int wbsz, bool withFlag) 193 { 194 string outs = out; 195 string ins = in; 196 return connect(prout, outs, prin, ins, nom, wbsz, withFlag); 197 } 198 199 // ----------- fin ajout cgt 200 87 201 88 202 … … 164 278 165 279 } 280 281 282 283 284 285 286 287 288 289 290 291 292 293
Note:
See TracChangeset
for help on using the changeset viewer.