-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.cpp
More file actions
79 lines (68 loc) · 2.15 KB
/
setup.cpp
File metadata and controls
79 lines (68 loc) · 2.15 KB
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
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <limits>
//using namespace std;
int main()
{
bool verbose = true;
std::string Path = "Define.txt";
printf("Using %s as the Definition File\n",Path.c_str());
std::ifstream ConfigFile;
ConfigFile.open(Path.c_str());
std::string LineBuffer;
std::string DataBuffer;
bool readW1Configuration = false;
bool readMMMConfiguration = false;
std::ofstream ConfigOutput;
ConfigOutput.open("Parameters.c");
while(!ConfigFile.eof())
{
getline(ConfigFile, LineBuffer);
{
std::cout << LineBuffer << std::endl;
if(LineBuffer.compare(0,1,"%")==0) ConfigFile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
else if(LineBuffer.compare(0,10,"ADCModules") == 0)
{
ConfigFile >> DataBuffer;
if(verbose)std::cout << std::atof(DataBuffer.c_str()) << std::endl;
ConfigOutput << "int ADCModules = " << std::atof(DataBuffer.c_str()) << ";" << std::endl << std::endl;
}
else if(LineBuffer.compare(0,10,"TDCModules") == 0)
{
ConfigFile >> DataBuffer;
if(verbose)std::cout << std::atof(DataBuffer.c_str()) << std::endl;
ConfigOutput << "int TDCModules = " << std::atof(DataBuffer.c_str()) << ";" << std::endl << std::endl;
}
else if(LineBuffer.compare(0,3,"MMM") == 0)
{
readMMMConfiguration = true;
while(readMMMConfiguration)
{
int NumberOfMMM;
int **MMMADCChannelLimits;
int **MMMTDCChannelLimits;
ConfigFile >> DataBuffer;
std::cout << DataBuffer << std::endl;
if(DataBuffer.compare(0,6,"Number")==0)
{
ConfigFile >> DataBuffer;
if(verbose)std::cout << std::atof(DataBuffer.c_str()) << std::endl;
ConfigOutput << "int NumberOfMMM = " << std::atof(DataBuffer.c_str()) << ";" << std::endl << std::endl;
}
else if(DataBuffer.compare(0,1,"1")==0)
{
ConfigFile >> DataBuffer;
if(DataBuffer.compare(0,3,"ADC")==0)
{
}
else if(DataBuffer.compare(0,3,"MMM") == 0)
{
readMMMConfiguration = false;
ConfigOutput << "int MMMADCChannelLimits[" << NumberOfMMM
}
}
}
}
}