QtPdWidgets  2.3.1
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Pd::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 Pd::ValueRing< T >

Time/Value ring buffer.

Member Typedef Documentation

◆ TimeValuePair

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

Constructor & Destructor Documentation

◆ ValueRing()

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

Constructor.

◆ ~ValueRing()

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

Destructor.

Member Function Documentation

◆ append()

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

Appends a value to the ring.

Referenced by Pd::ValueRing< double >::copyUntil(), and Pd::ValueRing< double >::reshape().

◆ clear()

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

Clears the ring.

Referenced by Pd::ValueRing< double >::clear().

◆ copyUntil()

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

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

◆ getLength()

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

Referenced by Pd::Graph::Layer::fillExtrema().

◆ getRange()

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

◆ operator[]() [1/4]

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

Index operator.

◆ operator[]() [2/4]

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

Constant index operator.

◆ operator[]() [3/4]

template<class T >
ValueRing< T >::TimeValuePair & Pd::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 & Pd::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 Pd::ValueRing< T >::removeDeprecated ( )
private

Remove values that exceed the time range.

◆ reshape()

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

Reshape the ring to move the offset to zero.

◆ setRange()

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

Sets the range.

Member Data Documentation

◆ length

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

Number of valid elements at offset.

Referenced by Pd::ValueRing< double >::copyUntil().

◆ offset

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

Ring offset.

◆ range

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

Time range covered by the ring.

Used to remove values from the end.

Referenced by Pd::ValueRing< double >::getRange().

◆ ring

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

Time/Value ring.


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