Changeset 418 in PSPA for Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc
- Timestamp:
- Jun 21, 2013, 10:16:56 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc
r412 r418 6 6 7 7 abstractElement::abstractElement() 8 : abstractSoftware_(NULL) 8 //: nameOfSoftware_(NULL) 9 : abstractSoftware_(NULL) 9 10 { 10 11 setDefaultValues(); … … 14 15 15 16 abstractElement::abstractElement(string lab) 17 //: nameOfSoftware_(NULL) 18 : abstractSoftware_(NULL) 16 19 { 17 label_ = lab;20 specificName_ = lab; 18 21 setDefaultValues(); 19 22 setDefaults(); … … 24 27 { 25 28 if (parametersString_ != NULL) delete [] parametersString_ ; 29 // if ( nameOfSoftware_ != NULL ) delete nameOfSoftware_; 26 30 } 27 31 28 32 void abstractElement::setDefaultValues() 29 33 { 30 default Label_ = string("XXXXXX");34 defaultSpecificName_ = string("XXXXXX"); 31 35 defaultLength_ = 0.0; 32 36 defaultAperture_ = 1.e+6; … … 36 40 void abstractElement::setDefaults() 37 41 { 38 label_ = defaultLabel_;42 specificName_ = defaultSpecificName_; 39 43 nbParam_ = 2; 40 44 lenghtElem_ = defaultLength_; … … 55 59 void abstractElement::setLabel(string lab) 56 60 { 57 label_= lab;61 specificName_= lab; 58 62 } 59 63 60 64 string abstractElement::getLabel() const 61 65 { 62 return label_;66 return specificName_; 63 67 } 64 68 … … 80 84 81 85 82 trivaluedBool abstractElement::is_accepted_by_software(nomDeLogiciel prog) {83 if (acceptableSoftware_.size() == 0) {84 return TBoolError;85 }86 87 if ( std::find(acceptableSoftware_.begin(), acceptableSoftware_.end(), prog) != acceptableSoftware_.end()) {88 return TBoolOk;89 } else if ( std::find(ignoreSoftware_.begin(), ignoreSoftware_.end(), prog) != ignoreSoftware_.end()) {90 return TBoolIgnore;91 } else {92 return TBoolError;93 }94 95 return TBoolOk;96 }97 98 99 86 double abstractElement::getInitialKineticEnergy() const { 100 87 return 0.0; … … 102 89 103 90 104 string abstractElement::generatorOutputFlow() const {105 return "";106 }107 91 108 trivaluedBool abstractElement::setSoftware(nomDeLogiciel prog)109 {110 trivaluedBool tb = TBoolError;111 if (std::find(acceptableSoftware_.begin(),acceptableSoftware_.end(),prog) != acceptableSoftware_.end()) {112 tb = TBoolOk;113 } else if (std::find(ignoreSoftware_.begin(),ignoreSoftware_.end(),prog) != ignoreSoftware_.end()) {114 tb = TBoolIgnore;115 } else {116 tb = TBoolError;117 }118 119 if (prog == nomDeLogiciel::unknownSoftware){120 tb = TBoolOk;121 }122 123 if ((tb == TBoolOk)/* || (tb == TBoolIgnore)*/) {124 if (prog == nomDeLogiciel::parmela) {125 abstractSoftware_ = new softwareParmela();126 } else if (prog == nomDeLogiciel::transport) {127 abstractSoftware_ = new softwareTransport();128 } else if (prog == nomDeLogiciel::generator) {129 abstractSoftware_ = new softwareGenerator();130 } else if (prog == nomDeLogiciel::test) {131 abstractSoftware_ = new softwareTest();132 } else if (prog == nomDeLogiciel::unknownSoftware) {133 abstractSoftware_ = NULL;134 }135 }136 return tb;137 }138 139 void abstractElement::registerAcceptableSoftware(nomDeLogiciel abs,trivaluedBool b) {140 if (b == TBoolIgnore) {141 ignoreSoftware_.push_back(abs);142 } else if (b == TBoolOk) {143 acceptableSoftware_.push_back(abs);144 }145 }
Note: See TracChangeset
for help on using the changeset viewer.