1 | // |
---|
2 | // sector.cpp |
---|
3 | // PSPA |
---|
4 | // |
---|
5 | // Created by Garnier Laurent on 10/12/13. |
---|
6 | // Copyright (c) 2013 Garnier Laurent. All rights reserved. |
---|
7 | // |
---|
8 | |
---|
9 | #include "sector.h" |
---|
10 | #include "softwareParmela.h" |
---|
11 | #include "softwareTransport.h" |
---|
12 | #include "softwareGenerator.h" |
---|
13 | #include "softwareGenerator.h" |
---|
14 | #include "softwareUsersprogram.h" |
---|
15 | #include "softwareTest.h" |
---|
16 | #include "softwareMadx.h" //xx |
---|
17 | #include "softwareUnknown.h" //xx |
---|
18 | |
---|
19 | #include "sectionToExecute.h" |
---|
20 | #include "dataManager.h" |
---|
21 | |
---|
22 | sector::sector(dataManager* data, std::string name): |
---|
23 | reflected_(false), |
---|
24 | duplicatedFrom_(NULL), |
---|
25 | repetitionNumber_(1), |
---|
26 | name_(name), |
---|
27 | dataManager_(data), |
---|
28 | sectorParam_(this) |
---|
29 | { |
---|
30 | |
---|
31 | } |
---|
32 | |
---|
33 | sector::~sector() { |
---|
34 | } |
---|
35 | |
---|
36 | void sector::addElementAfter(abstractElement* currentElement ,abstractElement* previousElement){ |
---|
37 | if (previousElement == NULL) { |
---|
38 | if (sectionToExecute_.size() == 0) { |
---|
39 | sectionToExecute_.push_back(new sectionToExecute(currentElement)); |
---|
40 | } else { |
---|
41 | sectionToExecute_.insert ( sectionToExecute_.begin() , new sectionToExecute(currentElement) ); |
---|
42 | } |
---|
43 | } else { |
---|
44 | |
---|
45 | for (unsigned int i=0; i<sectionToExecute_.size(); i++) { |
---|
46 | sectionToExecute* section = sectionToExecute_[i]; |
---|
47 | if (section->insertAfter(previousElement,currentElement)) { |
---|
48 | return; |
---|
49 | } |
---|
50 | } |
---|
51 | } |
---|
52 | } |
---|
53 | |
---|
54 | void sector::clearSectionToExecute() |
---|
55 | { |
---|
56 | unsigned k; |
---|
57 | for(k = 0; k < sectionToExecute_.size(); k++) |
---|
58 | { |
---|
59 | if ( sectionToExecute_[k] != NULL ) clearSectionToExecute(k); |
---|
60 | } |
---|
61 | sectionToExecute_.clear(); |
---|
62 | } |
---|
63 | |
---|
64 | void sector::clearSectionToExecute(int a) |
---|
65 | { |
---|
66 | cout << " dataManager::clearSectionToExecute : effacement de la section d'index = " << a << endl; |
---|
67 | if (a < 0) return; |
---|
68 | if (a >= (int)sectionToExecute_.size()) return; |
---|
69 | |
---|
70 | // lors de la creation de la section on a fait un 'new' d'un |
---|
71 | // softwareXXXX : on fait ici le 'delete' |
---|
72 | |
---|
73 | const abstractSoftware* soft = sectionToExecute_.at(a)->getSoftware(); |
---|
74 | if ( soft != NULL ) delete soft; |
---|
75 | sectionToExecute_.erase (sectionToExecute_.begin()+a); |
---|
76 | } |
---|