#ifndef COMPUTINGBLOCK_SEEN #define COMPUTINGBLOCK_SEEN #include #include #include "abstractElement.h" #include "abstractSoftware.h" #include "UAP/UAPNode.hpp" //#include "sectionToExecute.h" using namespace std; class expandedMachine; class computingBlock { friend class expandedMachine; public: inline abstractSoftware* getSoftware() const {return software_;} // vector< abstractElement* > getElementsX(); inline expandedMachine* getMachine() {return machine_;} inline unsigned getRankOfFirstElement() { return rankOfFirstElement_;} inline unsigned getRankOfLastElement() { return rankOfFirstElement_ + numberOfelements_ - 1; } abstractElement* getFirstElement(); abstractElement* getLastElement(); abstractElement* getElement(unsigned ind); bool isEmpty() { if ( numberOfelements_ ) return false; else return true; } inline unsigned getNumberOfElements() { return numberOfelements_;} private: computingBlock() {;} computingBlock(unsigned premier, unsigned nombre, abstractSoftware* s,expandedMachine* mch); computingBlock(expandedMachine* mac) : machine_(mac) {;} void FileAMLOutput(UAPNode* root); void FileAMLInput( UAPNode* entree); inline void setSoftware(abstractSoftware* sw) {software_ = sw;} inline bool removeFirstElement() { rankOfFirstElement_++; numberOfelements_--; return checkCompatibilityWithMachine(); }; inline bool extendByTheEnd(unsigned nombre) { numberOfelements_ += nombre; return checkCompatibilityWithMachine(); }; inline bool suppressByTheEnd(unsigned nombre) { numberOfelements_ -= nombre; return checkCompatibilityWithMachine(); }; inline bool removeLastElement() { numberOfelements_--; return checkCompatibilityWithMachine(); } bool checkCompatibilityWithMachine(); bool checkCoherence(string& diagnosticErrors, string& diagnosticWarnings); inline void clearElements() { numberOfelements_ = 0; } inline void clearAll() { if ( software_ ) delete software_; software_=NULL;} inline bool reinitialiseElements(unsigned first, unsigned number) { rankOfFirstElement_ = first; numberOfelements_ = number; return checkCompatibilityWithMachine(); } abstractSoftware* software_; unsigned rankOfFirstElement_; unsigned numberOfelements_; expandedMachine* machine_; }; #endif