10#ifndef INCLUDED_DVBS2RX_CDEQUE_H
11#define INCLUDED_DVBS2RX_CDEQUE_H
13#include <volk/volk_alloc.hh>
114 const unsigned int L;
115 const unsigned int n_reps;
118 explicit cdeque(
unsigned int len,
unsigned int n_reps = 10)
119 : buf(n_reps * len), i_tail(0), L(len), n_reps(n_reps)
136 i_tail = ((n_reps - 1) * L) + 1;
137 std::copy(buf.begin(), buf.begin() + L - 1, buf.end() - L + 1);
154 if (i_tail == ((n_reps - 1) * L)) {
156 std::copy(buf.end() - L + 1, buf.end(), buf.begin());
158 buf[++i_tail + L - 1] = in;
165 const T&
back()
const {
return buf[i_tail]; }
171 const T&
front()
const {
return buf[i_tail + L - 1]; }
177 unsigned int length()
const {
return L; }
unsigned int length() const
Get length L of the queue.
Definition cdeque.h:177
void push_front(const T &in)
Push new element into the ring buffer's front (head).
Definition cdeque.h:150
const T & front() const
Access the element at the front of the queue.
Definition cdeque.h:171
void push_back(const T &in)
Push new element into the ring buffer's back (tail).
Definition cdeque.h:131
const T & back() const
Access the element at the back of the queue.
Definition cdeque.h:165
cdeque(unsigned int len, unsigned int n_reps=10)
Definition cdeque.h:118
Fixed-length double-ended queue with contiguous volk-aligned elements.
Definition gr_bch.h:22