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 
24 #include <satnogs/api.h>
25 #include <deque>
26 #include <ostream>
27 
28 namespace gr {
29 namespace satnogs {
30 
31 /*!
32  * \brief Implements a bit shift register
33  *
34  */
36 public:
37  shift_reg(size_t len);
38  ~shift_reg();
39 
40  void
41  reset();
42 
43  void
44  set();
45 
46  size_t
47  len() const;
48 
49  size_t
50  size() const;
51 
52  size_t
53  count();
54 
55  shift_reg
56  operator|(const shift_reg &rhs);
57 
58  shift_reg
59  operator&(const shift_reg &rhs);
60 
61  shift_reg
62  operator^(const shift_reg &rhs);
63 
64  shift_reg &
65  operator>>=(bool bit);
66 
67  bool &
68  operator[](size_t pos);
69 
70  bool
71  operator[](size_t pos) const;
72 
73  shift_reg &
74  operator<<=(bool bit);
75 
76  void
77  push_front(bool bit);
78 
79  void
80  push_back(bool bit);
81 
82  bool
83  front();
84 
85  bool
86  back();
87 
88  friend std::ostream &
89  operator<<(std::ostream &os, const shift_reg &reg);
90 
91 private:
92  const size_t d_len;
93  std::deque<bool> d_reg;
94 };
95 
96 } // namespace satnogs
97 } // namespace gr
98 
99 #endif /* INCLUDED_SATNOGS_SHIFT_REG_H */
100 
int count
Definition: decode_rs.h:79
Implements a bit shift register.
Definition: shift_reg.h:35
std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, const day &d)
Definition: date.h:1475
Definition: amsat_duv_decoder.h:29
data_t reg[NROOTS+1]
Definition: decode_rs.h:78
#define SATNOGS_API
Definition: api.h:30