Changeset 424 in PSPA for Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
- Timestamp:
- Sep 30, 2013, 5:03:21 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r419 r424 5 5 #include "softwareTransport.h" 6 6 #include "GWt_pspaApplication.h" 7 #include "GWt_console.h" Ã7 #include "GWt_console.h" 8 8 #include "softwareGenerator.h" 9 9 #include "softwareTest.h" … … 12 12 #include <stdio.h> 13 13 #include <fstream> 14 15 #include "UAP/UAPUtilities.hpp" 16 #include "AML/AMLReader.hpp" 14 17 15 18 dataManager::dataManager(PspaApplication* pspa) : … … 102 105 void dataManager::clearSectionToExecute(int a) { 103 106 cout << " dataManager::clearSectionToExecute efaacement section d'index : " << a << endl; 104 if (a <0) return;105 if (a >=jobList_.size()) return;106 107 // lors de la creation de la section on a fait un 'new' d'un softwareXXXX108 // on fait ici le 'delete'107 if (a < 0) return; 108 if (a >= (int)jobList_.size()) return; 109 110 // lors de la creation de la section on a fait un 'new' d'un 111 // softwareXXXX : on fait ici le 'delete' 109 112 110 113 const abstractSoftware* soft = jobList_.at(a)->getSoftware(); 111 114 if ( soft != NULL ) delete soft; 112 115 jobList_.erase (jobList_.begin()+a); 113 116 } … … 151 154 abstractSoftware* softw = NULL; 152 155 string workingDir = pspa_->getWorkingDir(); 153 int debut; 154 int fin; 156 155 157 // on verifie la consecution des sections 156 158 int lastel = 0; 157 for(unsigned k = 0; k < jobList_.size(); k++) 158 {159 if ( jobList_[k]->getElementNumberInSection() != lastel +1 ) {160 consoleMessage("dataManager::executeAll ERROR : sections should be consecutive ");161 return false; 162 } else {163 lastel = jobList_[k]->getLastElementNumberInSection(); 164 165 } 166 167 for(unsigned k = 0; k < jobList_.size(); k++)168 169 159 for(unsigned k = 0; k < jobList_.size(); k++) { 160 if ( jobList_[k]->getElementNumberInSection() != lastel +1 ) { 161 consoleMessage("dataManager::executeAll ERROR : sections should be consecutive "); 162 return false; 163 } else { 164 lastel = jobList_[k]->getLastElementNumberInSection(); 165 } 166 } 167 168 unsigned debut; 169 unsigned fin; 170 for(unsigned k = 0; k < jobList_.size(); k++) { 171 cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->getSoftware()->getName()) << endl; 170 172 171 172 173 174 175 173 debut = jobList_[k]->getElementNumberInSection(); 174 fin = jobList_[k]->getLastElementNumberInSection(); 175 softw = jobList_[k]->getSoftware(); 176 177 if (softw == NULL) { 176 178 success = false; 177 179 consoleMessage("dataManager::executeAll : unknown software"); … … 196 198 if ( !success ) break; 197 199 198 199 200 if ( debut < firstComputedElemNumero_ ) firstComputedElemNumero_ = debut; 200 201 if ( fin > lastComputedElemNumero_ ) lastComputedElemNumero_ = fin; … … 203 204 cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl; 204 205 cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl; 205 for ( intj = debut; j <= fin; j++) {206 for (unsigned j = debut; j <= fin; j++) { 206 207 abstractElement* elPtr= getElementPointerFromNumero(j); 207 208 cout << "[" << j << "] " << elPtr->getNomdElement().getExpandedName() << endl; 208 209 } 209 210 } //k 210 211 211 212 cout << " dataManager::executeAll premier element : " << firstComputedElemNumero_ << " dernier : " << lastComputedElemNumero_ << endl; 212 213 213 return success; 214 214 } … … 233 233 outfile << globParam_.FileOutputFlow(); 234 234 abstractElement* elPtr; 235 for( unsignedk = 0; k < getBeamLineSize() ; k++)235 for(int k = 0; k < getBeamLineSize() ; k++) 236 236 { 237 238 237 elPtr = pspa_->getBeamLine()->getAbstractElement(k); 238 outfile << elPtr->FileOutputFlow(); 239 239 } 240 240 outfile.close(); 241 } 242 243 // ecriture sur fichier AML 244 void dataManager::writeToAMLFile(string fileName) 245 { 246 UAPNode* uap_root = NULL; 247 uap_root = new UAPNode("UAP_root"); 248 UAPNode* rep = uap_root->addChild("AML_representation"); 249 250 // root node in the hierarchy 251 UAPNode* lab = rep->addChild("laboratory"); 252 lab->addAttribute("name","PSPA lab"); 253 254 // general global parameters 255 globParam_.InputRep(lab); 256 257 // accelerator or section of accelerator 258 //UAPNode* acc = lab->addChild("machine"); 259 //acc->addAttribute("name",fileName); 260 261 // sequence of elements 262 UAPNode* sect = lab->addChild("sector"); 263 sect->addAttribute("name","a_sect"); 264 265 abstractElement* elPtr; 266 for(int k = 0; k < getBeamLineSize() ; k++) { 267 elPtr = pspa_->getBeamLine()->getAbstractElement(k); 268 elPtr->InputRep(sect); 269 } 270 271 cout << "!Create the AML file ---------------------------" << endl; 272 AMLReader reader; 273 string aml_file = pspa_->getWorkingDir() + "/" + fileName + ".aml"; 274 reader.AMLRepToAMLFile (uap_root, aml_file); 241 275 } 242 276
Note: See TracChangeset
for help on using the changeset viewer.