gr-baz Package
baz_auto_ber_bf.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004 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 /*
24  * gr-baz by Balint Seeber (http://spench.net/contact)
25  * Information, documentation & samples: http://wiki.spench.net/wiki/gr-baz
26  */
27 
28 #ifndef INCLUDED_BAZ_AUTO_BER_BF_H
29 #define INCLUDED_BAZ_AUTO_BER_BF_H
30 
31 #include <gnuradio/sync_block.h>
32 
33 //#include <hash_map>
34 #include <boost/unordered_map.hpp>
35 #include <vector>
36 
38 
39 /*
40  * We use boost::shared_ptr's instead of raw pointers for all access
41  * to gr::blocks (and many other data structures). The shared_ptr gets
42  * us transparent reference counting, which greatly simplifies storage
43  * management issues. This is especially helpful in our hybrid
44  * C++ / Python system.
45  *
46  * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
47  *
48  * As a convention, the _sptr suffix indicates a boost::shared_ptr
49  */
50 typedef boost::shared_ptr<baz_auto_ber_bf> baz_auto_ber_bf_sptr;
51 
52 /*!
53  * \brief Return a shared_ptr to a new instance of baz_auto_ber_bf.
54  *
55  * To avoid accidental use of raw pointers, baz_auto_ber_bf's
56  * constructor is private. howto_make_square2_ff is the public
57  * interface for creating new instances.
58  */
59 BAZ_API baz_auto_ber_bf_sptr baz_make_auto_ber_bf (int degree, int sync_bits, int sync_decim/*, int sync_skip*/);
60 
61 namespace gr { namespace digital {
62 class glfsr;
63 } }
64 
65 /*!
66  * \brief square2 a stream of floats.
67  * \ingroup block
68  *
69  * This uses the preferred technique: subclassing gr::sync_block.
70  */
71 class BAZ_API baz_auto_ber_bf : public gr::sync_block
72 {
73 private:
74  // The friend declaration allows howto_make_square2_ff to
75  // access the private constructor.
76 
77  friend BAZ_API baz_auto_ber_bf_sptr baz_make_auto_ber_bf (int degree, int sync_bits, int sync_decim);
78 
79  baz_auto_ber_bf (int degree, int sync_bits, int sync_decim); // private constructor
80 
81  gr::digital::glfsr* d_glfsr;
82  int d_glfsr_length, d_glfsr_rounded_length;
83  //typedef std::hash_map<uint64_t, int> SyncMap;
84  typedef boost::unordered_map<uint64_t, int> SyncMap;
85  SyncMap d_sync_map, d_dupe_map;
86  std::vector<uint64_t> d_sync_list;
87  uint64_t d_current_word;
88  int d_sync_bit_length;
89 
90 public:
91  ~baz_auto_ber_bf (); // public destructor
92 
93 // void set_exponent(float exponent);
94 
95 // inline float exponent() const
96 // { return d_exponent; }
97 
98  int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
99 };
100 
101 #endif /* INCLUDED_BAZ_AUTO_BER_BF_H */
class BAZ_API baz_auto_ber_bf
Definition: baz_auto_ber_bf.h:37
square2 a stream of floats.This uses the preferred technique: subclassing gr::sync_block.
Definition: baz_auto_ber_bf.h:71
Definition: baz_additive_scrambler_bb.h:28
#define BAZ_API
Definition: config.h:8
BAZ_API baz_auto_ber_bf_sptr baz_make_auto_ber_bf(int degree, int sync_bits, int sync_decim)
Return a shared_ptr to a new instance of baz_auto_ber_bf.