GNU Radio 3.5.1 C++ API
digital_ofdm_mapper_bcv.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2006,2007,2011 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H
00024 #define INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H
00025 
00026 #include <digital_api.h>
00027 #include <gr_sync_block.h>
00028 #include <gr_message.h>
00029 #include <gr_msg_queue.h>
00030 
00031 class digital_ofdm_mapper_bcv;
00032 typedef boost::shared_ptr<digital_ofdm_mapper_bcv> digital_ofdm_mapper_bcv_sptr;
00033 
00034 DIGITAL_API digital_ofdm_mapper_bcv_sptr 
00035 digital_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, 
00036                               unsigned occupied_carriers, unsigned int fft_length);
00037 
00038 /*!
00039  * \brief take a stream of bytes in and map to a vector of complex
00040  * constellation points suitable for IFFT input to be used in an ofdm
00041  * modulator.  Abstract class must be subclassed with specific mapping.
00042  * \ingroup modulation_blk
00043  * \ingroup ofdm_blk
00044  */
00045 
00046 class DIGITAL_API digital_ofdm_mapper_bcv : public gr_sync_block
00047 {
00048   friend DIGITAL_API digital_ofdm_mapper_bcv_sptr
00049   digital_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, 
00050                                 unsigned occupied_carriers, unsigned int fft_length);
00051 protected:
00052   digital_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, 
00053                            unsigned occupied_carriers, unsigned int fft_length);
00054 
00055  private:
00056   std::vector<gr_complex> d_constellation;
00057   gr_msg_queue_sptr     d_msgq;
00058   gr_message_sptr       d_msg;
00059   unsigned              d_msg_offset;
00060   bool                  d_eof;
00061   
00062   unsigned int          d_occupied_carriers;
00063   unsigned int          d_fft_length;
00064   unsigned int          d_bit_offset;
00065   int                   d_pending_flag;
00066 
00067   unsigned long  d_nbits;
00068   unsigned char  d_msgbytes;
00069   
00070   unsigned char d_resid;
00071   unsigned int d_nresid;
00072 
00073   std::vector<int> d_subcarrier_map;
00074 
00075   int randsym();
00076 
00077  public:
00078   ~digital_ofdm_mapper_bcv(void);
00079 
00080   gr_msg_queue_sptr     msgq() const { return d_msgq; }
00081 
00082   int work(int noutput_items,
00083            gr_vector_const_void_star &input_items,
00084            gr_vector_void_star &output_items);
00085 
00086 };
00087 
00088 #endif