[493] | 1 | #ifndef COMPUTINGBLOCK_SEEN |
---|
| 2 | #define COMPUTINGBLOCK_SEEN |
---|
| 3 | |
---|
| 4 | #include <iostream> |
---|
| 5 | #include <vector> |
---|
| 6 | |
---|
| 7 | #include "abstractElement.h" |
---|
| 8 | #include "abstractSoftware.h" |
---|
| 9 | #include "UAP/UAPNode.hpp" |
---|
| 10 | |
---|
| 11 | //#include "sectionToExecute.h" |
---|
| 12 | |
---|
| 13 | using namespace std; |
---|
| 14 | |
---|
| 15 | class expandedMachine; |
---|
| 16 | |
---|
| 17 | class computingBlock |
---|
| 18 | { |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | friend class expandedMachine; |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | public: |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | inline abstractSoftware* getSoftware() const {return software_;} |
---|
| 31 | |
---|
| 32 | // vector< abstractElement* > getElementsX(); |
---|
| 33 | |
---|
| 34 | inline expandedMachine* getMachine() {return machine_;} |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | inline unsigned getRankOfFirstElement() { return rankOfFirstElement_;} |
---|
| 41 | |
---|
| 42 | inline unsigned getRankOfLastElement() { |
---|
| 43 | return rankOfFirstElement_ + numberOfelements_ - 1; |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | abstractElement* getFirstElement(); |
---|
| 47 | abstractElement* getLastElement(); |
---|
| 48 | abstractElement* getElement(unsigned ind); |
---|
| 49 | |
---|
| 50 | bool isEmpty() { |
---|
| 51 | if ( numberOfelements_ ) return false; |
---|
| 52 | else return true; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | inline unsigned getNumberOfElements() { return numberOfelements_;} |
---|
| 56 | |
---|
| 57 | private: |
---|
| 58 | |
---|
| 59 | computingBlock() {;} |
---|
| 60 | |
---|
| 61 | computingBlock(unsigned premier, unsigned nombre, abstractSoftware* s,expandedMachine* mch); |
---|
| 62 | |
---|
| 63 | computingBlock(expandedMachine* mac) : machine_(mac) {;} |
---|
| 64 | |
---|
| 65 | void FileAMLOutput(UAPNode* root); |
---|
| 66 | void FileAMLInput( UAPNode* entree); |
---|
| 67 | |
---|
| 68 | inline void setSoftware(abstractSoftware* sw) {software_ = sw;} |
---|
| 69 | |
---|
| 70 | inline bool removeFirstElement() { |
---|
| 71 | rankOfFirstElement_++; |
---|
| 72 | numberOfelements_--; |
---|
| 73 | return checkCompatibilityWithMachine(); |
---|
| 74 | }; |
---|
| 75 | |
---|
| 76 | inline bool extendByTheEnd(unsigned nombre) { |
---|
| 77 | numberOfelements_ += nombre; |
---|
| 78 | return checkCompatibilityWithMachine(); |
---|
| 79 | }; |
---|
| 80 | |
---|
| 81 | inline bool suppressByTheEnd(unsigned nombre) { |
---|
| 82 | numberOfelements_ -= nombre; |
---|
| 83 | return checkCompatibilityWithMachine(); |
---|
| 84 | }; |
---|
| 85 | |
---|
| 86 | inline bool removeLastElement() { |
---|
| 87 | numberOfelements_--; |
---|
| 88 | return checkCompatibilityWithMachine(); |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | bool checkCompatibilityWithMachine(); |
---|
| 92 | |
---|
| 93 | bool checkCoherence(string& diagnosticErrors, string& diagnosticWarnings); |
---|
| 94 | |
---|
| 95 | inline void clearElements() { numberOfelements_ = 0; } |
---|
| 96 | inline void clearAll() { if ( software_ ) delete software_; software_=NULL;} |
---|
| 97 | inline bool reinitialiseElements(unsigned first, unsigned number) { |
---|
| 98 | rankOfFirstElement_ = first; |
---|
| 99 | numberOfelements_ = number; |
---|
| 100 | return checkCompatibilityWithMachine(); |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | abstractSoftware* software_; |
---|
| 107 | unsigned rankOfFirstElement_; |
---|
| 108 | unsigned numberOfelements_; |
---|
| 109 | expandedMachine* machine_; |
---|
| 110 | }; |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | |
---|
| 114 | #endif |
---|
| 115 | |
---|