source: PSPA/Interface_Web/trunk/pspaWT/sources/controler/include/abstractElement.h

Last change on this file was 488, checked in by lemeur, 10 years ago

lecture fichier sauvegarde AML

File size: 2.2 KB
Line 
1#ifndef ABSTRACTELEMENTDEFINITION_SEEN
2#define ABSTRACTELEMENTDEFINITION_SEEN
3
4#include <cstdlib>
5#include <fstream>
6#include <string>
7
8#include "nomdElements.h"
9#include "abstractSoftware.h"
10
11#include "UAP/UAPNode.hpp"
12#include "AMLtools.h"
13
14using namespace std;
15
16class abstractElement
17{
18
19 protected :
20 
21  int nbParam_;
22  string* parametersString_;
23 
24  string defaultSpecificName_;
25  string specificName_;
26  nomdElements elementName_;
27   
28  double defaultLength_;
29  double defaultAperture_;
30  double phaseStepMax_;
31 
32  double lenghtElem_; // cm
33  double aperture_; // cm
34  double stepmaxcm_;
35 
36  void setDefaultValues();
37  void setDefaults();
38
39
40 inline  UAPNode* setAMLelementHeader(UAPNode* elementNode) {
41  UAPNode* ele = elementNode->addChild("element");
42  ele->addAttribute("name",specificName_);
43  UAPNode* node = ele->addChild("description");
44  node->addAttribute("type",elementName_.getGenericLabel());
45  return ele;
46 }
47 
48 inline bool checkAMLelementGenericName(UAPNode* entree) {
49  if ( !entree ) return false;
50  string nonGenerique;
51  AMLtools::readAMLParameterAttribut(entree, "description", "type", nonGenerique);
52  if ( nonGenerique != elementName_.getGenericLabel() ) {
53    cout << " abstractElement::checkAMLelementGenericName ERREUR d'element : " << nonGenerique << " ? attendu : " <<  elementName_.getGenericLabel() << endl;
54    return false;
55  }
56  specificName_ = entree->getAttribute("name")->getValue();
57  return true;
58 }
59
60 public :
61 
62  abstractElement();
63  abstractElement(string lab);
64  virtual ~abstractElement();
65 
66  void setParameters(double ll,double aper);
67 
68  nomdElements getNomdElement() const;
69  int getNbParams() const;
70
71  void setLabel(string lab);
72  string getLabel() const;
73
74  double getLenghtOfElement() const;
75 
76  virtual void setPhaseStep(double);
77  virtual double getInitialKineticEnergy() const;
78   
79  virtual void setParametersString(string* param) = 0;
80  virtual string* getParametersString() const = 0;
81  //  virtual string FileOutputFlow() const = 0;
82  virtual vector< pair<string, vector<string> > > parametersToSoftware () const =0;
83  //  virtual void FileInput(ifstream& ifs) = 0;
84  virtual string print() = 0;
85  virtual void InputRep(UAPNode* root) = 0;
86  virtual void FileAMLInput(UAPNode* entree) = 0;
87   
88};
89#endif
Note: See TracBrowser for help on using the repository browser.