blob: 85460c9f9f247d9a63191caae317d86e8ef6ea34 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
/*
* Parser.h
*
* Created on: 11 mai 2011
* Author: christian
*/
#include <iostream>
#include <string>
#include <vector>
#include <ifstream>
#include <ofstream>
#include "Accelerator.h"
#include "Vector3D.h"
#include "exceptions.h"
#ifndef PARSER_H_
#define PARSER_H_
namespace vhc {
typedef tag string;
typedef tagStat static tag;
class Parser {
public:
Parser(string);
virtual ~Parser(){}
Accelerator* extract(string);
private:
string nameOfFile;
//===========================================balises ouvrantes==========================================================================
//balises ouvrantes d'un système
tagStat system;
tagStat accelerator;
tagStat comment;
//balises ouvrantes d'une particule
tagStat particle;
tagStat position;
tagStat mass;
tagStat charge;
tagStat energy;
tagStat direction;
//balises ouvrantes d'un Element
tagStat entryPos;
tagStat exitPos;
tagStat sectionRadius;
//balises ouvrantes d'un dipole
tagStat dipole;
tagStat curvature;
tagStat magneticField;
//balise ouvrantes commune aux quadrupoles et aux fodo
tagStat focCoeff;
//balises ouvrantes d'une FODO
tagStat fodo;
tagStat straightLength;
//balises ouvrante d'un quadrupole
tagStat quadrupole;
//balises ouvrantes d'une straightElement
tagStat straightElement;
//===================================================balises fermantes==================================================================
//balises fermantes d'un système
tagStat systemCl;
tagStat acceleratorCl;
tagStat commentCl;
//balises fermantes d'une particule
tagStat particleCl;
tagStat positionCl;
tagStat massCl;
tagStat chargeCl;
tagStat energyCl;
tagStat directionCl;
//balises fermantes d'un Element
tagStat entryPosCl;
tagStat exitPosCl;
tagStat sectionRadiusCl;
//balises fermantes d'un dipole
tagStat dipoleCl;
tagStat curvatureCl;
tagStat magneticFieldCl;
//balise fermantes commune aux quadrupoles et aux fodo
tagStat focCoeffCl;
//balises fermantes d'une FODO
tagStat fodoCl;
tagStat straightLengthCl;
//balises fermantes d'un quadrupole
tagStat quadrupoleCl;
//balises fermantes d'une straightElement
tagStat straightElementCl;
//======================================================autres méthodes=================================================================
//méthodes de lectures génériques
string readFile(ifstream& file);
//méthodes gestion balises
tag readOpeningBalise(ifstream& file);
tag readClosingBalise(ifstream& file);
tag findNextBalise(ifstream& file);
//méthode pour commentaire
void jumpComment(ifstream& file);
//méthodes atomiques de lecture
char readOneChar(ifstream& file);
int readOneInt(ifstream& file);
double readOneDouble(ifstream& file);
Vector3D readOnePosition(ifstream& file);
};
}
#endif /* PARSER_H_ */
|