-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTLogStorage.h
104 lines (85 loc) · 1.86 KB
/
TLogStorage.h
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
/*
* TLogStorage.h
*
* Created on: Feb 28, 2019
* Author: mss
*/
#ifndef TLOGSTORAGE_H_
#define TLOGSTORAGE_H_
#include <bits/stdc++.h> // sort
#include <stdint.h>
#include <vector>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include "TSingleLogLine.h"
#include <ctime>
#include <TGraph.h>
namespace std {
struct LogInfo{
time_t timeStamp;
float value;
};
struct LogParam{
string parName;
vector<LogInfo*> vVal;
time_t minTime;
time_t maxTime;
time_t minValue;
time_t maxValue;
TGraph* gr;
LogParam(){
minTime = -999;
maxTime = -999;
minValue = -999;
maxValue = -999;
gr = NULL;
}
static bool compare(const LogParam &l1, const LogParam &l2){
return (l1.parName < l2.parName);
}
};
struct LogChannel{
string boardName;
int channel;
vector<LogParam> vParam;
static bool compare(const LogChannel &l1, const LogChannel &l2){
if(l1.boardName.compare(l2.boardName) == 0){
return l1.channel < l2.channel;
}
else{
return l1.boardName < l2.boardName;
}
}
void PrintContents();
};
class TLogStorage {
private:
vector<TSingleLogLine>* vRawLog;
vector<LogChannel> vLog;
time_t globalMinTime;
time_t globalMaxTime;
vector<string> vUniqueParamName;
vector<string> vUniqueBoardName;
vector<int> vUniqueChannelNumber;
void GenerateListOfUniques();
int GenerateStructure();
void SortStructure();
time_t GetTime(string& rawTimeStamp);
void FillStructure();
void CreateGraphs();
public:
TLogStorage(vector<TSingleLogLine> *vRawLog);
virtual ~TLogStorage();
int Fill();
void AnalyseMinMax();
void PrintStructure();
void PrintContents();
vector<LogChannel>* GetLog();
void GetUniques(vector<string> &vUniqueBoardName, vector<int> &vUniqueChannelNumber, vector<string> &vUniqueParamName);
time_t GetGlobalMinTime();
time_t GetGlobalMaxTime();
};
} /* namespace std */
#endif /* TLOGSTORAGE_H_ */