31#define VALUERING_DEBUG 0
49 void setRange(std::chrono::nanoseconds);
52 void append(std::chrono::nanoseconds time,
const T &value);
117 qDebug() <<
ring.size() <<
"reached.";
123 ring.append(newPair);
136 std::chrono::nanoseconds time)
140 for (
unsigned int i = 0; i < other.
length; i++) {
142 if (p.first > time) {
233 std::chrono::nanoseconds depTime((*
this)[
length - 1].first -
range);
252 QList<TimeValuePair> newRing;
256 qDebug() <<
"reshaping" <<
length <<
"values";
259 for (i = 0; i <
length; i++) {
260 newRing.append((*
this)[i]);
Time/Value ring buffer.
Definition ValueRing.h:44
void copyUntil(const ValueRing< T > &, std::chrono::nanoseconds)
Copies data from another ring, up to a specific time.
Definition ValueRing.h:134
QPair< std::chrono::nanoseconds, T > TimeValuePair
Definition ValueRing.h:58
QList< TimeValuePair > ring
Time/Value ring.
Definition ValueRing.h:65
void removeDeprecated()
Remove values that exceed the time range.
Definition ValueRing.h:230
TimeValuePair & operator[](unsigned int index)
Index operator.
Definition ValueRing.h:177
void reshape()
Reshape the ring to move the offset to zero.
Definition ValueRing.h:250
~ValueRing()
Destructor.
Definition ValueRing.h:89
unsigned int getLength() const
Definition ValueRing.h:167
void clear()
Clears the ring.
Definition ValueRing.h:155
unsigned int offset
Ring offset.
Definition ValueRing.h:66
void setRange(std::chrono::nanoseconds)
Sets the range.
Definition ValueRing.h:96
unsigned int length
Number of valid elements at offset.
Definition ValueRing.h:67
ValueRing()
Constructor.
Definition ValueRing.h:80
void append(std::chrono::nanoseconds time, const T &value)
Appends a value to the ring.
Definition ValueRing.h:107
std::chrono::nanoseconds getRange() const
Definition ValueRing.h:50
std::chrono::nanoseconds range
Time range covered by the ring.
Definition ValueRing.h:68
Definition BroadcastModel.h:32