diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-03-17 11:43:10 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-03-17 11:43:10 -0400 |
commit | ee2b700f72503d6e7f62adbfb7dff9997b9cb003 (patch) | |
tree | 2c7e91d03fb5c605c6deebac9077c1bc41bce13d /gr-blocks/include | |
parent | f15400470ce5cb68f5339ead7af726b8bbafd364 (diff) | |
parent | 65d88f0b28e233c82bc4f0c07072085a3d18c163 (diff) |
Merge branch 'master' into next
Conflicts:
gr-blocks/swig/blocks_swig.i
Diffstat (limited to 'gr-blocks/include')
-rw-r--r-- | gr-blocks/include/blocks/CMakeLists.txt | 15 | ||||
-rw-r--r-- | gr-blocks/include/blocks/annotator_1to1.h | 60 | ||||
-rw-r--r-- | gr-blocks/include/blocks/annotator_alltoall.h | 61 | ||||
-rw-r--r-- | gr-blocks/include/blocks/annotator_raw.h | 57 | ||||
-rw-r--r-- | gr-blocks/include/blocks/copy.h | 54 | ||||
-rw-r--r-- | gr-blocks/include/blocks/endian_swap.h | 50 | ||||
-rw-r--r-- | gr-blocks/include/blocks/head.h | 55 | ||||
-rw-r--r-- | gr-blocks/include/blocks/nop.h | 56 | ||||
-rw-r--r-- | gr-blocks/include/blocks/null_sink.h | 55 | ||||
-rw-r--r-- | gr-blocks/include/blocks/null_source.h | 53 | ||||
-rw-r--r-- | gr-blocks/include/blocks/rotator.h | 63 | ||||
-rw-r--r-- | gr-blocks/include/blocks/skiphead.h | 53 | ||||
-rw-r--r-- | gr-blocks/include/blocks/vector_insert_X.h.t | 54 | ||||
-rw-r--r-- | gr-blocks/include/blocks/vector_map.h | 71 | ||||
-rw-r--r-- | gr-blocks/include/blocks/vector_sink_X.h.t | 54 | ||||
-rw-r--r-- | gr-blocks/include/blocks/vector_source_X.h.t | 56 |
16 files changed, 867 insertions, 0 deletions
diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt index 0f158ff473..a922af6426 100644 --- a/gr-blocks/include/blocks/CMakeLists.txt +++ b/gr-blocks/include/blocks/CMakeLists.txt @@ -88,6 +88,9 @@ expand_h(sub_XX ss ii ff cc) expand_h(xor_XX bb ss ii) expand_h(packed_to_unpacked_XX bb ss ii) expand_h(unpacked_to_packed_XX bb ss ii) +expand_h(vector_insert_X b s i f c) +expand_h(vector_sink_X b s i f c) +expand_h(vector_source_X b s i f c) add_custom_target(blocks_generated_includes DEPENDS ${generated_includes} @@ -106,10 +109,14 @@ install(FILES fxpt_nco.h fxpt_vco.h log2_const.h + rotator.h nco.h vco.h wavfile.h add_ff.h + annotator_1to1.h + annotator_alltoall.h + annotator_raw.h bin_statistics_f.h burst_tagger.h char_to_float.h @@ -122,8 +129,10 @@ install(FILES complex_to_mag_squared.h complex_to_arg.h conjugate_cc.h + copy.h deinterleave.h delay.h + endian_swap.h file_source.h file_meta_sink.h file_meta_source.h @@ -132,6 +141,7 @@ install(FILES float_to_int.h float_to_short.h float_to_uchar.h + head.h int_to_float.h interleave.h interleaved_short_to_complex.h @@ -148,6 +158,9 @@ install(FILES multiply_const_cc.h multiply_const_ff.h nlog10_ff.h + nop.h + null_sink.h + null_source.h pack_k_bits_bb.h patterned_interleaver.h pdu.h @@ -162,6 +175,7 @@ install(FILES rms_ff.h short_to_char.h short_to_float.h + skiphead.h socket_pdu.h stream_mux.h stream_to_streams.h @@ -182,6 +196,7 @@ install(FILES udp_source.h unpack_k_bits_bb.h vco_f.h + vector_map.h vector_to_stream.h vector_to_streams.h wavfile_sink.h diff --git a/gr-blocks/include/blocks/annotator_1to1.h b/gr-blocks/include/blocks/annotator_1to1.h new file mode 100644 index 0000000000..6cc8db6eef --- /dev/null +++ b/gr-blocks/include/blocks/annotator_1to1.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_1TO1_H +#define INCLUDED_GR_ANNOTATOR_1TO1_H + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY. + * + * This block creates tags to be sent downstream every 10,000 + * items it sees. The tags contain the name and ID of the + * instantiated block, use "seq" as a key, and have a counter that + * increments by 1 for every tag produced that is used as the + * tag's value. The tags are propagated using the 1-to-1 policy. + * + * It also stores a copy of all tags it sees flow past it. These + * tags can be recalled externally with the data() member. + * + * This block is only meant for testing and showing how to use the tags. + */ + class BLOCKS_API annotator_1to1 : virtual public gr_sync_block + { + public: + // gr::blocks::annotator_1to1::sptr + typedef boost::shared_ptr<annotator_1to1> sptr; + + static sptr make(int when, size_t sizeof_stream_item); + + virtual std::vector<gr_tag_t> data() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ANNOTATOR_1TO1_H */ diff --git a/gr-blocks/include/blocks/annotator_alltoall.h b/gr-blocks/include/blocks/annotator_alltoall.h new file mode 100644 index 0000000000..558aea69ca --- /dev/null +++ b/gr-blocks/include/blocks/annotator_alltoall.h @@ -0,0 +1,61 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H +#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY. + * + * This block creates tags to be sent downstream every 10,000 + * items it sees. The tags contain the name and ID of the + * instantiated block, use "seq" as a key, and have a counter that + * increments by 1 for every tag produced that is used as the + * tag's value. The tags are propagated using the all-to-all + * policy. + * + * It also stores a copy of all tags it sees flow past it. These + * tags can be recalled externally with the data() member. + * + * This block is only meant for testing and showing how to use the tags. + */ + class BLOCKS_API annotator_alltoall : virtual public gr_sync_block + { + public: + // gr::blocks::annotator_alltoall::sptr + typedef boost::shared_ptr<annotator_alltoall> sptr; + + static sptr make(int when, size_t sizeof_stream_item); + + virtual std::vector<gr_tag_t> data() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ANNOTATOR_ALLTOALL_H */ diff --git a/gr-blocks/include/blocks/annotator_raw.h b/gr-blocks/include/blocks/annotator_raw.h new file mode 100644 index 0000000000..e835f0bd8d --- /dev/null +++ b/gr-blocks/include/blocks/annotator_raw.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_RAW_H +#define INCLUDED_GR_ANNOTATOR_RAW_H + +#include <blocks/api.h> +#include <gr_sync_block.h> +#include <gr_tags.h> + +namespace gr { + namespace blocks { + + /*! + * \brief raw stream annotator testing block. + * + * This block creates arbitrary tags to be sent downstream blocks + * to be sent are set manually via accessor methods and are sent + * only once. + * + * This block is intended for testing of tag related blocks + */ + class BLOCKS_API annotator_raw : virtual public gr_sync_block + { + public: + // gr::blocks::annotator_raw::sptr + typedef boost::shared_ptr<annotator_raw> sptr; + + static sptr make(size_t sizeof_stream_item); + + // insert a tag to be added + void add_tag(uint64_t offset, pmt::pmt_t key, pmt::pmt_t val); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ANNOTATOR_RAW_H */ diff --git a/gr-blocks/include/blocks/copy.h b/gr-blocks/include/blocks/copy.h new file mode 100644 index 0000000000..5ed0ea0e92 --- /dev/null +++ b/gr-blocks/include/blocks/copy.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2009,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_COPY_H +#define INCLUDED_GR_COPY_H + +#include <blocks/api.h> +#include <gr_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output[i] = input[i] + * \ingroup misc_blk + * + * When enabled (default), this block copies its input to its + * output. When disabled, this block drops its input on the floor. + */ + class BLOCKS_API copy : virtual public gr_block + { + public: + // gr::blocks::copy::sptr + typedef boost::shared_ptr<copy> sptr; + + static sptr make(size_t itemsize); + + virtual void set_enabled(bool enable) = 0; + virtual bool enabled() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_COPY_H */ diff --git a/gr-blocks/include/blocks/endian_swap.h b/gr-blocks/include/blocks/endian_swap.h new file mode 100644 index 0000000000..4b5a76218e --- /dev/null +++ b/gr-blocks/include/blocks/endian_swap.h @@ -0,0 +1,50 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ENDIAN_SWAP_H +#define INCLUDED_GR_ENDIAN_SWAP_H + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of items into thier byte swapped version + * + * \param item_size_bytes number of bytes per item, 1=no-op, + * 2=uint16_t, 4=uint32_t, 8=uint64_t + */ + class BLOCKS_API endian_swap : virtual public gr_sync_block + { + public: + // gr::blocks::endian_swap::sptr + typedef boost::shared_ptr<endian_swap> sptr; + + static sptr make(size_t item_size_bytes=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ENDIAN_SWAP_H */ diff --git a/gr-blocks/include/blocks/head.h b/gr-blocks/include/blocks/head.h new file mode 100644 index 0000000000..cc7d3808e5 --- /dev/null +++ b/gr-blocks/include/blocks/head.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_HEAD_H +#define INCLUDED_GR_HEAD_H + +#include <blocks/api.h> +#include <gr_sync_block.h> +#include <stddef.h> // size_t + +namespace gr { + namespace blocks { + + /*! + * \brief copies the first N items to the output then signals done + * \ingroup slicedice_blk + * + * Useful for building test cases + */ + class BLOCKS_API head : virtual public gr_sync_block + { + public: + // gr::blocks::head::sptr + typedef boost::shared_ptr<head> sptr; + + static sptr make(size_t sizeof_stream_item, + uint64_t nitems); + + virtual void reset() = 0; + virtual void set_length(int nitems) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_HEAD_H */ diff --git a/gr-blocks/include/blocks/nop.h b/gr-blocks/include/blocks/nop.h new file mode 100644 index 0000000000..b3135e1cc8 --- /dev/null +++ b/gr-blocks/include/blocks/nop.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_NOP_H +#define INCLUDED_GR_NOP_H + +#include <blocks/api.h> +#include <gr_block.h> +#include <stddef.h> // size_t + +namespace gr { + namespace blocks { + + /*! + * \brief Does nothing. Used for testing only. + * \ingroup misc_blk + */ + class BLOCKS_API nop : virtual public gr_block + { + public: + // gr::blocks::nop::sptr + typedef boost::shared_ptr<nop> sptr; + + /*! + * Build a nop block. + * + * \param sizeof_stream_item size of the stream items in bytes. + */ + static sptr make(size_t sizeof_stream_item); + + virtual int nmsgs_received() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_NOP_H */ diff --git a/gr-blocks/include/blocks/null_sink.h b/gr-blocks/include/blocks/null_sink.h new file mode 100644 index 0000000000..c13a7552c6 --- /dev/null +++ b/gr-blocks/include/blocks/null_sink.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_NULL_SINK_H +#define INCLUDED_GR_NULL_SINK_H + +#include <blocks/api.h> +#include <gr_sync_block.h> +#include <stddef.h> // size_t + +namespace gr { + namespace blocks { + + /*! + * \brief Bit bucket. Use as a termination point when a sink is + * required and we don't want to do anything real. + * \ingroup sink_blk + */ + class BLOCKS_API null_sink : virtual public gr_sync_block + { + public: + // gr::blocks::null_sink::sptr + typedef boost::shared_ptr<null_sink> sptr; + + /*! + * Build a null sink block. + * + * \param sizeof_stream_item size of the stream items in bytes. + */ + static sptr make(size_t sizeof_stream_item); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_NULL_SINK_H */ diff --git a/gr-blocks/include/blocks/null_source.h b/gr-blocks/include/blocks/null_source.h new file mode 100644 index 0000000000..904a0c1ba3 --- /dev/null +++ b/gr-blocks/include/blocks/null_source.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_NULL_SOURCE_H +#define INCLUDED_GR_NULL_SOURCE_H + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief A source of zeros used mainly for testing. + * \ingroup source_blk + */ + class BLOCKS_API null_source : virtual public gr_sync_block + { + public: + // gr::blocks::null_source::sptr + typedef boost::shared_ptr<null_source> sptr; + + /*! + * Build a null source block. + * + * \param sizeof_stream_item size of the stream items in bytes. + */ + static sptr make(size_t sizeof_stream_item); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_NULL_SOURCE_H */ diff --git a/gr-blocks/include/blocks/rotator.h b/gr-blocks/include/blocks/rotator.h new file mode 100644 index 0000000000..96ece63574 --- /dev/null +++ b/gr-blocks/include/blocks/rotator.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2008,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef _GR_ROTATOR_H_ +#define _GR_ROTATOR_H_ + +#include <blocks/api.h> +#include <gr_complex.h> + +namespace gr { + namespace blocks { + + class BLOCKS_API rotator + { + private: + gr_complex d_phase; + gr_complex d_phase_incr; + unsigned int d_counter; + + public: + rotator() : d_phase(1), d_phase_incr(1), d_counter(0) + { } + + void set_phase(gr_complex phase) { d_phase = phase / abs(phase); } + void set_phase_incr(gr_complex incr) { d_phase_incr = incr / abs(incr); } + + gr_complex rotate(gr_complex in) + { + d_counter++; + + gr_complex z = in * d_phase; // rotate in by phase + d_phase *= d_phase_incr; // incr our phase (complex mult == add phases) + + if((d_counter % 512) == 0) + d_phase /= abs(d_phase); // Normalize to ensure multiplication is rotation + + return z; + } + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* _GR_ROTATOR_H_ */ diff --git a/gr-blocks/include/blocks/skiphead.h b/gr-blocks/include/blocks/skiphead.h new file mode 100644 index 0000000000..e6745af8ea --- /dev/null +++ b/gr-blocks/include/blocks/skiphead.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_SKIPHEAD_H +#define INCLUDED_GR_SKIPHEAD_H + +#include <blocks/api.h> +#include <gr_sync_block.h> +#include <stddef.h> // size_t + +namespace gr { + namespace blocks { + + /*! + * \brief skips the first N items, from then on copies items to the output + * \ingroup slicedice_blk + * + * Useful for building test cases and sources which have metadata + * or junk at the start + */ + class BLOCKS_API skiphead : virtual public gr_block + { + public: + // gr::blocks::skiphead::sptr + typedef boost::shared_ptr<skiphead> sptr; + + static sptr make(size_t itemsize, + uint64_t nitems_to_skip); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_SKIPHEAD_H */ diff --git a/gr-blocks/include/blocks/vector_insert_X.h.t b/gr-blocks/include/blocks/vector_insert_X.h.t new file mode 100644 index 0000000000..aeb4a5248a --- /dev/null +++ b/gr-blocks/include/blocks/vector_insert_X.h.t @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <blocks/api.h> +#include <gr_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief source of @TYPE@'s that gets its data from a vector + * \ingroup source_blk + */ + class BLOCKS_API @NAME@ : virtual public gr_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(const std::vector<@TYPE@> &data, + int periodicity, int offset=0); + + virtual void rewind() = 0; + virtual void set_data(const std::vector<@TYPE@> &data) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/blocks/vector_map.h b/gr-blocks/include/blocks/vector_map.h new file mode 100644 index 0000000000..64c8744975 --- /dev/null +++ b/gr-blocks/include/blocks/vector_map.h @@ -0,0 +1,71 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_VECTOR_MAP_H +#define INCLUDED_GR_VECTOR_MAP_H + +#include <blocks/api.h> +#include <vector> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Maps elements from a set of input vectors to a set of output vectors. + * \ingroup slicedice_blk + * + * If in[i] is the input vector in the i'th stream then the output + * vector in the j'th stream is: + * + * out[j][k] = in[mapping[j][k][0]][mapping[j][k][1]] + * + * That is mapping is of the form (out_stream1_mapping, + * out_stream2_mapping, ...) and out_stream1_mapping is of the + * form (element1_mapping, element2_mapping, ...) and + * element1_mapping is of the form (in_stream, in_element). + */ + class BLOCKS_API vector_map : virtual public gr_sync_block + { + public: + // gr::blocks::vector_map::sptr + typedef boost::shared_ptr<vector_map> sptr; + + /*! + * Build a vector map block. + * + * \param item_size (integer) size of vector elements + * \param in_vlens (vector of integers) number of elements in each + * input vector + * \param mapping (vector of vectors of vectors of integers) how to + * map elements from input to output vectors + */ + static sptr make(size_t item_size, std::vector<size_t> in_vlens, + std::vector< std::vector< std::vector<size_t> > > mapping); + + virtual void set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_VECTOR_MAP_H */ diff --git a/gr-blocks/include/blocks/vector_sink_X.h.t b/gr-blocks/include/blocks/vector_sink_X.h.t new file mode 100644 index 0000000000..d15c795721 --- /dev/null +++ b/gr-blocks/include/blocks/vector_sink_X.h.t @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2008,2009,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief @TYPE@ sink that writes to a vector + * \ingroup sink_blk + */ + class BLOCKS_API @NAME@ : virtual public gr_sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(int vlen = 1); + + virtual void reset() = 0; + virtual std::vector<@TYPE@> data() const = 0; + virtual std::vector<gr_tag_t> tags() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/blocks/vector_source_X.h.t b/gr-blocks/include/blocks/vector_source_X.h.t new file mode 100644 index 0000000000..c68b638e62 --- /dev/null +++ b/gr-blocks/include/blocks/vector_source_X.h.t @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2008,2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief source of @TYPE@'s that gets its data from a vector + * \ingroup source_blk + */ + class BLOCKS_API @NAME@ : virtual public gr_sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(const std::vector<@TYPE@> &data, + bool repeat=false, int vlen=1, + const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>()); + + virtual void rewind() = 0; + virtual void set_data(const std::vector<@TYPE@> &data, + const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>()) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ |