Changeset 107 in PSPA for Interface_Web/trunk/pspaWT/include


Ignore:
Timestamp:
Nov 23, 2012, 3:45:44 PM (12 years ago)
Author:
touze
Message:

gestion des elts etiquetes

Location:
Interface_Web/trunk/pspaWT/include
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/include/GWt_abstractElement.h

    r83 r107  
    44#include "GWt_pspaApplication.h"
    55#include "abstractElement.h"
    6 
    76
    87#include <Wt/WContainerWidget>
     
    1716using namespace std;
    1817
    19 
    20 
    2118class GWt_abstractElement : public WContainerWidget
    2219{
     
    2421
    2522  PspaApplication* pspa_;
    26     abstractElement* element_;
     23  abstractElement* element_;
    2724
    2825  WDialog* dialog_;
    2926  WPushButton* dropped_;
     27  WContainerWidget* wc_;
    3028
    3129  GWt_abstractElement() {;}
     30  void setLabel(abstractElement* elem,int n);
    3231
    3332 public :
    3433
    35 GWt_abstractElement(PspaApplication* ps, abstractElement* elem, string image)
    36   {
    37   pspa_ = ps;
    38   pspa_->updateSelections();
    39   element_ = elem;
    40   dropped_ = new WPushButton();
    41   dropped_->clicked().connect(this, &GWt_abstractElement::openParametersForm);
    42 
    43   dropped_->setIcon(image);
    44   dropped_->setMaximumSize(50,50);
    45   }
    46 
    47 void openParametersForm()
    48 {
    49  dialog_->show();
    50 }
    51 
    52   WPushButton* getButton()  { return dropped_;}
    53   //  WDialog* getDialog() { return dialog_;}
    54 
     34  GWt_abstractElement(PspaApplication* ps,abstractElement* elem,string image);
     35  void openParametersForm();
     36  void clicked();
     37  void doubleClicked();
     38  WPushButton* getButton();
     39  WContainerWidget* getWidget();
    5540  virtual void dialogDone() = 0;
    5641};
    57 
    5842#endif
  • Interface_Web/trunk/pspaWT/include/GWt_bend.h

    r84 r107  
    1515class GWt_bend : public GWt_abstractElement
    1616{
    17 
     17  static int nObjets_;
    1818  WLineEdit* angleEdit_; // deg.
    1919  WLineEdit* radiusEdit_; // m
     
    2727 public :
    2828
    29 GWt_bend(PspaApplication* ps,abstractElement* elem, string image);
    30 
    31 ~GWt_bend() {;}
    32 virtual void dialogDone();
    33 
     29  GWt_bend(PspaApplication* ps,abstractElement* elem, string image);
     30  ~GWt_bend() {;}
     31  virtual void dialogDone();
    3432};
    35 
    3633#endif
  • Interface_Web/trunk/pspaWT/include/GWt_cell.h

    r84 r107  
    11#ifndef GWT_CELL_SEEN
    22#define GWT_CELL_SEEN
    3 
    4 
    53
    64#include "GWt_pspaApplication.h"
    75#include "GWt_abstractElement.h"
    86#include "abstractElement.h"
    9 
    10 //#include <Wt/WContainerWidget>
    117
    128#include <iostream>
     
    1915class GWt_cell : public GWt_abstractElement
    2016{
    21 
     17  static int nObjets_;
    2218  WLineEdit* lenghtElemEdit_; // cm
    2319  WLineEdit* apertureEdit_; // cm
     
    3430 public :
    3531
    36  GWt_cell(PspaApplication* ps,abstractElement* elem, string image);
    37 
     32  GWt_cell(PspaApplication* ps,abstractElement* elem, string image);
    3833  ~GWt_cell() {;}
    39 
    40 
    41 virtual void dialogDone();
     34  virtual void dialogDone();
    4235};
    43 
    4436#endif
  • Interface_Web/trunk/pspaWT/include/GWt_drift.h

    r83 r107  
    33
    44#include "GWt_pspaApplication.h"
     5#include "GWt_abstractElement.h"
    56#include "abstractElement.h"
    6 
    7 //#include <Wt/WContainerWidget>
    8 #include "GWt_abstractElement.h"
    9 #include <Wt/WDialog>
    10 #include <Wt/WPushButton>
    117
    128#include <iostream>
     
    1713using namespace std;
    1814
    19 
    20 
    2115class GWt_drift : public GWt_abstractElement
    2216{
    23 
    24   /* PspaApplication* pspa_; */
    25   /* abstractElement* driftElement_; */
    26   /* WDialog* dialog_; */
    27   /* WPushButton* dropped_; */
     17  static int nObjets_;
    2818  WLineEdit* xlengthEdit_;
    2919  WLineEdit* apertureEdit_;
     
    3323 public:
    3424
    35 
    36   GWt_drift(PspaApplication* ps, abstractElement* elem, string image);
    37 
     25  GWt_drift(PspaApplication* ps,abstractElement* elem,string image);
    3826  ~GWt_drift() {;}
    39 
    40   /* WPushButton* getButton(); */
    41   /* WDialog* getDialog(); */
    42   /* void openDriftParametersForm(); */
    43 virtual  void dialogDone();
    44 
    45 
     27  virtual void dialogDone();
    4628};
    47 
    48 
    4929#endif
  • Interface_Web/trunk/pspaWT/include/GWt_initialBeam.h

    r83 r107  
    55#include "GWt_abstractElement.h"
    66#include "abstractElement.h"
    7 
    8 
    9 //#include <Wt/WContainerWidget>
    107
    118#include <iostream>
     
    1916class GWt_initialBeam : public GWt_abstractElement
    2017{
    21   /*   PspaApplication* pspa_; */
    22   /* abstractElement* initialBeam_; */
    23   /* WDialog* dialog_; */
    24   /* WPushButton* dropped_; */
    25 
    26 
     18  static int nObjets_;
    2719  WLineEdit* nmacropEdit_;
    2820  WLineEdit* sigma_tEdit_; // picoseconds
     
    3224  WLineEdit* nb_true_particlesEdit_;
    3325
     26  GWt_initialBeam() {;}
    3427
    35 GWt_initialBeam() {;}
     28 public :
    3629
    37 public :
    38 
    39  GWt_initialBeam(PspaApplication* ps,abstractElement* elem, string image);
    40 ~GWt_initialBeam() {;}
    41 
    42 /* WPushButton* getButton(); */
    43 /* WDialog* getDialog(); */
    44 /* void openParametersForm(); */
    45 virtual void dialogDone();
    46 
     30  GWt_initialBeam(PspaApplication* ps,abstractElement* elem, string image);
     31  ~GWt_initialBeam() {;}
     32  virtual void dialogDone();
    4733};
    4834#endif
  • Interface_Web/trunk/pspaWT/include/GWt_pspaApplication.h

    r105 r107  
    22#define  PSPA_SEEN
    33
    4 
     4//#include <string>
    55#include <list>
    66
     
    1616
    1717using namespace Wt;
     18//using namespace std;
    1819
    1920/*
     
    2324{
    2425
    25 typedef struct
    26 {
     26typedef struct {
    2727  WLineEdit* debut;
    2828  WLineEdit*  fin;
     
    3131} GWt_sectionToExecute;
    3232
     33 private :
     34 
     35 dataManager* dtmanage_;
     36 
     37 WTextArea* console_;
     38 WWidget* globalParam_;
     39 WWidget* beamLine_;
     40 WContainerWidget* leDessin_;
     41 WPushButton *exec_go_;
     42 WText* probleme_;
    3343
     44 WContainerWidget* contenuSections_;
     45 list<GWt_sectionToExecute*> selectedSections_;
    3446
    35  private :
    36   WTextArea* console_;
    37   dataManager* dtmanage_;
    38   WWidget* globalParam_;
    39   WWidget* beamLine_;
    40   WContainerWidget* leDessin_;
     47 WText*   createTitle(const WString&);
     48 WWidget* createPalette();
     49 WWidget* createBeamLine();
     50 WWidget* createGlobalParamWidget();
     51 WWidget* createExecuteWidget();
     52 
     53 void createDragImage(const char *url,const char *smallurl,const char *mimeType,WContainerWidget *p,WString name);
     54 void executer();
     55 void sauver();
     56 void restaurer();
     57 
     58 void addSectionToExecuteW();
     59 void deleteSectionToExecuteW();
     60 void checkSectionSelection();
     61 void disableSectionExecute();
     62 bool areDataCoherent();
     63 void faireDessin();
     64 void faireDessinParmela();
     65 void faireDessinTransport();
    4166
    42   WContainerWidget* contenuSections_;
     67 public :
    4368
    44   WPushButton *exec_go_;
    45 
    46   WText* probleme_;
    47 
    48   list<GWt_sectionToExecute*> selectedSections_;
    49 
    50   WText*   createTitle(const WString&);
    51   WWidget* createPalette();
    52   WWidget* createBeamLine();
    53   WWidget* createGlobalParamWidget();
    54   WWidget* createExecuteWidget();
    55 
    56   void createDragImage(const char *url, const char *smallurl,
    57                   const char *mimeType,
    58                        WContainerWidget *p,
    59                        WString name);
    60 
    61 
    62   void executer();
    63   void sauver();
    64   void restaurer();
    65 
    66   void addSectionToExecuteW();
    67   void deleteSectionToExecuteW();
    68 
    69   void checkSectionSelection();
    70 
    71   bool areDataCoherent();
    72 
    73   void disableSectionExecute();
    74 
    75   void faireDessin();
    76   void faireDessinParmela();
    77   void faireDessinTransport();
    78 
    79 
    80 public:
    81   PspaApplication(const WEnvironment& env);
    82   inline dataManager* getDataManager() const
    83   {
    84     return dtmanage_;
     69 PspaApplication(const WEnvironment& env);
     70 
     71 inline dataManager* getDataManager() const  {
     72   return dtmanage_;
     73 }
     74 
     75 inline void addConsoleMessage(WString msg) {
     76   console_->setText(console_->text()+msg+"\n");
    8577  }
    8678
    87 
    88   inline void addConsoleMessage(WString msg) {
    89     console_->setText   (console_->text()+msg+"\n");
    90   }
    91 
    92   //  void addElemToGlobals();
    93   void updateSelections();
    94 
     79 void updateSelections();
     80 string getSelection();
    9581};
    96 
    9782#endif
  • Interface_Web/trunk/pspaWT/include/GWt_soleno.h

    r83 r107  
    11#ifndef GWTSOLENO_SEEN
    22#define GWTSOLENO_SEEN
    3 
    43
    54#include "GWt_pspaApplication.h"
    65#include "GWt_abstractElement.h"
    76#include "abstractElement.h"
    8 
    9 #include <Wt/WContainerWidget>
    107
    118#include <iostream>
     
    1613using namespace std;
    1714
    18 
    1915class GWt_soleno : public  GWt_abstractElement
    2016{
    21 
    22   //  PspaApplication* pspa_;
    23   //   abstractElement* solenoElement_;
    24   //  WDialog* dialog_;
    25     //  WPushButton* dropped_;
     17  static int nObjets_;
    2618  WLineEdit* xlengthEdit_;
    2719  WLineEdit* apertureEdit_;
     
    2921
    3022  GWt_soleno() {;}
    31 
     23 
    3224 public :
    3325
    34 GWt_soleno(PspaApplication* ps, abstractElement* elem, string image);
    35 
    36 ~GWt_soleno() {;}
    37 
    38 
    39 //  WPushButton* getButton();
    40 //  WDialog* getDialog();
    41 //  void openParametersForm();
    42 virtual  void dialogDone();
    43 
     26  GWt_soleno(PspaApplication* ps, abstractElement* elem, string image);
     27  ~GWt_soleno() {;}
     28  virtual  void dialogDone();
    4429};
    45 
    4630#endif
  • Interface_Web/trunk/pspaWT/include/abstractElement.h

    r105 r107  
    22#define ABSTRACTELEMENTDEFINITION_SEEN
    33
    4 #include <iostream>
    5 #include <sstream>
     4#include <fstream>
    65#include <string>
    76
    8 #include "mathematicalTools.h"
    97#include "nomdElements.h"
    108
    119using namespace std;
    1210
    13 
    1411class abstractElement
    1512{
    16 
    17  protected:
    18 
     13 protected :
     14 
    1915  bool parmelaOk_;
    2016  bool transportOk_;
    21 
    2217  int nbParam_;
    2318  string* parametersString_;
    24 
    25 
    26 
    2719  //  double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep)
    2820  double phaseStepMax_;
     
    3022  double defaultLength_;
    3123  double defaultAperture_;
    32 
    33 
    3424
    3525  string label_;
     
    4131  //  bool curvedTrajectory_;
    4232
    43   void setDefaultValues()
    44   {
    45     label_ = "";
    46     nbParam_ = 2;
    47       defaultLength_ = 0.0;
    48       defaultAperture_ = 1.e+6;
    49     phaseStepMax_ = 10.;
    50   }
    51 
    52 
    53   void setDefaults()
    54   {
    55     lenghtElem_ = defaultLength_;
    56     aperture_ = defaultAperture_;
    57     parmelaOk_ = false;
    58     transportOk_ = false;
    59   }
     33  void setDefaultValues();
     34  void setDefaults();
    6035
    6136 public :
    6237
     38  abstractElement();
     39  abstractElement(string lab);
     40  virtual ~abstractElement();
    6341
    64  abstractElement()
    65     {
    66       label_ = string("");
    67       setDefaultValues();
    68       setDefaults();
    69       stepmaxcm_ = 1000000;
    70       //      curvedTrajectory_ = false;
    71     }
     42  void setParameters(double ll,double aper);
     43  void setLabel(string lab);
     44  string getLabel() const;
     45  nomdElement getName() const;
     46  std::string getNameOfElement();
     47  std::string getNameString() const
     48  double getLenghtOfElement() const;
     49  int getNbParams() const; 
     50  bool is_parmela_element() const;
     51  bool is_transport_element() const;
    7252
     53  virtual void setPhaseStep(double);
     54  virtual double getInitialKineticEnergy() const;
    7355
    74   abstractElement(string lab)
    75     {
    76       label_ = lab;
    77       setDefaultValues();
    78       setDefaults();
    79       stepmaxcm_ = 1000000;
    80       //      curvedTrajectory_ = false;
    81     }
    82 
    83 virtual  ~abstractElement() {if (parametersString_ != NULL) delete [] parametersString_ ;}
    84 
    85  virtual void setPhaseStep(double ) { cout << " setPhaseStep : ce n'est pas celui la qu'il faut ! " ; return;}
    86 
    87 
    88  void setParameters(double ll, double aper)
    89   {
    90     lenghtElem_ = ll;
    91     aperture_ = aper;
    92   }
    93 
    94  virtual void setParametersString(string* param)  = 0;
    95 
    96 string getLabel() const
    97 {
    98   return label_;
    99 }
    100 
    101 
    102   nomdElement getName() const
    103   {
    104     return  elementName_;
    105   }
    106 
    107   // provisoire, pour suppleer une future classe nomdElement
    108   // analogue a nomDeLogiciel
    109   string getNameString() const
    110   {
    111     switch ( elementName_ )
    112       {
    113       case initialBeam :
    114         {
    115           return string("INITIALBEAM");
    116         }
    117       case drift :
    118         {
    119           return string("DRIFT");
    120         }
    121       case cell :
    122         {
    123           return string("CELL");
    124         }
    125       case soleno :
    126         {
    127           return string("SOLENO");
    128         }
    129       case bend :
    130         {
    131           return string("BEND");
    132         }
    133       default :
    134         {
    135           return string("UNKNOWN");
    136         }
    137       }
    138   }
    139 
    140   double getLenghtOfElement() const { return lenghtElem_;}
    141 
    142  int getNbParams() const {return nbParam_;};
    143 
    144  bool is_parmela_element() const {return parmelaOk_;};
    145  bool is_transport_element() const {return transportOk_;};
    146 
    147  virtual string* getParametersString() const = 0;
    148 
    149 
    150  virtual string parmelaOutputFlow() const =0;
    151  virtual string transportOutputFlow() const =0;
    152 
    153 
    154  virtual double getInitialKineticEnergy() const {return 0.0;}
    155 
    156 
    157  virtual string FileOutputFlow() const=0;
    158  virtual void FileInput(ifstream& ifs) = 0;
    159 
     56  virtual void setParametersString(string* param) = 0;
     57  virtual string* getParametersString() const = 0;
     58  virtual string parmelaOutputFlow() const = 0;
     59  virtual string transportOutputFlow() const = 0;
     60  virtual string FileOutputFlow() const = 0;
     61  virtual void FileInput(ifstream& ifs) = 0;
    16062};
    161 
    162 
    163 
    16463#endif
  • Interface_Web/trunk/pspaWT/include/dataManager.h

    r105 r107  
    11#ifndef DATAMANAGER_SEEN
    22#define DATAMANAGER_SEEN
    3 
    4 
    5 //#include<vector>
    6 
    73
    84#include "abstractElement.h"
     
    1410#include "nomDeLogiciel.h"
    1511
    16 
    17 //using namespace std;
    18 
    1912class dataManager
    2013{
    21 
    2214
    2315  elementsCollection elementsGallery_;
     
    3022  void createInputFileTransport( unsigned int indexDeb, unsigned int indexFin);
    3123  void removeFile(string nameOfFile);
    32      void clearSectionToExecute();
    33 
     24  void clearSectionToExecute();
    3425
    3526 public:
    3627
    37 
    3828  dataManager() {;}
    39   ~dataManager()
    40 {
    41   unsigned k;
    42   for (k=0; k < jobList_.size();k++)
    43     {
     29  ~dataManager() {
     30    unsigned k;
     31    for (k=0; k < jobList_.size();k++) {
    4432      if ( jobList_[k] != NULL ) delete jobList_[k];
    4533    }
    46 }
     34  }
    4735
    4836  inline int beamLineSize() {return elementsGallery_.size();}
     
    5038  inline elementsCollection* getCollection() {return &elementsGallery_;}
    5139  inline particleBeam& getCurrentBeam() {return currentBeam_;}
    52 
    53      void addSectionToExecute(int debut, int fin, nomDeLogiciel prog);
     40  void addSectionToExecute(int debut, int fin, nomDeLogiciel prog);
    5441 
    5542  abstractElement* addElement(nomdElement elemType);
     
    6249  void restoreAll();
    6350};
    64 
    6551#endif
  • Interface_Web/trunk/pspaWT/include/elementCell.h

    r82 r107  
    33
    44#include <string>
    5 #include <fstream>
     5#include <iostream>
     6#include <sstream>
     7
    68#include "abstractElement.h"
    79
  • Interface_Web/trunk/pspaWT/include/elementInitialBeam.h

    r82 r107  
    44#include <string>
    55#include <iostream>
     6#include <sstream>
    67
    78#include "abstractElement.h"
    8 
    99
    1010using namespace std;
     
    4343
    4444  virtual void setPhaseStep(double ph) { phaseStep_ = ph;}
    45 
    46 
     45 
     46 
    4747  virtual string* getParametersString() const;
    48 
     48 
    4949  virtual void setParametersString(string* param);
    50 
    51  virtual inline double getInitialKineticEnergy() const {return E_cin_;}
    52 
    53  virtual string parmelaOutputFlow() const;
    54 
    55 virtual string transportOutputFlow() const
     50 
     51  virtual inline double getInitialKineticEnergy() const {return E_cin_;}
     52 
     53  virtual string parmelaOutputFlow() const;
     54 
     55  virtual string transportOutputFlow() const
    5656  {
    5757    ostringstream sortie;
     
    5959    return sortie.str();
    6060  }
    61 
     61 
    6262 virtual string FileOutputFlow() const;
    63 
     63 
    6464 virtual void FileInput(ifstream& ifs);
    6565
  • Interface_Web/trunk/pspaWT/include/elementsCollection.h

    r96 r107  
    55#include <iostream>
    66#include <string>
     7#include <vector>
     8
    79#include "abstractElement.h"
    8 #include "elementDrift.h"
    9 #include "elementInitialBeam.h"
    10 #include "elementCell.h"
    11 #include "elementSoleno.h"
    12 #include "elementBend.h"
    1310#include "nomdElements.h"
    14 
    15 
    16 //using namespace std;
    17 
    1811
    1912class elementsCollection
    2013{
    2114
     15  vector <abstractElement*> elements_;
    2216
    23   vector < abstractElement*> elements_;
    24 
    25 
    26  public:
    27 
     17 public :
    2818
    2919  elementsCollection() {;}
     20  ~elementsCollection();
    3021
    31 ~elementsCollection()
    32   {
    33     unsigned int k;
    34     for (k=0; k < elements_.size(); k++)
    35       {
    36         if ( elements_[k] != NULL ) delete elements_[k];
    37       }
    38   }
     22  void raz();
     23  int size(); 
     24  abstractElement* addElement(nomdElement elemType);
     25  abstractElement* getElementPointer(string label) const;
     26  abstractElement* getElementPointer(unsigned int index) const;
    3927
    40  inline void raz()
    41  {
    42    unsigned int k;
    43    for (k=0; k < elements_.size(); k++)
    44      {
    45         if ( elements_[k] != NULL ) delete elements_[k];       
    46      }
    47    elements_.clear();
    48  }
    49 
    50  inline int size() { return elements_.size(); }
    51 
    52 
    53 abstractElement* addElement(nomdElement elemType)
    54 {
    55   switch ( elemType )
    56     {
    57     case initialBeam :
    58       {
    59         elements_.push_back(new elementInitialBeam());
    60         break;
    61       }
    62     case drift :
    63       {
    64         elements_.push_back(new elementDrift());
    65         break;
    66       }
    67     case cell :
    68       {
    69         elements_.push_back(new elementCell());
    70         break;
    71       }
    72     case soleno :
    73       {
    74         elements_.push_back(new elementSoleno());
    75         break;
    76       }
    77     case bend :
    78       {
    79         elements_.push_back(new elementBend());
    80         break;
    81       }
    82     default :
    83       {
    84         cerr << " elementsCollection::addElement : ERROR unknown type of element : " << elemType << endl;
    85         return NULL;
    86       }
    87     }
    88   return elements_.back();
    89 }
    90 
    91 
    92 
    93 inline abstractElement* getElementPointer(string label) const
    94  {
    95    unsigned int k;
    96    for ( k=0; k < elements_.size() ; k++)
    97      {
    98        if ( elements_[k]->getLabel() == label ) return elements_[k];     
    99      }
    100    std::cerr << " elementsCollection::getElementPointer() : unknown element label: " << label << std::endl;
    101    return NULL;
    102  }
    103 
    104 
    105 inline abstractElement* getElementPointer(unsigned int index) const
    106  {
    107    if ( index >= elements_.size() ) return NULL;
    108    else  return elements_[index];       
    109  }
    110 
     28  void eraseElement(string label);
    11129
    11230};
    113 
    114 
    115 
    116 
    11731#endif
  • Interface_Web/trunk/pspaWT/include/nomDeLogiciel.h

    r59 r107  
    1111
    1212
    13 enum Logiciel
     13  enum Logiciel
    1414  {
    1515    parmela, transport, unknownSoftware
     
    1919 private:
    2020
    21  Logiciel program_;
    22  std::string progString_;
    23  int value_;
     21  Logiciel program_;
     22  std::string progString_;
     23  int value_;
    2424
     25  static Logiciel fromString( std::string s)
     26  {
     27    if (s == "parmela" ) return parmela;
     28    else if ( s == "transport" ) return transport;
     29    return unknownSoftware;
     30  }
    2531
    26 // static functions
    27 
    28 
    29 
    30  static Logiciel fromString( std::string s)
    31  {
    32    if (s == "parmela" ) return parmela;
    33    else if ( s == "transport" ) return transport;
    34    return unknownSoftware;
    35  }
    36 
    37  static std::string toString( Logiciel lg)
    38  {
    39    switch (lg)
    40      {
    41      case parmela : { return "parmela"; }
    42      case transport : { return "transport"; }
    43      case unknownSoftware : { return "unknownSoftware"; }
    44      }
    45    return "unknownSoftware";
    46  }
    47 
    48  static Logiciel fromValue( int v)
    49  {
    50    switch (v)
    51      {
    52      case 0 : { return parmela; }
    53      case 1 : { return transport; }
    54      }
    55    return unknownSoftware;
    56  }
    57 
    58  static int toValue( Logiciel lg)
    59  {
    60    switch (lg)
    61      {
    62      case parmela : { return 0; }
    63      case transport : { return 1; }
    64      case unknownSoftware :  { return 2; }
    65      }
    66    return -1;
    67  }
    68 
    69 public :
    70 // constructors
    71 
     32  static std::string toString( Logiciel lg)
     33  {
     34    switch (lg)
     35      {
     36      case parmela : { return "parmela"; }
     37      case transport : { return "transport"; }
     38      case unknownSoftware : { return "unknownSoftware"; }
     39      }
     40    return "unknownSoftware";
     41  }
     42 
     43  static Logiciel fromValue( int v)
     44  {
     45    switch (v)
     46      {
     47      case 0 : { return parmela; }
     48      case 1 : { return transport; }
     49      }
     50    return unknownSoftware;
     51  }
     52 
     53  static int toValue( Logiciel lg)
     54  {
     55    switch (lg)
     56      {
     57      case parmela : { return 0; }
     58      case transport : { return 1; }
     59      case unknownSoftware :  { return 2; }
     60      }
     61    return -1;
     62  }
     63 
     64 public :
     65  // constructors
     66 
    7267 nomDeLogiciel() : program_(transport)
    73  {
    74    progString_ = toString(program_);
    75    value_ = toValue(program_);
    76  }
    77 
    78 
    79 nomDeLogiciel(const string& s)
    80 {
    81   program_ = fromString(s);
    82   progString_ = toString(program_);
    83   value_ = toValue(program_);
    84 }
    85 
    86 nomDeLogiciel(int val)
    87 
    88   program_ = fromValue(val);
    89   progString_ = toString(program_);
    90   value_ = toValue(program_);
    91 }
    92 
    93  static int getNumberOfSoftwares() { return toValue(unknownSoftware);}
    94 
    95  inline std::string getString() const {return progString_;}
    96 
    97 // operators
    98 
    99 nomDeLogiciel& operator= (const nomDeLogiciel& nl)
    100 {
    101   program_ = nl.program_;
    102   progString_ = nl.progString_;
    103   value_ = nl.value_;
    104   return *this;
    105 }
    106 
     68  {
     69    progString_ = toString(program_);
     70    value_ = toValue(program_);
     71  }
     72 
     73 
     74  nomDeLogiciel(const string& s)
     75    {
     76      program_ = fromString(s);
     77      progString_ = toString(program_);
     78      value_ = toValue(program_);
     79    }
     80 
     81  nomDeLogiciel(int val)
     82   
     83      program_ = fromValue(val);
     84      progString_ = toString(program_);
     85      value_ = toValue(program_);
     86    }
     87 
     88  static int getNumberOfSoftwares() { return toValue(unknownSoftware);}
     89 
     90  inline std::string getString() const {return progString_;}
     91 
     92  // operators
     93 
     94  nomDeLogiciel& operator= (const nomDeLogiciel& nl)
     95    {
     96      program_ = nl.program_;
     97      progString_ = nl.progString_;
     98      value_ = nl.value_;
     99      return *this;
     100    }
     101 
    107102  bool operator== (const nomDeLogiciel& nl)
    108103  {
    109104    return ( program_ == nl.program_);
    110105  }
    111 
     106 
    112107  bool operator!= (const nomDeLogiciel& nl)
    113108  {
    114109    return ( program_ != nl.program_);
    115110  }
    116 
     111 
    117112};
    118113
  • Interface_Web/trunk/pspaWT/include/nomdElements.h

    r82 r107  
    22#define NOMDELEMENTS_SEEN
    33
    4 
    54using namespace std;
    65
    7 typedef enum
    8   {
    9     initialBeam, drift, cell, bend, soleno
    10   }    nomdElement;
    11 
     6typedef enum {
     7  initialBeam, drift, cell, bend, soleno
     8} nomdElement;
    129
    1310#endif
Note: See TracChangeset for help on using the changeset viewer.