GNU Radio's SATNOGS Package
shift_reg.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
4 *
5 * Copyright (C) 2018, Libre Space Foundation <http://librespacefoundation.org/>
6 *
7 * This program 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 of the License, or
10 * (at your option) any later version.
11 *
12 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef INCLUDED_SATNOGS_SHIFT_REG_H
22#define INCLUDED_SATNOGS_SHIFT_REG_H
23
25#include <deque>
26#include <ostream>
27
28namespace gr {
29namespace satnogs {
30
31/*!
32 * \brief Implements a bit shift register
33 *
34 */
36{
37public:
38 shift_reg(size_t len);
40
41 void reset();
42
43 void set();
44
45 size_t len() const;
46
47 size_t size() const;
48
49 size_t count();
50
52
54
56
58
59 bool& operator[](size_t pos);
60
61 bool operator[](size_t pos) const;
62
64
65 void push_front(bool bit);
66
67 void push_back(bool bit);
68
69 bool front();
70
71 bool back();
72
73 friend std::ostream& operator<<(std::ostream& os, const shift_reg& reg);
74
75private:
76 const size_t d_len;
77 std::deque<bool> d_reg;
78};
79
80} // namespace satnogs
81} // namespace gr
82
83#endif /* INCLUDED_SATNOGS_SHIFT_REG_H */
#define SATNOGS_API
Definition: api.h:19
Implements a bit shift register.
Definition: shift_reg.h:36
bool operator[](size_t pos) const
shift_reg & operator<<=(bool bit)
size_t size() const
bool & operator[](size_t pos)
friend std::ostream & operator<<(std::ostream &os, const shift_reg &reg)
void push_front(bool bit)
shift_reg operator^(const shift_reg &rhs)
size_t len() const
shift_reg & operator>>=(bool bit)
shift_reg operator|(const shift_reg &rhs)
shift_reg operator&(const shift_reg &rhs)
void push_back(bool bit)
data_t reg[NROOTS+1]
Definition: decode_rs.h:78
Definition: amsat_duv_decoder.h:29