GNU Radio 3.3.0 C++ API
gr_ofdm_mapper_bcv.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2006,2007 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_GR_OFDM_MAPPER_BCV_H
00024 #define INCLUDED_GR_OFDM_MAPPER_BCV_H
00025 
00026 #include <gr_sync_block.h>
00027 #include <gr_message.h>
00028 #include <gr_msg_queue.h>
00029 
00030 class gr_ofdm_mapper_bcv;
00031 typedef boost::shared_ptr<gr_ofdm_mapper_bcv> gr_ofdm_mapper_bcv_sptr;
00032 
00033 gr_ofdm_mapper_bcv_sptr 
00034 gr_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, 
00035                          unsigned occupied_carriers, unsigned int fft_length);
00036 
00037 /*!
00038  * \brief take a stream of bytes in and map to a vector of complex
00039  * constellation points suitable for IFFT input to be used in an ofdm
00040  * modulator.  Abstract class must be subclassed with specific mapping.
00041  * \ingroup modulation_blk
00042  * \ingroup ofdm_blk
00043  */
00044 
00045 class gr_ofdm_mapper_bcv : public gr_sync_block
00046 {
00047   friend gr_ofdm_mapper_bcv_sptr
00048   gr_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, 
00049                            unsigned occupied_carriers, unsigned int fft_length);
00050  protected:
00051   gr_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, 
00052                       unsigned occupied_carriers, unsigned int fft_length);
00053 
00054  private:
00055   std::vector<gr_complex> d_constellation;
00056   gr_msg_queue_sptr     d_msgq;
00057   gr_message_sptr       d_msg;
00058   unsigned              d_msg_offset;
00059   bool                  d_eof;
00060   
00061   unsigned int          d_occupied_carriers;
00062   unsigned int          d_fft_length;
00063   unsigned int          d_bit_offset;
00064   int                   d_pending_flag;
00065 
00066   unsigned long  d_nbits;
00067   unsigned char  d_msgbytes;
00068   
00069   unsigned char d_resid;
00070   unsigned int d_nresid;
00071 
00072   std::vector<int> d_subcarrier_map;
00073 
00074   int randsym();
00075 
00076  public:
00077   ~gr_ofdm_mapper_bcv(void);
00078 
00079   gr_msg_queue_sptr     msgq() const { return d_msgq; }
00080 
00081   int work(int noutput_items,
00082            gr_vector_const_void_star &input_items,
00083            gr_vector_void_star &output_items);
00084 
00085 };
00086 
00087 #endif