-
Notifications
You must be signed in to change notification settings - Fork 0
/
Risultati.cpp
105 lines (69 loc) · 2.19 KB
/
Risultati.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
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
#include "Risultati.h"
#include <bitset>
#include <string>
#include <unordered_map>
#include <iostream>
ClassImp(Risultati);
//costruttore di default
Risultati::Risultati(){
std::unordered_map<std::string, double> histDataTemp = {};
std::unordered_map<std::string, double> fitDataTemp = {};
std::unordered_map<std::string, double> fftDataTemp = {};
this->histData = histDataTemp;
this->fitData = fitDataTemp;
this->fftData = fftDataTemp;
std::bitset<3> tempBitMask(0);
this->bitMask = tempBitMask;
}
int Risultati::AddHistData( std::string key, double val ){
//~ for ( auto x : this->histData ) if ()
this->histData[key] = val;
if ( this->bitMask[0] == 0 ) this->bitMask[0] = 1;
return 0;
}
int Risultati::AddFitData( std::string key, double val ){
this->fitData[key] = val;
if ( this->bitMask[1] == 0 ) this->bitMask[1] = 1;
return 0;
}
int Risultati::AddFftData( std::string key, double val ){
this->fftData[key] = val;
if ( this->bitMask[2] == 0 ) this->bitMask[2] = 1;
return 0;
}
//getter
std::unordered_map<std::string, double> Risultati::GetHistData() const { return this->histData; }
std::unordered_map<std::string, double> Risultati::GetFitData() const { return this->fitData; }
std::unordered_map<std::string, double> Risultati::GetFftData() const { return this->fftData; }
std::bitset<3> Risultati::GetBitMask() const { return this->bitMask; };
//setter
int Risultati::SetHistData( std::unordered_map<std::string, double> histData ) {
if ( histData.size() != 0 ){
this->bitMask[0] = 1;
this->histData = histData;
return 0;
} else {
std::cout << "unordered_map vuota; nulla da aggiungere" << std::endl;
return -1;
}
}
int Risultati::SetFitData( std::unordered_map<std::string, double> fitData ) {
if ( fitData.size() != 0 ){
this->bitMask[1] = 1;
this->fitData = fitData;
return 0;
} else {
std::cout << "unordered_map vuota; nulla da aggiungere" << std::endl;
return -1;
}
}
int Risultati::SetFftData( std::unordered_map<std::string, double> fftData ) {
if ( fftData.size() != 0 ){
this->bitMask[2] = 1;
this->fftData = fftData;
return 0;
} else {
std::cout << "unordered_map vuota; nulla da aggiungere" << std::endl;
return -1;
}
}