46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
/*
|
||
* © Copyright 2014 – Urheberrechtshinweis
|
||
* Alle Rechte vorbehalten / All Rights Reserved
|
||
*
|
||
* Programmcode ist urheberrechtlich geschuetzt.
|
||
* Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner.
|
||
* Keine Verwendung ohne explizite Genehmigung.
|
||
* (vgl. § 106 ff UrhG / § 97 UrhG)
|
||
*/
|
||
|
||
#ifndef BEACONMEASUREMENTS_H
|
||
#define BEACONMEASUREMENTS_H
|
||
|
||
#include <vector>
|
||
|
||
#include "BeaconMeasurement.h"
|
||
|
||
/**
|
||
* group of several beacon measurements
|
||
*/
|
||
struct BeaconMeasurements {
|
||
|
||
std::vector<BeaconMeasurement> entries;
|
||
|
||
/** remove entries older then 3000 ms*/
|
||
void removeOld(const Timestamp latestTS) {
|
||
|
||
std::vector<BeaconMeasurement>::iterator it;
|
||
for (it = entries.begin(); it != entries.end(); ++it){
|
||
if(latestTS - it->getTimestamp() > Timestamp::fromMS(1000*3)){
|
||
entries.erase(it);
|
||
}
|
||
}
|
||
}
|
||
|
||
void add(const BeaconMeasurement& entry){
|
||
entries.push_back(entry);
|
||
|
||
//remove entries that are to old (3000ms)
|
||
removeOld(entry.getTimestamp());
|
||
}
|
||
|
||
};
|
||
|
||
#endif // BEACONMEASUREMENTS_H
|