Ignore:
Timestamp:
Jun 21, 2013, 10:16:56 AM (11 years ago)
Author:
lemeur
Message:

definition des compatibilites des elements dans les software

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc

    r412 r418  
    66
    77abstractElement::abstractElement()
    8 : abstractSoftware_(NULL)
     8//: nameOfSoftware_(NULL)
     9  : abstractSoftware_(NULL)
    910{
    1011  setDefaultValues();
     
    1415
    1516abstractElement::abstractElement(string lab)
     17  //: nameOfSoftware_(NULL)
     18  : abstractSoftware_(NULL)
    1619{
    17   label_ = lab;
     20  specificName_ = lab;
    1821  setDefaultValues();
    1922  setDefaults();
     
    2427{
    2528  if (parametersString_ != NULL) delete [] parametersString_ ;
     29  //  if ( nameOfSoftware_ != NULL ) delete nameOfSoftware_;
    2630}
    2731
    2832void abstractElement::setDefaultValues()
    2933{
    30   defaultLabel_ = string("XXXXXX");
     34  defaultSpecificName_ = string("XXXXXX");
    3135  defaultLength_ = 0.0;
    3236  defaultAperture_ = 1.e+6;
     
    3640void abstractElement::setDefaults()
    3741{
    38   label_ = defaultLabel_;
     42  specificName_ = defaultSpecificName_;
    3943  nbParam_ = 2;
    4044  lenghtElem_ = defaultLength_;
     
    5559void abstractElement::setLabel(string lab)
    5660{
    57   label_= lab;
     61  specificName_= lab;
    5862}
    5963
    6064string abstractElement::getLabel() const
    6165{
    62   return label_;
     66  return specificName_;
    6367}
    6468
     
    8084
    8185
    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 
    9986double abstractElement::getInitialKineticEnergy() const {
    10087  return 0.0;
     
    10289
    10390
    104 string abstractElement::generatorOutputFlow() const {
    105   return "";
    106 }
    10791
    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.