23 #ifndef PD_VALUERING_H 24 #define PD_VALUERING_H 31 #define VALUERING_DEBUG 0 50 void setRange(std::chrono::nanoseconds);
51 std::chrono::nanoseconds
getRange()
const {
return range; }
53 void append(std::chrono::nanoseconds time,
const T &value);
66 QList<TimeValuePair> ring;
69 std::chrono::nanoseconds range;
73 void removeDeprecated();
117 if ((
int) length < ring.size()) {
118 unsigned int o = (offset + length) % ring.size();
122 qDebug() << ring.size() <<
"reached.";
128 ring.append(newPair);
142 std::chrono::nanoseconds time
147 for (
unsigned int i = 0; i < other.length; i++) {
149 if (p.first > time) {
190 return ring[(offset + index) % ring.size()];
202 return ring.at((offset + index) % ring.size());
217 return ring[(offset + index) % ring.size()];
220 return ring[(offset + length + index) % ring.size()];
236 return ring.at((offset + index) % ring.size());
239 return ring.at((offset + length + index) % ring.size());
251 std::chrono::nanoseconds depTime((*
this)[length - 1].first - range);
253 if (ring[offset].first < depTime) {
254 offset = (offset + 1) % ring.size();
268 void ValueRing<T>::reshape()
270 QList<TimeValuePair> newRing;
274 qDebug() <<
"reshaping" << length <<
"values";
277 for (i = 0; i < length; i++) {
278 newRing.append((*
this)[i]);