1 | #ifndef DATAMANAGER_SEEN |
---|
2 | #define DATAMANAGER_SEEN |
---|
3 | |
---|
4 | #include "abstractElement.h" |
---|
5 | #include "abstractSoftware.h" |
---|
6 | #include "globalParameters.h" |
---|
7 | #include "nomdElements.h" |
---|
8 | #include "particleBeam.h" |
---|
9 | #include "sectionToExecute.h" |
---|
10 | #include "nomDeLogiciel.h" |
---|
11 | #include "trivaluedBool.h" |
---|
12 | #include "beam2Moments.h" |
---|
13 | #include "parmelaParticle.h" |
---|
14 | #include "nomDeLogiciel.h" |
---|
15 | #include "sector.h" |
---|
16 | #include "expandedMachine.h" |
---|
17 | #include "computingBlock.h" |
---|
18 | |
---|
19 | #include "sectorParameters.h" //xx |
---|
20 | |
---|
21 | class PspaApplication; |
---|
22 | |
---|
23 | class dataManager |
---|
24 | { |
---|
25 | |
---|
26 | public: |
---|
27 | |
---|
28 | dataManager() : |
---|
29 | pspa_ (NULL), |
---|
30 | currentMachine_(NULL) |
---|
31 | {;} |
---|
32 | dataManager(PspaApplication*); |
---|
33 | virtual ~dataManager(); |
---|
34 | void consoleMessage(string message); |
---|
35 | inline globalParameters* getGlobalParameters() {return &globParam_;} |
---|
36 | |
---|
37 | particleBeam* getDiagnosticBeam(unsigned index); |
---|
38 | particleBeam* getDiagnosticBeam_deprecated(string elementLabel); |
---|
39 | |
---|
40 | |
---|
41 | //provisoire |
---|
42 | inline expandedMachine* getCurrentMachine() {return currentMachine_;} |
---|
43 | |
---|
44 | inline expandedMachine* expandMachine() { |
---|
45 | if ( !currentMachine_ ) currentMachine_ = new expandedMachine(this); |
---|
46 | currentMachine_->fromSectors( sectors_ ); |
---|
47 | return currentMachine_; |
---|
48 | } |
---|
49 | |
---|
50 | bool areDataCoherent() { |
---|
51 | bool resultat = false; |
---|
52 | if ( !currentMachine_ ) return false; |
---|
53 | resultat = currentMachine_->areDataCoherent(); |
---|
54 | return resultat; |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | /** Add a new sector |
---|
59 | */ |
---|
60 | sector* addNewSector(); |
---|
61 | |
---|
62 | /** return all sectors |
---|
63 | */ |
---|
64 | inline std::vector <sector*> getSectors() {return sectors_;}; |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | void initializeExecution(); |
---|
69 | |
---|
70 | bool executeAll(); |
---|
71 | |
---|
72 | void donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor, string& titre, string& legendx, string& legendy); |
---|
73 | |
---|
74 | /** |
---|
75 | Save a configuration file on the server |
---|
76 | @param folder |
---|
77 | @param filename |
---|
78 | */ |
---|
79 | // void saveConfiguration(string folder, string filename); |
---|
80 | // bool restoreElements(string inputFileName); |
---|
81 | bool restoreAMLElements(string inputFileName); |
---|
82 | |
---|
83 | void writeToAMLFile(string fileName); |
---|
84 | |
---|
85 | /** return the sectors size |
---|
86 | */ |
---|
87 | // inline unsigned long getSectorsSize() const { |
---|
88 | // return sectors_.size(); |
---|
89 | // } |
---|
90 | |
---|
91 | // si newBeam = true, on cree un nouveau diag |
---|
92 | // si newBeam = false, on utilise le dernier |
---|
93 | inline particleBeam* updateCurrentDiagnostic(bool newBeam) { |
---|
94 | if ( newBeam ) { |
---|
95 | diagnosticBeam_.push_back(particleBeam()); |
---|
96 | } |
---|
97 | indexElementToIndexDiag_.push_back(diagnosticBeam_.size() -1); |
---|
98 | return &diagnosticBeam_.back(); |
---|
99 | } |
---|
100 | |
---|
101 | |
---|
102 | /** |
---|
103 | Return the application attatch to this controler |
---|
104 | */ |
---|
105 | inline PspaApplication* getPspaApplication() { |
---|
106 | return pspa_; |
---|
107 | }; |
---|
108 | |
---|
109 | abstractElement* getElementInSectorsByLabel(string etiq); |
---|
110 | |
---|
111 | |
---|
112 | void messageEcran(string niveau, string msg) const; |
---|
113 | |
---|
114 | |
---|
115 | |
---|
116 | private: |
---|
117 | |
---|
118 | globalParameters globParam_; |
---|
119 | PspaApplication* pspa_; |
---|
120 | |
---|
121 | vector<particleBeam> diagnosticBeam_; |
---|
122 | vector<unsigned> indexElementToIndexDiag_; |
---|
123 | // vector <sector*> jobList_; |
---|
124 | vector <sector*> sectors_; |
---|
125 | expandedMachine* currentMachine_; |
---|
126 | void removeFile(string nameOfFile); |
---|
127 | }; |
---|
128 | #endif |
---|