-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogger.h
41 lines (35 loc) · 892 Bytes
/
Logger.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
# pragma once
# include <string>
# include <vector>
# include "Store.h"
using namespace std;
template <typename T>
class Logger {
private:
string sensor;
vector <Store<T>*> medidas;
public:
Logger(const string _sensor, const vector<Store<T>*> _medidas) : sensor(_sensor), medidas(_medidas) {}
~Logger() {}
void push(const T& v);
void push(const vector<T> v);
void log();
};
template <typename T>
void Logger<T>::push(const T& v) {
for (auto i : medidas)
i->push(v);
}
template <typename T>
void Logger<T>::push(const vector<T> v) {
for (auto i : medidas) {
for (unsigned j = 0; j < v.size(); j++)
i->push(v.at(j));
}
}
template <typename T>
void Logger<T>::log() {
cout << this->sensor << ':' << endl;
for (auto i : medidas)
cout << '\t' << i->to_string() << endl;
}