QtPdCom  1.4.1
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
QtPdCom::ValueRing< T > Class Template Reference

Time/Value ring buffer. More...

#include <ValueRing.h>

Public Types

typedef QPair< std::chrono::nanoseconds, T > TimeValuePair
 

Public Member Functions

 ValueRing ()
 Constructor. More...
 
 ~ValueRing ()
 Destructor. More...
 
void setRange (std::chrono::nanoseconds)
 Sets the range. More...
 
std::chrono::nanoseconds getRange () const
 
void append (std::chrono::nanoseconds time, const T &value)
 Appends a value to the ring. More...
 
void copyUntil (const ValueRing< T > &, std::chrono::nanoseconds)
 Copies data from another ring, up to a specific time. More...
 
void clear ()
 Clears the ring. More...
 
unsigned int getLength () const
 
TimeValuePairoperator[] (unsigned int index)
 Index operator. More...
 
const TimeValuePairoperator[] (unsigned int index) const
 Constant index operator. More...
 
TimeValuePairoperator[] (int index)
 Index operator with int argument. More...
 
const TimeValuePairoperator[] (int index) const
 Constant index operator with int argument. More...
 

Private Member Functions

void removeDeprecated ()
 Remove values that exceed the time range. More...
 
void reshape ()
 Reshape the ring to move the offset to zero. More...
 

Private Attributes

QList< TimeValuePairring
 Time/Value ring. More...
 
unsigned int offset
 Ring offset. More...
 
unsigned int length
 Number of valid elements at offset. More...
 
std::chrono::nanoseconds range
 Time range covered by the ring. More...
 

Detailed Description

template<class T>
class QtPdCom::ValueRing< T >

Time/Value ring buffer.

Member Typedef Documentation

◆ TimeValuePair

template<class T>
typedef QPair<std::chrono::nanoseconds, T> QtPdCom::ValueRing< T >::TimeValuePair

Constructor & Destructor Documentation

◆ ValueRing()

template<class T >
QtPdCom::ValueRing< T >::ValueRing ( )

Constructor.

◆ ~ValueRing()

template<class T >
QtPdCom::ValueRing< T >::~ValueRing ( )

Destructor.

Member Function Documentation

◆ append()

template<class T >
void QtPdCom::ValueRing< T >::append ( std::chrono::nanoseconds  time,
const T &  value 
)

Appends a value to the ring.

Referenced by QtPdCom::ValueRing< T >::copyUntil().

◆ clear()

template<class T >
void QtPdCom::ValueRing< T >::clear ( )

Clears the ring.

◆ copyUntil()

template<class T >
void QtPdCom::ValueRing< T >::copyUntil ( const ValueRing< T > &  other,
std::chrono::nanoseconds  time 
)

Copies data from another ring, up to a specific time.

References QtPdCom::ValueRing< T >::append(), and QtPdCom::ValueRing< T >::length.

◆ getLength()

template<class T >
unsigned int QtPdCom::ValueRing< T >::getLength ( ) const
inline
Returns
The length.

◆ getRange()

template<class T>
std::chrono::nanoseconds QtPdCom::ValueRing< T >::getRange ( ) const
inline

◆ operator[]() [1/4]

template<class T >
ValueRing< T >::TimeValuePair & QtPdCom::ValueRing< T >::operator[] ( unsigned int  index)
inline

Index operator.

◆ operator[]() [2/4]

template<class T >
const ValueRing< T >::TimeValuePair & QtPdCom::ValueRing< T >::operator[] ( unsigned int  index) const
inline

Constant index operator.

◆ operator[]() [3/4]

template<class T >
ValueRing< T >::TimeValuePair & QtPdCom::ValueRing< T >::operator[] ( int  index)
inline

Index operator with int argument.

Allows to specify negative indices (from the end).

◆ operator[]() [4/4]

template<class T >
const ValueRing< T >::TimeValuePair & QtPdCom::ValueRing< T >::operator[] ( int  index) const
inline

Constant index operator with int argument.

Allows to specify negative indices (from the end).

◆ removeDeprecated()

template<class T >
void QtPdCom::ValueRing< T >::removeDeprecated ( )
private

Remove values that exceed the time range.

◆ reshape()

template<class T >
void QtPdCom::ValueRing< T >::reshape ( )
private

Reshape the ring to move the offset to zero.

◆ setRange()

template<class T >
void QtPdCom::ValueRing< T >::setRange ( std::chrono::nanoseconds  r)

Sets the range.

Member Data Documentation

◆ length

template<class T>
unsigned int QtPdCom::ValueRing< T >::length
private

Number of valid elements at offset.

Referenced by QtPdCom::ValueRing< T >::copyUntil().

◆ offset

template<class T>
unsigned int QtPdCom::ValueRing< T >::offset
private

Ring offset.

◆ range

template<class T>
std::chrono::nanoseconds QtPdCom::ValueRing< T >::range
private

Time range covered by the ring.

Used to remove values from the end.

Referenced by QtPdCom::ValueRing< T >::getRange().

◆ ring

template<class T>
QList<TimeValuePair> QtPdCom::ValueRing< T >::ring
private

Time/Value ring.


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