GNU Radio's DVBS2RX Package
delay_line.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright (c) 2021 Igor Freire.
4 *
5 * This file is part of gr-dvbs2rx.
6 *
7 * SPDX-License-Identifier: GPL-3.0-or-later
8 */
9
10#ifndef INCLUDED_DVBS2RX_DELAY_LINE_H
11#define INCLUDED_DVBS2RX_DELAY_LINE_H
12
13#include "cdeque.h"
14#include <cstring>
15
16namespace gr {
17namespace dvbs2rx {
18
19/**
20 * @brief Fixed-size delay-line with contiguous storage of volk-aligned elements
21 *
22 * Wrapper around the cdeque (contiguous double-ended queue) that implements a
23 * delay line, whose newest and oldest elements lie on the tail and head
24 * indexes, respectively. This implementation is meant to be used on tapped
25 * delay line algorithms, such as digital filters.
26 *
27 * Unlike cdeque, the delay line always returns the most recent to oldest
28 * samples when reading from tail to head. To ensure that, it only supports
29 * writing of new elements on the queue's back.
30 *
31 **/
32template <typename T>
33class delay_line : public cdeque<T>
34{
35public:
36 explicit delay_line(unsigned int len, unsigned int n_reps = 10)
37 : cdeque<T>(len, n_reps)
38 {
39 }
40 void push(const T& in) { this->push_back(in); }
41 void push_front(const T& in) = delete; // pushing at the front is forbidden
42};
43
44} // namespace dvbs2rx
45} // namespace gr
46
47#endif /* INCLUDED_DVBS2RX_DELAY_LINE_H */
Definition cdeque.h:110
void push_back(const T &in)
Push new element into the ring buffer's back (tail).
Definition cdeque.h:131
Fixed-size delay-line with contiguous storage of volk-aligned elements.
Definition delay_line.h:34
delay_line(unsigned int len, unsigned int n_reps=10)
Definition delay_line.h:36
void push(const T &in)
Definition delay_line.h:40
void push_front(const T &in)=delete
Fixed-length double-ended queue with contiguous volk-aligned elements.
Definition gr_bch.h:22