summaryrefslogtreecommitdiff
path: root/src/main/Parser.h
blob: dd153be5c204cad2f44713ae947a023df6e9a02b (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
/*
 * Parser.h
 *
 *  Created on: 11 mai 2011
 *      Author: christian
 */
#include <iostream>
#include <string>
#include <vector>
#include <ifstream>
#include <ofstream>
#include "Vector3D.h"

#ifndef PARSER_H_
#define PARSER_H_

typedef balise string;
typedef balStat static balise;

class Parser {
public:
	Parser(string file);
	virtual ~Parser(){};
	void extract(string file);
private:
	balStat system;
	balStat accelerator;
	balStat constants;
	balStat curvedElement;
	balStat dipole;
	balStat fodo;
	balStat particle;
	balStat quadrupole;
	balStat straightElement;

	balStat systemCl;
	balStat acceleratorCl;
	balStat constantsCl;
	balStat curvedElementCl;
	balStat dipoleCl;
	balStat fodoCl;
	balStat particleCl;
	balStat quadrupoleCl;
	balStat straightElementCl;

	char readOneChar(ifstream& file);
	int readOneInt(ifstream& file);
	double readOneDouble(ifstream& file);
	Vector3D readOnePosition(ifstream& file);
	balise readOneBalise(ifstream& file);
	balise findNextBalise(ifstream& file);
	void jumpComment(ifstream& file);
	string readOneWord(ifstream& file);
	string readOneLine(ifstream& file);
	string readFile(ifstream& file);
};

#endif /* PARSER_H_ */