swift
Loading...
Searching...
No Matches
swift::misc::ITimestampObjectList< OBJ, CONTAINER > Class Template Reference

List of objects with timestamp. Such objects should implement. More...

#include <timestampobjectlist.h>

Inheritance diagram for swift::misc::ITimestampObjectList< OBJ, CONTAINER >:
[legend]

Public Types

enum  HintTimestampSort { NoTimestampSortHint , TimestampLatestFirst , TimestampLatestLast }
 Hint if the list is sorted. More...

Public Member Functions

CONTAINER findBefore (const QDateTime &dateTime) const
 List of objects before dateTime (older).
CONTAINER findBefore (qint64 msSinceEpoch) const
 List of objects before msSinceEpoch (older).
OBJ findObjectBeforeOrDefault (qint64 msSinceEpoch) const
 Object before timestamp or default (older).
CONTAINER findBeforeAndRemove (qint64 msSinceEpoch)
 Get objects before msSinceEpoch and remove those.
CONTAINER findBeforeNowMinusOffset (qint64 msOffset) const
 List of objects before now - offset.
CONTAINER findAfter (const QDateTime &dateTime) const
 List of objects after dateTime (newer).
CONTAINER findAfter (qint64 msSinceEpoch) const
 List of objects after msSinceEpoch (newer).
CONTAINER findAfterNowMinusOffset (qint64 msOffset) const
 List of objects before now - offset.
OBJ findObjectAfterOrDefault (qint64 msSinceEpoch) const
 List of objects after msSinceEpoch (newer).
CONTAINER findInvalidTimestamps () const
 Objects without valid timestamp.
OBJ findClosestTimeDistance (qint64 msSinceEpoch) const
 Find closest (or default).
bool hasInvalidTimestamps () const
 Has invalid timestamp.
void setCurrentUtcTime ()
 Set all timestamps to now.
void setUtcTime (qint64 msSinceEpoch)
 Set all timestamps to given time.
void setInvalidTimestampsToCurrentUtcTime ()
 Set invalid timestamps to now.
QDateTime latestTimestamp () const
 Latest timestamp.
qint64 latestTimestampMsecsSinceEpoch () const
 Latest timestamp.
QDateTime oldestTimestamp () const
 Oldest timestamp.
qint64 oldestTimestampMsecsSinceEpoch () const
 Oldest timestamp.
OBJ latestObject () const
 Latest object.
OBJ oldestObject () const
 Latest object.
int removeBefore (const QDateTime &dateTime)
 Remove objects with timestamp before dateTime.
int removeBefore (qint64 msSinceEpoch)
 Remove objects with timestamp before dateTime.
int removeOlderThanNowMinusOffset (qint64 offsetMs)
 Remove objects older than seconds.
void sortLatestFirst ()
 Sort by timestamp.
void sortOldestFirst ()
 Sort by timestamp.
void push_frontKeepLatestFirst (const OBJ &value, bool replaceSameTimestamp=true, int maxElements=-1)
 Insert as first element by keeping maxElements and the latest first.
void push_backIncreaseTimestamp (const OBJ &newObject)
 Push back and increase the timestamp at least by +1ms if equal to last element.
void push_backOverrideTimestamp (const OBJ &newObject, qint64 newTsMsSinceEpoch)
 Push back, but set new timestamp.
void setNewTimestampStartingLast (qint64 startTimeStampMs, qint64 deltaTimeMs)
 Set new timestamps starting with the last element.
int replaceIfSameTimestamp (const OBJ &newObject)
 Replace if an object has the same timestamp.
bool isSortedLatestLast () const
 Is completely sorted: latest last.
bool isSortedLatestFirst () const
 Is completely sorted: latest last.
void addMsecs (qint64 msToAdd)
 Adds a time to all values.
void setSortHint (HintTimestampSort hint)
 Set the hint.
MillisecondsMinMaxMean getTimestampDifferenceMinMaxMean () const
 Difference of timestamp values.

Protected Member Functions

 ITimestampObjectList ()=default
 Constructor.
const CONTAINER & container () const
 Container.
CONTAINER & container ()
 Container.

Protected Attributes

HintTimestampSort m_tsSortHint = NoTimestampSortHint
 sort hint

Detailed Description

template<class OBJ, class CONTAINER>
class swift::misc::ITimestampObjectList< OBJ, CONTAINER >

List of objects with timestamp. Such objects should implement.

See also
ITimestampBased

Definition at line 51 of file timestampobjectlist.h.

Member Enumeration Documentation

◆ HintTimestampSort

template<class OBJ, class CONTAINER>
enum swift::misc::ITimestampObjectList::HintTimestampSort

Hint if the list is sorted.

Definition at line 57 of file timestampobjectlist.h.

Member Function Documentation

◆ addMsecs()

template<class OBJ, class CONTAINER>
void swift::misc::ITimestampObjectList< OBJ, CONTAINER >::addMsecs ( qint64 msToAdd)
inline

Adds a time to all values.

Definition at line 407 of file timestampobjectlist.h.

◆ container() [1/2]

template<class OBJ, class CONTAINER>
CONTAINER & swift::misc::ITimestampObjectList< OBJ, CONTAINER >::container ( )
inlineprotected

Container.

Definition at line 476 of file timestampobjectlist.h.

◆ container() [2/2]

template<class OBJ, class CONTAINER>
const CONTAINER & swift::misc::ITimestampObjectList< OBJ, CONTAINER >::container ( ) const
inlineprotected

Container.

Definition at line 473 of file timestampobjectlist.h.

◆ findAfter() [1/2]

template<class OBJ, class CONTAINER>
CONTAINER swift::misc::ITimestampObjectList< OBJ, CONTAINER >::findAfter ( const QDateTime & dateTime) const
inline

List of objects after dateTime (newer).

Definition at line 99 of file timestampobjectlist.h.

◆ findAfter() [2/2]

template<class OBJ, class CONTAINER>
CONTAINER swift::misc::ITimestampObjectList< OBJ, CONTAINER >::findAfter ( qint64 msSinceEpoch) const
inline

List of objects after msSinceEpoch (newer).

Definition at line 102 of file timestampobjectlist.h.

◆ findAfterNowMinusOffset()

template<class OBJ, class CONTAINER>
CONTAINER swift::misc::ITimestampObjectList< OBJ, CONTAINER >::findAfterNowMinusOffset ( qint64 msOffset) const
inline

List of objects before now - offset.

Definition at line 108 of file timestampobjectlist.h.

◆ findBefore() [1/2]

template<class OBJ, class CONTAINER>
CONTAINER swift::misc::ITimestampObjectList< OBJ, CONTAINER >::findBefore ( const QDateTime & dateTime) const
inline

List of objects before dateTime (older).

Definition at line 65 of file timestampobjectlist.h.

◆ findBefore() [2/2]

template<class OBJ, class CONTAINER>
CONTAINER swift::misc::ITimestampObjectList< OBJ, CONTAINER >::findBefore ( qint64 msSinceEpoch) const
inline

List of objects before msSinceEpoch (older).

Definition at line 68 of file timestampobjectlist.h.

◆ findBeforeAndRemove()

template<class OBJ, class CONTAINER>
CONTAINER swift::misc::ITimestampObjectList< OBJ, CONTAINER >::findBeforeAndRemove ( qint64 msSinceEpoch)
inline

Get objects before msSinceEpoch and remove those.

Definition at line 85 of file timestampobjectlist.h.

◆ findBeforeNowMinusOffset()

template<class OBJ, class CONTAINER>
CONTAINER swift::misc::ITimestampObjectList< OBJ, CONTAINER >::findBeforeNowMinusOffset ( qint64 msOffset) const
inline

List of objects before now - offset.

Definition at line 93 of file timestampobjectlist.h.

◆ findClosestTimeDistance()

template<class OBJ, class CONTAINER>
OBJ swift::misc::ITimestampObjectList< OBJ, CONTAINER >::findClosestTimeDistance ( qint64 msSinceEpoch) const
inline

Find closest (or default).

Definition at line 131 of file timestampobjectlist.h.

◆ findInvalidTimestamps()

template<class OBJ, class CONTAINER>
CONTAINER swift::misc::ITimestampObjectList< OBJ, CONTAINER >::findInvalidTimestamps ( ) const
inline

Objects without valid timestamp.

Definition at line 125 of file timestampobjectlist.h.

◆ findObjectAfterOrDefault()

template<class OBJ, class CONTAINER>
OBJ swift::misc::ITimestampObjectList< OBJ, CONTAINER >::findObjectAfterOrDefault ( qint64 msSinceEpoch) const
inline

List of objects after msSinceEpoch (newer).

Definition at line 114 of file timestampobjectlist.h.

◆ findObjectBeforeOrDefault()

template<class OBJ, class CONTAINER>
OBJ swift::misc::ITimestampObjectList< OBJ, CONTAINER >::findObjectBeforeOrDefault ( qint64 msSinceEpoch) const
inline

Object before timestamp or default (older).

Definition at line 74 of file timestampobjectlist.h.

◆ getTimestampDifferenceMinMaxMean()

template<class OBJ, class CONTAINER>
MillisecondsMinMaxMean swift::misc::ITimestampObjectList< OBJ, CONTAINER >::getTimestampDifferenceMinMaxMean ( ) const
inline

Difference of timestamp values.

Precondition
timestamp list has to be sorted to get meaningful values

Definition at line 424 of file timestampobjectlist.h.

◆ hasInvalidTimestamps()

template<class OBJ, class CONTAINER>
bool swift::misc::ITimestampObjectList< OBJ, CONTAINER >::hasInvalidTimestamps ( ) const
inline

Has invalid timestamp.

Definition at line 146 of file timestampobjectlist.h.

◆ isSortedLatestFirst()

template<class OBJ, class CONTAINER>
bool swift::misc::ITimestampObjectList< OBJ, CONTAINER >::isSortedLatestFirst ( ) const
inline

Is completely sorted: latest last.

Remarks
all object must have a valid timestamp

Definition at line 384 of file timestampobjectlist.h.

◆ isSortedLatestLast()

template<class OBJ, class CONTAINER>
bool swift::misc::ITimestampObjectList< OBJ, CONTAINER >::isSortedLatestLast ( ) const
inline

Is completely sorted: latest last.

Remarks
all object must have a valid timestamp

Definition at line 360 of file timestampobjectlist.h.

◆ latestObject()

template<class OBJ, class CONTAINER>
OBJ swift::misc::ITimestampObjectList< OBJ, CONTAINER >::latestObject ( ) const
inline

Latest object.

Definition at line 214 of file timestampobjectlist.h.

◆ latestTimestamp()

template<class OBJ, class CONTAINER>
QDateTime swift::misc::ITimestampObjectList< OBJ, CONTAINER >::latestTimestamp ( ) const
inline

Latest timestamp.

Definition at line 180 of file timestampobjectlist.h.

◆ latestTimestampMsecsSinceEpoch()

template<class OBJ, class CONTAINER>
qint64 swift::misc::ITimestampObjectList< OBJ, CONTAINER >::latestTimestampMsecsSinceEpoch ( ) const
inline

Latest timestamp.

Definition at line 190 of file timestampobjectlist.h.

◆ oldestObject()

template<class OBJ, class CONTAINER>
OBJ swift::misc::ITimestampObjectList< OBJ, CONTAINER >::oldestObject ( ) const
inline

Latest object.

Definition at line 228 of file timestampobjectlist.h.

◆ oldestTimestamp()

template<class OBJ, class CONTAINER>
QDateTime swift::misc::ITimestampObjectList< OBJ, CONTAINER >::oldestTimestamp ( ) const
inline

Oldest timestamp.

Definition at line 197 of file timestampobjectlist.h.

◆ oldestTimestampMsecsSinceEpoch()

template<class OBJ, class CONTAINER>
qint64 swift::misc::ITimestampObjectList< OBJ, CONTAINER >::oldestTimestampMsecsSinceEpoch ( ) const
inline

Oldest timestamp.

Definition at line 207 of file timestampobjectlist.h.

◆ push_backIncreaseTimestamp()

template<class OBJ, class CONTAINER>
void swift::misc::ITimestampObjectList< OBJ, CONTAINER >::push_backIncreaseTimestamp ( const OBJ & newObject)
inline

Push back and increase the timestamp at least by +1ms if equal to last element.

Remarks
if the timestamp is already greater it does not modifcation

Definition at line 303 of file timestampobjectlist.h.

◆ push_backOverrideTimestamp()

template<class OBJ, class CONTAINER>
void swift::misc::ITimestampObjectList< OBJ, CONTAINER >::push_backOverrideTimestamp ( const OBJ & newObject,
qint64 newTsMsSinceEpoch )
inline

Push back, but set new timestamp.

Definition at line 321 of file timestampobjectlist.h.

◆ push_frontKeepLatestFirst()

template<class OBJ, class CONTAINER>
void swift::misc::ITimestampObjectList< OBJ, CONTAINER >::push_frontKeepLatestFirst ( const OBJ & value,
bool replaceSameTimestamp = true,
int maxElements = -1 )
inline

Insert as first element by keeping maxElements and the latest first.

Definition at line 268 of file timestampobjectlist.h.

◆ removeBefore() [1/2]

template<class OBJ, class CONTAINER>
int swift::misc::ITimestampObjectList< OBJ, CONTAINER >::removeBefore ( const QDateTime & dateTime)
inline

Remove objects with timestamp before dateTime.

Definition at line 242 of file timestampobjectlist.h.

◆ removeBefore() [2/2]

template<class OBJ, class CONTAINER>
int swift::misc::ITimestampObjectList< OBJ, CONTAINER >::removeBefore ( qint64 msSinceEpoch)
inline

Remove objects with timestamp before dateTime.

Definition at line 245 of file timestampobjectlist.h.

◆ removeOlderThanNowMinusOffset()

template<class OBJ, class CONTAINER>
int swift::misc::ITimestampObjectList< OBJ, CONTAINER >::removeOlderThanNowMinusOffset ( qint64 offsetMs)
inline

Remove objects older than seconds.

Definition at line 251 of file timestampobjectlist.h.

◆ replaceIfSameTimestamp()

template<class OBJ, class CONTAINER>
int swift::misc::ITimestampObjectList< OBJ, CONTAINER >::replaceIfSameTimestamp ( const OBJ & newObject)
inline

Replace if an object has the same timestamp.

Definition at line 344 of file timestampobjectlist.h.

◆ setCurrentUtcTime()

template<class OBJ, class CONTAINER>
void swift::misc::ITimestampObjectList< OBJ, CONTAINER >::setCurrentUtcTime ( )
inline

Set all timestamps to now.

Definition at line 149 of file timestampobjectlist.h.

◆ setInvalidTimestampsToCurrentUtcTime()

template<class OBJ, class CONTAINER>
void swift::misc::ITimestampObjectList< OBJ, CONTAINER >::setInvalidTimestampsToCurrentUtcTime ( )
inline

Set invalid timestamps to now.

Definition at line 167 of file timestampobjectlist.h.

◆ setNewTimestampStartingLast()

template<class OBJ, class CONTAINER>
void swift::misc::ITimestampObjectList< OBJ, CONTAINER >::setNewTimestampStartingLast ( qint64 startTimeStampMs,
qint64 deltaTimeMs )
inline

Set new timestamps starting with the last element.

Definition at line 329 of file timestampobjectlist.h.

◆ setSortHint()

template<class OBJ, class CONTAINER>
void swift::misc::ITimestampObjectList< OBJ, CONTAINER >::setSortHint ( HintTimestampSort hint)
inline

Set the hint.

Definition at line 420 of file timestampobjectlist.h.

◆ setUtcTime()

template<class OBJ, class CONTAINER>
void swift::misc::ITimestampObjectList< OBJ, CONTAINER >::setUtcTime ( qint64 msSinceEpoch)
inline

Set all timestamps to given time.

Definition at line 158 of file timestampobjectlist.h.

◆ sortLatestFirst()

template<class OBJ, class CONTAINER>
void swift::misc::ITimestampObjectList< OBJ, CONTAINER >::sortLatestFirst ( )
inline

Sort by timestamp.

Definition at line 258 of file timestampobjectlist.h.

◆ sortOldestFirst()

template<class OBJ, class CONTAINER>
void swift::misc::ITimestampObjectList< OBJ, CONTAINER >::sortOldestFirst ( )
inline

Sort by timestamp.

Definition at line 265 of file timestampobjectlist.h.

Member Data Documentation

◆ m_tsSortHint

template<class OBJ, class CONTAINER>
HintTimestampSort swift::misc::ITimestampObjectList< OBJ, CONTAINER >::m_tsSortHint = NoTimestampSortHint
protected

sort hint

Definition at line 478 of file timestampobjectlist.h.


The documentation for this class was generated from the following file: