swift
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
swift::misc::ITimestampObjectList< OBJ, CONTAINER > Class Template Reference

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

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

Public Types

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

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. More...
 
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. More...
 
bool isSortedLatestFirst () const
 Is completely sorted: latest last. More...
 
void addMsecs (qint64 msToAdd)
 Adds a time to all values.
 
void setSortHint (HintTimestampSort hint)
 Set the hint.
 
MillisecondsMinMaxMean getTimestampDifferenceMinMaxMean () const
 Difference of timestamp values. More...
 

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 49 of file timestampobjectlist.h.

Member Function Documentation

◆ 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 356 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 331 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 316 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 262 of file timestampobjectlist.h.


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