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