[385] | 1 | #include "sectionToExecute.h" |
---|
[469] | 2 | #include "softwareUnknown.h" |
---|
| 3 | #include "softwareParmela.h" |
---|
| 4 | #include "softwareTransport.h" |
---|
| 5 | #include "softwareGenerator.h" |
---|
| 6 | #include "softwareGenerator.h" |
---|
| 7 | #include "softwareUsersprogram.h" |
---|
| 8 | #include "softwareTest.h" |
---|
| 9 | #include "softwareMadx.h" //xx |
---|
[385] | 10 | |
---|
| 11 | |
---|
[455] | 12 | sectionToExecute::sectionToExecute(abstractElement* f, abstractSoftware* s) { |
---|
| 13 | elements_.push_back(f); |
---|
[469] | 14 | if (s == NULL) { |
---|
| 15 | software_ = new softwareUnknown(); |
---|
| 16 | } else { |
---|
[455] | 17 | software_ = s; |
---|
[469] | 18 | } |
---|
[455] | 19 | } |
---|
[385] | 20 | |
---|
| 21 | |
---|
[455] | 22 | bool sectionToExecute::insertAfter(abstractElement* previousElement,abstractElement* currentElement) { |
---|
| 23 | |
---|
| 24 | std::vector<abstractElement*>::iterator it; |
---|
| 25 | for (it = elements_.begin(); it < elements_.end(); it++) { |
---|
| 26 | if (*it == previousElement ) { |
---|
| 27 | elements_.insert (it+1,currentElement); |
---|
| 28 | return true; |
---|
| 29 | } |
---|
| 30 | } |
---|
| 31 | return false; |
---|
[385] | 32 | } |
---|
[419] | 33 | |
---|
[469] | 34 | |
---|
| 35 | void sectionToExecute::setSoftware(std::string logiciel) { |
---|
| 36 | |
---|
[455] | 37 | abstractSoftware* prog; |
---|
| 38 | string inputFileName; |
---|
[469] | 39 | if(logiciel == "parmela") { |
---|
[455] | 40 | inputFileName = "parmin"; |
---|
| 41 | prog = new softwareParmela(inputFileName, this); |
---|
[469] | 42 | } else if (logiciel == "transport") { |
---|
[455] | 43 | inputFileName = "transport.input"; |
---|
| 44 | prog = new softwareTransport(inputFileName, this); |
---|
[469] | 45 | } else if (logiciel == "generator") { |
---|
[455] | 46 | inputFileName = "generator.in"; |
---|
| 47 | prog = new softwareGenerator(inputFileName, this); |
---|
[469] | 48 | } else if (logiciel == "madx") { |
---|
[455] | 49 | inputFileName = "madx.input"; |
---|
| 50 | prog = new softwareMadx(inputFileName,this); |
---|
[469] | 51 | } else if (logiciel == "usersprogram") { |
---|
[455] | 52 | inputFileName = "dummy"; |
---|
| 53 | prog = new softwareUsersprogram(inputFileName, this); |
---|
[469] | 54 | } else if (logiciel == "test") { |
---|
[455] | 55 | prog = new softwareTest(inputFileName, this); |
---|
| 56 | } else { |
---|
[469] | 57 | prog = new softwareUnknown(); |
---|
[455] | 58 | } |
---|
| 59 | |
---|
[469] | 60 | setSoftware(prog); |
---|
[455] | 61 | } |
---|
[469] | 62 | |
---|