30 lines
556 B
C++
30 lines
556 B
C++
#ifndef SENSORREADINGS_H
|
|
#define SENSORREADINGS_H
|
|
|
|
#include <vector>
|
|
|
|
template <typename T> class SensorReadings {
|
|
|
|
/** combine sensor-values with a timestamp */
|
|
struct TimedEntry {
|
|
uint64_t ts;
|
|
T val;
|
|
TimedEntry(const uint64_t ts, const T& val) : ts(ts), val(val) {;}
|
|
};
|
|
|
|
public:
|
|
|
|
/** all readings (with timestamp) for one sensor */
|
|
std::vector<TimedEntry> values;
|
|
|
|
public:
|
|
|
|
/** add a new sensor-reading with timestamp */
|
|
void add(const uint64_t ts, const T& val) {
|
|
values.push_back(TimedEntry(ts, val));
|
|
}
|
|
|
|
};
|
|
|
|
#endif // SENSORREADINGS_H
|