3 * Copyright 2006 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
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)
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.
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.
29 #include <gr_endianness.h>
32 typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
35 gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
38 * \brief Convert a stream of unpacked bytes or shorts into a stream of packed bytes or shorts.
39 * \ingroup converter_blk
41 * input: stream of @I_TYPE@; output: stream of @O_TYPE@
43 * This is the inverse of gr_packed_to_unpacked_XX.
45 * The low \p bits_per_chunk bits are extracted from each input byte or short.
46 * These bits are then packed densely into the output bytes or shorts, such that
47 * all 8 or 16 bits of the output bytes or shorts are filled with valid input bits.
48 * The right thing is done if bits_per_chunk is not a power of two.
50 * The combination of gr_packed_to_unpacked_XX followed by
51 * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the
52 * general case of mapping from a stream of bytes or shorts into arbitrary float
55 * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb,
56 * \sa gr_packed_to_unpacked_ss, gr_unpacked_to_packed_ss,
57 * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc.
58 * \sa gr_chunks_to_symbols_sf, gr_chunks_to_symbols_sc.
60 class @NAME@ : public gr_block
63 gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
65 @NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
67 unsigned int d_bits_per_chunk;
68 gr_endianness_t d_endianness;
72 void forecast(int noutput_items, gr_vector_int &ninput_items_required);
73 int general_work (int noutput_items,
74 gr_vector_int &ninput_items,
75 gr_vector_const_void_star &input_items,
76 gr_vector_void_star &output_items);
78 bool check_topology(int ninputs, int noutputs) { return ninputs == noutputs; }