GNU Radio Manual and C++ API Reference
3.7.5
The Free & Open Software Radio Ecosystem
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
atsc_interleaver_fifo.h
Go to the documentation of this file.
1
/* -*- c++ -*- */
2
/*
3
* Copyright 2014 Free Software Foundation, Inc.
4
*
5
* This file is part of GNU Radio
6
*
7
* GNU Radio is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 3, or (at your option)
10
* any later version.
11
*
12
* GNU Radio is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with GNU Radio; see the file COPYING. If not, write to
19
* the Free Software Foundation, Inc., 51 Franklin Street,
20
* Boston, MA 02110-1301, USA.
21
*/
22
23
#ifndef INCLUDED_DTV_ATSC_INTERLEAVER_FIFO_H
24
#define INCLUDED_DTV_ATSC_INTERLEAVER_FIFO_H
25
26
#include <string.h>
27
28
namespace
gr {
29
namespace
dtv {
30
31
template
<
class
symbol_type>
32
class
interleaver_fifo
{
33
public
:
34
35
interleaver_fifo
(
unsigned
int
size);
36
~interleaver_fifo
();
37
38
//! reset interleaver (flushes contents and resets commutator)
39
void
reset
();
40
41
//! stuff a symbol into the fifo and return the oldest
42
symbol_type
stuff
(symbol_type input) {
43
if
(
m_size
== 0)
44
return
input;
45
46
symbol_type retval =
m_fifo
[
m_position
];
47
m_fifo
[
m_position
] = input;
48
m_position
++;
49
if
(
m_position
>=
m_size
)
50
m_position
= 0;
51
52
return
retval;
53
}
54
55
protected
:
56
unsigned
int
m_size
;
57
unsigned
int
m_position
;
58
symbol_type *
m_fifo
;
59
};
60
61
template
<
class
symbol_type>
62
interleaver_fifo<symbol_type>::interleaver_fifo
(
unsigned
int
size)
63
{
64
m_size = size;
65
m_position = 0;
66
m_fifo =
new
symbol_type[size];
67
memset (m_fifo, 0, m_size *
sizeof
(symbol_type));
68
}
69
70
template
<
class
symbol_type>
71
interleaver_fifo<symbol_type>::~interleaver_fifo
()
72
{
73
delete
[] m_fifo;
74
}
75
76
template
<
class
symbol_type>
void
77
interleaver_fifo<symbol_type>::reset
()
78
{
79
m_position = 0;
80
memset (m_fifo, 0, m_size *
sizeof
(symbol_type));
81
}
82
83
}
/* namespace dtv */
84
}
/* namespace gr */
85
86
#endif
/* INCLUDED_DTV_ATSC_INTERLEAVER_FIFO_H */
gr-dtv
lib
atsc
atsc_interleaver_fifo.h
Generated on Fri Oct 3 2014 00:33:50 for GNU Radio Manual and C++ API Reference by
1.8.1.2