18 #ifndef GNSS_SDR_CIRCULAR_DEQUE_H 19 #define GNSS_SDR_CIRCULAR_DEQUE_H 21 #include <boost/circular_buffer.hpp> 36 unsigned int size(
unsigned int ch)
const;
37 T&
at(
unsigned int ch,
unsigned int pos);
38 const T&
get(
unsigned int ch,
unsigned int pos)
const;
39 T&
front(
unsigned int ch);
40 T&
back(
unsigned int ch);
41 void push_back(
unsigned int ch,
const T& new_data);
43 void clear(
unsigned int ch);
44 void reset(
unsigned int max_size,
unsigned int nchann);
48 std::vector<boost::circular_buffer<T>> d_data;
62 reset(max_size, nchann);
69 return d_data[ch].size();
76 return d_data[ch].back();
83 return d_data[ch].front();
90 return d_data.at(ch).at(pos);
97 return d_data[ch][pos];
112 if (max_size > 0 and nchann > 0)
114 for (
unsigned int i = 0; i < nchann; i++)
116 d_data.push_back(boost::circular_buffer<T>(max_size));
132 d_data[ch].pop_front();
139 d_data[ch].push_back(new_data);
145 #endif // GNSS_SDR_CIRCULAR_DEQUE_H T & front(unsigned int ch)
Returns a reference to the first element in the deque.
void clear(unsigned int ch)
Removes all the elements of the deque (Sets size to 0). Capacity is not modified. ...
T & at(unsigned int ch, unsigned int pos)
Returns a reference to an element with bound checking.
unsigned int size(unsigned int ch) const
Returns the number of available elements in a channel.
void pop_front(unsigned int ch)
Removes the first element of the deque.
Gnss_circular_deque()
Default constructor.
void reset()
Removes all the channels (Sets nchann to 0)
T & back(unsigned int ch)
Returns a reference to the last element in the deque.
void push_back(unsigned int ch, const T &new_data)
Inserts an element at the end of the deque.
const T & get(unsigned int ch, unsigned int pos) const
Returns a const reference to an element without bound checking.