Classes | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
RangeQueue< T > Class Template Reference

A range queue. More...

#include <rangequeue.h>

Classes

struct  Range
 

Public Member Functions

void clear ()
 Clears the queue. More...
 
bool contains (uint32_t index) const
 Checks if the given index is contained in the queue. More...
 
void copy (RangeQueue< T > &destination, T start, T end)
 Copy all ranges within the given limits [start, end]. If the limit falls in a certain range, that range is split and included from the start until the limit. More...
 
count () const
 Returns the total number of indices captured by the ranges in the queue. More...
 
bool empty () const
 Returns true if the queue is empty. More...
 
first () const
 Returns the first index of the first range in the queue. More...
 
last () const
 Returns the last (highest) index in the queue. More...
 
const T operator[] (std::size_t index) const
 
void popBack (T upto)
 Removes all the indices upto and including upto from the queue. More...
 
void popFront (T upto)
 Removes all the indices upto and including upto from the queue. More...
 
void pushBack (T start, T end)
 Adds a range to the back of the queue Only a range newer than the most recent range in the queue is added. Older (also partial) are ignored Also end must be larger or equal than start. More...
 
 RangeQueue ()
 Default constructor. More...
 
recount ()
 Returns the recounted total number of indices captured by the ranges in the queue. More...
 
void remove (T index)
 Removes a specific index from the queue. More...
 
virtual ~RangeQueue ()
 

Static Public Member Functions

static const T illegalIndex ()
 Returns the value for an illegal index. More...
 

Private Attributes

m_count
 
xsens::Mutex m_mutex
 
std::list< Rangem_queue
 

Detailed Description

template<class T>
class RangeQueue< T >

A range queue.

Definition at line 75 of file rangequeue.h.

Constructor & Destructor Documentation

◆ RangeQueue()

template<class T >
RangeQueue< T >::RangeQueue ( )
inline

Default constructor.

Definition at line 80 of file rangequeue.h.

◆ ~RangeQueue()

template<class T >
virtual RangeQueue< T >::~RangeQueue ( )
inlinevirtual

Definition at line 84 of file rangequeue.h.

Member Function Documentation

◆ clear()

template<class T >
void RangeQueue< T >::clear ( )
inline

Clears the queue.

Definition at line 90 of file rangequeue.h.

◆ contains()

template<class T >
bool RangeQueue< T >::contains ( uint32_t  index) const
inline

Checks if the given index is contained in the queue.

Definition at line 259 of file rangequeue.h.

◆ copy()

template<class T >
void RangeQueue< T >::copy ( RangeQueue< T > &  destination,
start,
end 
)
inline

Copy all ranges within the given limits [start, end]. If the limit falls in a certain range, that range is split and included from the start until the limit.

Definition at line 307 of file rangequeue.h.

◆ count()

template<class T >
T RangeQueue< T >::count ( ) const
inline

Returns the total number of indices captured by the ranges in the queue.

Definition at line 272 of file rangequeue.h.

◆ empty()

template<class T >
bool RangeQueue< T >::empty ( ) const
inline

Returns true if the queue is empty.

Definition at line 290 of file rangequeue.h.

◆ first()

template<class T >
T RangeQueue< T >::first ( ) const
inline

Returns the first index of the first range in the queue.

Definition at line 206 of file rangequeue.h.

◆ illegalIndex()

template<class T >
static const T RangeQueue< T >::illegalIndex ( )
inlinestatic

Returns the value for an illegal index.

Definition at line 297 of file rangequeue.h.

◆ last()

template<class T >
T RangeQueue< T >::last ( ) const
inline

Returns the last (highest) index in the queue.

Definition at line 216 of file rangequeue.h.

◆ operator[]()

template<class T >
const T RangeQueue< T >::operator[] ( std::size_t  index) const
inline
Returns
a range limit.
Parameters
indexstart or end limit to return.

Concatenating the start and end points for each range will generate a list of limits, this function gives access to such a list. For example:

  • index 0: start of the first range
  • index 1: end of the first range
  • index 2: start of the second range
  • ...

Definition at line 236 of file rangequeue.h.

◆ popBack()

template<class T >
void RangeQueue< T >::popBack ( upto)
inline

Removes all the indices upto and including upto from the queue.

Definition at line 179 of file rangequeue.h.

◆ popFront()

template<class T >
void RangeQueue< T >::popFront ( upto)
inline

Removes all the indices upto and including upto from the queue.

Definition at line 152 of file rangequeue.h.

◆ pushBack()

template<class T >
void RangeQueue< T >::pushBack ( start,
end 
)
inline

Adds a range to the back of the queue Only a range newer than the most recent range in the queue is added. Older (also partial) are ignored Also end must be larger or equal than start.

Parameters
start: The first index of the range
endThe last index of the range

Definition at line 103 of file rangequeue.h.

◆ recount()

template<class T >
T RangeQueue< T >::recount ( )
inline

Returns the recounted total number of indices captured by the ranges in the queue.

Definition at line 279 of file rangequeue.h.

◆ remove()

template<class T >
void RangeQueue< T >::remove ( index)
inline

Removes a specific index from the queue.

Parameters
indexThe index to remove

This function removes the given index from the queue by splitting the containing range at the index

Definition at line 122 of file rangequeue.h.

Member Data Documentation

◆ m_count

template<class T >
T RangeQueue< T >::m_count
private

Definition at line 330 of file rangequeue.h.

◆ m_mutex

template<class T >
xsens::Mutex RangeQueue< T >::m_mutex
mutableprivate

Definition at line 333 of file rangequeue.h.

◆ m_queue

template<class T >
std::list<Range> RangeQueue< T >::m_queue
private

Definition at line 332 of file rangequeue.h.


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


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:22