forked from uyras/partsEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdos2.cpp
59 lines (50 loc) · 1.12 KB
/
dos2.cpp
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
#include "dos2.h"
/*
template <typename T>
void Dos2<T>::save(string file)
{
ofstream f(file);
for (unsigned i=0; i<data.size()-1; i++){
f<< val(i)<<"\t";
f<< val(i+1)<<"\t";
f<< data[i] <<endl;
}
f<< val(data.size()-1)<<"\t";
f<< max <<"\t";
f<< data[data.size()-1] <<endl;
f.close();
}
template <typename T>
void Dos2<T>::load(string file)
{
ifstream f(file);
data.clear();
double a=0, b=0, c=0;
f>>a; f>>b; f>>c;
data.push_back(c);
this->min = a;
while (f >> a >> b >> c){
data.push_back(c);
}
this->max = b;
this->intervals = data.size();
f.close();
}
template <typename T>
string Dos2<T>::toString()
{
stringstream f;
for (unsigned i=0; i<data.size()-1; i++){
f<< val(i)<<"\t";
f<< val(i+1)<<"\t";
f<< data[i] <<endl;
}
f<< val(data.size()-1)<<"\t";
f<< max <<"\t";
f<< data[data.size()-1] <<endl;
return f.str();
}
template class Dos2<int>;
template class Dos2<double>;
template class Dos2<unsigned>;
template class Dos2< unordered_map<double,int> >;*/