1 | #include "sectionToExecute.h" |
---|
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 |
---|
10 | |
---|
11 | |
---|
12 | sectionToExecute::sectionToExecute(abstractElement* f, abstractSoftware* s) { |
---|
13 | elements_.push_back(f); |
---|
14 | if (s == NULL) { |
---|
15 | software_ = new softwareUnknown(); |
---|
16 | } else { |
---|
17 | software_ = s; |
---|
18 | } |
---|
19 | } |
---|
20 | |
---|
21 | |
---|
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; |
---|
32 | } |
---|
33 | |
---|
34 | |
---|
35 | void sectionToExecute::setSoftware(std::string logiciel) { |
---|
36 | |
---|
37 | abstractSoftware* prog; |
---|
38 | string inputFileName; |
---|
39 | if(logiciel == "parmela") { |
---|
40 | inputFileName = "parmin"; |
---|
41 | prog = new softwareParmela(inputFileName, this); |
---|
42 | } else if (logiciel == "transport") { |
---|
43 | inputFileName = "transport.input"; |
---|
44 | prog = new softwareTransport(inputFileName, this); |
---|
45 | } else if (logiciel == "generator") { |
---|
46 | inputFileName = "generator.in"; |
---|
47 | prog = new softwareGenerator(inputFileName, this); |
---|
48 | } else if (logiciel == "madx") { |
---|
49 | inputFileName = "madx.input"; |
---|
50 | prog = new softwareMadx(inputFileName,this); |
---|
51 | } else if (logiciel == "usersprogram") { |
---|
52 | inputFileName = "dummy"; |
---|
53 | prog = new softwareUsersprogram(inputFileName, this); |
---|
54 | } else if (logiciel == "test") { |
---|
55 | prog = new softwareTest(inputFileName, this); |
---|
56 | } else { |
---|
57 | prog = new softwareUnknown(); |
---|
58 | } |
---|
59 | |
---|
60 | setSoftware(prog); |
---|
61 | } |
---|
62 | |
---|