1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-24 11:04:53 +00:00

Get elements of the circular deque without expensive bound checking

This commit is contained in:
Carles Fernandez
2019-09-09 12:10:40 +02:00
parent 476a2a73cf
commit 5f7f6366b6
2 changed files with 34 additions and 26 deletions

View File

@@ -44,7 +44,8 @@ public:
Gnss_circular_deque(); //!< Default constructor
Gnss_circular_deque(const unsigned int max_size, const unsigned int nchann); //!< nchann = number of channels; max_size = channel capacity
unsigned int size(const unsigned int ch); //!< Returns the number of available elements in a channel
T& at(const unsigned int ch, const unsigned int pos); //!< Returns a reference to an element
T& at(const unsigned int ch, const unsigned int pos); //!< Returns a reference to an element with bount checking
T& get(const unsigned int ch, const unsigned int pos); //!< Returns a reference to an element without bound checking
T& front(const unsigned int ch); //!< Returns a reference to the first element in the deque
T& back(const unsigned int ch); //!< Returns a reference to the last element in the deque
void push_back(const unsigned int ch, const T& new_data); //!< Inserts an element at the end of the deque
@@ -100,6 +101,13 @@ T& Gnss_circular_deque<T>::at(const unsigned int ch, const unsigned int pos)
}
template <class T>
T& Gnss_circular_deque<T>::get(const unsigned int ch, const unsigned int pos)
{
return d_data[ch][pos];
}
template <class T>
void Gnss_circular_deque<T>::clear(const unsigned int ch)
{