diff options
18 files changed, 1019 insertions, 104 deletions
diff --git a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt index 3364423863..429ca51fba 100644 --- a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt +++ b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt @@ -23,7 +23,6 @@ include(GrMiscUtils) GR_EXPAND_X_H(blocks abs_XX ss ii ff) GR_EXPAND_X_H(blocks add_XX ss ii cc) -GR_EXPAND_X_H(blocks add_const_XX bb ss ii ff cc) GR_EXPAND_X_H(blocks add_const_vXX bb ss ii ff cc) GR_EXPAND_X_H(blocks and_XX bb ss ii) GR_EXPAND_X_H(blocks and_const_XX bb ss ii) @@ -74,6 +73,11 @@ install(FILES unpack_k_bits.h wavfile.h add_ff.h + add_const_bb.h + add_const_ss.h + add_const_ii.h + add_const_ff.h + add_const_cc.h annotator_1to1.h annotator_alltoall.h annotator_raw.h diff --git a/gr-blocks/include/gnuradio/blocks/add_const_bb.h b/gr-blocks/include/gnuradio/blocks/add_const_bb.h new file mode 100644 index 0000000000..4e456f9532 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/add_const_bb.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012,2015 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 ADD_CONST_BB +#define ADD_CONST_BB + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input + constant + * \ingroup math_operators_blk + */ + class BLOCKS_API add_const_bb : virtual public sync_block + { + public: + + // gr::blocks::add_const_bb::sptr + typedef boost::shared_ptr<add_const_bb> sptr; + + /*! + * \brief Create an instance of add_const_bb + * \param k additive constant + */ + static sptr make(char k); + + /*! + * \brief Return additive constant + */ + virtual char k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(char k) = 0; + }; + + } +} + +#endif /* ADD_CONST_BB */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_cc.h b/gr-blocks/include/gnuradio/blocks/add_const_cc.h new file mode 100644 index 0000000000..35a15f72a8 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/add_const_cc.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012,2015 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 ADD_CONST_CC +#define ADD_CONST_CC + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input + constant + * \ingroup math_operators_blk + */ + class BLOCKS_API add_const_cc : virtual public sync_block + { + public: + + // gr::blocks::add_const_cc::sptr + typedef boost::shared_ptr<add_const_cc> sptr; + + /*! + * \brief Create an instance of add_const_cc + * \param k additive constant + */ + static sptr make(gr_complex k); + + /*! + * \brief Return additive constant + */ + virtual gr_complex k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(gr_complex k) = 0; + }; + + } +} + +#endif /* ADD_CONST_CC */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_ff.h b/gr-blocks/include/gnuradio/blocks/add_const_ff.h new file mode 100644 index 0000000000..66be094dab --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/add_const_ff.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012,2015 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 ADD_CONST_FF +#define ADD_CONST_FF + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input + constant + * \ingroup math_operators_blk + */ + class BLOCKS_API add_const_ff : virtual public sync_block + { + public: + + // gr::blocks::add_const_ff::sptr + typedef boost::shared_ptr<add_const_ff> sptr; + + /*! + * \brief Create an instance of add_const_ff + * \param k additive constant + */ + static sptr make(float k); + + /*! + * \brief Return additive constant + */ + virtual float k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(float k) = 0; + }; + + } +} + +#endif /* ADD_CONST_FF */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_XX.h.t b/gr-blocks/include/gnuradio/blocks/add_const_ii.h index 723fc78218..246902caf4 100644 --- a/gr-blocks/include/gnuradio/blocks/add_const_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/add_const_ii.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2012 Free Software Foundation, Inc. + * Copyright 2004,2012,2015 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,10 +20,8 @@ * Boston, MA 02110-1301, USA. */ -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ +#ifndef ADD_CONST_II +#define ADD_CONST_II #include <gnuradio/blocks/api.h> #include <gnuradio/sync_block.h> @@ -35,31 +33,31 @@ namespace gr { * \brief output = input + constant * \ingroup math_operators_blk */ - class BLOCKS_API @NAME@ : virtual public sync_block + class BLOCKS_API add_const_ii : virtual public sync_block { public: - // gr::blocks::@NAME@::sptr - typedef boost::shared_ptr<@NAME@> sptr; + // gr::blocks::add_const_ii::sptr + typedef boost::shared_ptr<add_const_ii> sptr; /*! - * \brief Create an instance of @NAME@ + * \brief Create an instance of add_const_ii * \param k additive constant */ - static sptr make(@O_TYPE@ k); + static sptr make(int k); /*! * \brief Return additive constant */ - virtual @O_TYPE@ k() const = 0; + virtual int k() const = 0; /*! * \brief Set additive constant */ - virtual void set_k(@O_TYPE@ k) = 0; + virtual void set_k(int k) = 0; }; } } -#endif /* @GUARD_NAME@ */ +#endif /* ADD_CONST_II */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_ss.h b/gr-blocks/include/gnuradio/blocks/add_const_ss.h new file mode 100644 index 0000000000..f9beee1b7b --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/add_const_ss.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012,2015 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 ADD_CONST_SS +#define ADD_CONST_SS + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input + constant + * \ingroup math_operators_blk + */ + class BLOCKS_API add_const_ss : virtual public sync_block + { + public: + + // gr::blocks::add_const_ss::sptr + typedef boost::shared_ptr<add_const_ss> sptr; + + /*! + * \brief Create an instance of add_const_ss + * \param k additive constant + */ + static sptr make(short k); + + /*! + * \brief Return additive constant + */ + virtual short k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(short k) = 0; + }; + + } +} + +#endif /* ADD_CONST_SS */ diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt index 6e1a3f2ed3..facff2212b 100644 --- a/gr-blocks/lib/CMakeLists.txt +++ b/gr-blocks/lib/CMakeLists.txt @@ -28,7 +28,6 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake) include(GrMiscUtils) GR_EXPAND_X_CC_H_IMPL(blocks abs_XX ss ii ff) GR_EXPAND_X_CC_H_IMPL(blocks add_XX ss ii cc) -GR_EXPAND_X_CC_H_IMPL(blocks add_const_XX bb ss ii ff cc) GR_EXPAND_X_CC_H_IMPL(blocks add_const_vXX bb ss ii ff cc) GR_EXPAND_X_CC_H_IMPL(blocks and_XX bb ss ii) GR_EXPAND_X_CC_H_IMPL(blocks and_const_XX bb ss ii) @@ -88,6 +87,11 @@ list(APPEND gr_blocks_sources unpack_k_bits.cc wavfile.cc add_ff_impl.cc + add_const_bb_impl.cc + add_const_ss_impl.cc + add_const_ii_impl.cc + add_const_ff_impl.cc + add_const_cc_impl.cc annotator_1to1_impl.cc annotator_alltoall_impl.cc annotator_raw_impl.cc diff --git a/gr-blocks/lib/add_const_XX_impl.cc.t b/gr-blocks/lib/add_const_XX_impl.cc.t deleted file mode 100644 index fe68216923..0000000000 --- a/gr-blocks/lib/add_const_XX_impl.cc.t +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2009,2010,2012 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@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME_IMPL@.h> -#include <gnuradio/io_signature.h> - -namespace gr { - namespace blocks { - - @NAME@::sptr @NAME@::make(@O_TYPE@ k) - { - return gnuradio::get_initial_sptr(new @NAME_IMPL@(k)); - } - - @NAME_IMPL@::@NAME_IMPL@(@O_TYPE@ k) - : sync_block ("@NAME@", - io_signature::make (1, 1, sizeof (@I_TYPE@)), - io_signature::make (1, 1, sizeof (@O_TYPE@))), - d_k(k) - { - } - - int - @NAME_IMPL@::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0]; - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - - int size = noutput_items; - - while (size >= 8){ - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - size -= 8; - } - - while (size-- > 0) - *optr++ = *iptr++ + d_k; - - return noutput_items; - } - - } /* namespace blocks */ -} /* namespace gr */ diff --git a/gr-blocks/lib/add_const_bb_impl.cc b/gr-blocks/lib/add_const_bb_impl.cc new file mode 100644 index 0000000000..e1c808245d --- /dev/null +++ b/gr-blocks/lib/add_const_bb_impl.cc @@ -0,0 +1,107 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2012,2015 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <add_const_bb_impl.h> +#include <gnuradio/io_signature.h> + +namespace gr { + namespace blocks { + + add_const_bb::sptr add_const_bb::make(char k) + { + return gnuradio::get_initial_sptr + (new add_const_bb_impl(k)); + } + + add_const_bb_impl::add_const_bb_impl(char k) + : sync_block("add_const_bb", + io_signature::make (1, 1, sizeof(char)), + io_signature::make (1, 1, sizeof(char))), + d_k(k) + { + } + + add_const_bb_impl::~add_const_bb_impl() + { + } + + int + add_const_bb_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const char *iptr = (const char *) input_items[0]; + char *optr = (char *) output_items[0]; + + int size = noutput_items; + + while(size >= 8) { + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + size -= 8; + } + + while(size-- > 0) { + *optr++ = *iptr++ + d_k; + } + + return noutput_items; + } + + void + add_const_bb_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<add_const_bb, char>( + alias(), "Constant", + &add_const_bb::k, + pmt::from_long(-128), + pmt::from_long(127), + pmt::from_long(0), + "", "Constant to add", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTCPLX | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<add_const_bb, char>( + alias(), "Constant", + &add_const_bb::set_k, + pmt::from_long(-128), + pmt::from_long(127), + pmt::from_long(0), + "", "Constant to add", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/add_const_bb_impl.h b/gr-blocks/lib/add_const_bb_impl.h new file mode 100644 index 0000000000..8bded0c19c --- /dev/null +++ b/gr-blocks/lib/add_const_bb_impl.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012,2015 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 ADD_CONST_BB_IMPL +#define ADD_CONST_BB_IMPL + +#include <gnuradio/blocks/add_const_bb.h> + +namespace gr { + namespace blocks { + + class BLOCKS_API add_const_bb_impl : public add_const_bb + { + private: + char d_k; + + public: + add_const_bb_impl(char k); + ~add_const_bb_impl(); + + void setup_rpc(); + + char k() const { return d_k; } + void set_k(char k) { d_k = k; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* ADD_CONST_BB_IMPL */ diff --git a/gr-blocks/lib/add_const_cc_impl.cc b/gr-blocks/lib/add_const_cc_impl.cc new file mode 100644 index 0000000000..61acb1c7a5 --- /dev/null +++ b/gr-blocks/lib/add_const_cc_impl.cc @@ -0,0 +1,103 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2012,2015 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <add_const_cc_impl.h> +#include <gnuradio/io_signature.h> + +namespace gr { + namespace blocks { + + add_const_cc::sptr add_const_cc::make(gr_complex k) + { + return gnuradio::get_initial_sptr + (new add_const_cc_impl(k)); + } + + add_const_cc_impl::add_const_cc_impl(gr_complex k) + : sync_block("add_const_cc", + io_signature::make (1, 1, sizeof(gr_complex)), + io_signature::make (1, 1, sizeof(gr_complex))), + d_k(k) + { + } + + int + add_const_cc_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const gr_complex *iptr = (const gr_complex *) input_items[0]; + gr_complex *optr = (gr_complex *) output_items[0]; + + int size = noutput_items; + + while(size >= 8) { + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + size -= 8; + } + + while(size-- > 0) { + *optr++ = *iptr++ + d_k; + } + + return noutput_items; + } + + void + add_const_cc_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<add_const_cc, gr_complex>( + alias(), "Constant", + &add_const_cc::k, + pmt::from_complex(-4.29e9, 0), + pmt::from_complex(4.29e9, 0), + pmt::from_complex(0, 0), + "", "Constant to add", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTCPLX | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<add_const_cc, gr_complex>( + alias(), "Constant", + &add_const_cc::set_k, + pmt::from_complex(-4.29e9, 0), + pmt::from_complex(4.29e9, 0), + pmt::from_complex(0, 0), + "", "Constant to add", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/add_const_cc_impl.h b/gr-blocks/lib/add_const_cc_impl.h new file mode 100644 index 0000000000..f1861da7b2 --- /dev/null +++ b/gr-blocks/lib/add_const_cc_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012,2015 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 ADD_CONST_CC_IMPL +#define ADD_CONST_CC_IMPL + +#include <gnuradio/blocks/add_const_cc.h> + +namespace gr { + namespace blocks { + + class BLOCKS_API add_const_cc_impl : public add_const_cc + { + private: + gr_complex d_k; + + public: + add_const_cc_impl(gr_complex k); + + void setup_rpc(); + + gr_complex k() const { return d_k; } + void set_k(gr_complex k) { d_k = k; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* ADD_CONST_CC_IMPL */ diff --git a/gr-blocks/lib/add_const_ff_impl.cc b/gr-blocks/lib/add_const_ff_impl.cc new file mode 100644 index 0000000000..b786a343c6 --- /dev/null +++ b/gr-blocks/lib/add_const_ff_impl.cc @@ -0,0 +1,103 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2012,2015 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <add_const_ff_impl.h> +#include <gnuradio/io_signature.h> + +namespace gr { + namespace blocks { + + add_const_ff::sptr add_const_ff::make(float k) + { + return gnuradio::get_initial_sptr + (new add_const_ff_impl(k)); + } + + add_const_ff_impl::add_const_ff_impl(float k) + : sync_block("add_const_ff", + io_signature::make (1, 1, sizeof(float)), + io_signature::make (1, 1, sizeof(float))), + d_k(k) + { + } + + int + add_const_ff_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *iptr = (const float *) input_items[0]; + float *optr = (float *) output_items[0]; + + int size = noutput_items; + + while(size >= 8) { + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + size -= 8; + } + + while(size-- > 0) { + *optr++ = *iptr++ + d_k; + } + + return noutput_items; + } + + void + add_const_ff_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<add_const_ff, float>( + alias(), "Constant", + &add_const_ff::k, + pmt::from_double(-4.29e9), + pmt::from_double(4.29e9), + pmt::from_double(0), + "", "Constant to add", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTCPLX | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<add_const_ff, float>( + alias(), "Constant", + &add_const_ff::set_k, + pmt::from_double(-4.29e9), + pmt::from_double(4.29e9), + pmt::from_double(0), + "", "Constant to add", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/add_const_ff_impl.h b/gr-blocks/lib/add_const_ff_impl.h new file mode 100644 index 0000000000..a3074b4b98 --- /dev/null +++ b/gr-blocks/lib/add_const_ff_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012,2015 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 ADD_CONST_FF_IMPL +#define ADD_CONST_FF_IMPL + +#include <gnuradio/blocks/add_const_ff.h> + +namespace gr { + namespace blocks { + + class BLOCKS_API add_const_ff_impl : public add_const_ff + { + private: + float d_k; + + public: + add_const_ff_impl(float k); + + void setup_rpc(); + + float k() const { return d_k; } + void set_k(float k) { d_k = k; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* ADD_CONST_FF_IMPL */ diff --git a/gr-blocks/lib/add_const_ii_impl.cc b/gr-blocks/lib/add_const_ii_impl.cc new file mode 100644 index 0000000000..1cd207780e --- /dev/null +++ b/gr-blocks/lib/add_const_ii_impl.cc @@ -0,0 +1,103 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2012,2015 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <add_const_ii_impl.h> +#include <gnuradio/io_signature.h> + +namespace gr { + namespace blocks { + + add_const_ii::sptr add_const_ii::make(int k) + { + return gnuradio::get_initial_sptr + (new add_const_ii_impl(k)); + } + + add_const_ii_impl::add_const_ii_impl(int k) + : sync_block("add_const_ii", + io_signature::make (1, 1, sizeof(int)), + io_signature::make (1, 1, sizeof(int))), + d_k(k) + { + } + + int + add_const_ii_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const int *iptr = (const int *) input_items[0]; + int *optr = (int *) output_items[0]; + + int size = noutput_items; + + while(size >= 8) { + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + size -= 8; + } + + while(size-- > 0) { + *optr++ = *iptr++ + d_k; + } + + return noutput_items; + } + + void + add_const_ii_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<add_const_ii, int>( + alias(), "Constant", + &add_const_ii::k, + pmt::from_long(-4.29e9), + pmt::from_long(4.29e9), + pmt::from_long(0), + "", "Constant to add", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTCPLX | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<add_const_ii, int>( + alias(), "Constant", + &add_const_ii::set_k, + pmt::from_long(-4.29e9), + pmt::from_long(4.29e9), + pmt::from_long(0), + "", "Constant to add", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/add_const_XX_impl.h.t b/gr-blocks/lib/add_const_ii_impl.h index e0c2ae54bc..8ddc3adb51 100644 --- a/gr-blocks/lib/add_const_XX_impl.h.t +++ b/gr-blocks/lib/add_const_ii_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2009,2012 Free Software Foundation, Inc. + * Copyright 2004,2009,2012,2015 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,25 +20,26 @@ * Boston, MA 02110-1301, USA. */ -// @WARNING@ +#ifndef ADD_CONST_II_IMPL +#define ADD_CONST_II_IMPL -#ifndef @GUARD_NAME_IMPL@ -#define @GUARD_NAME_IMPL@ - -#include <gnuradio/blocks/@NAME@.h> +#include <gnuradio/blocks/add_const_ii.h> namespace gr { namespace blocks { - class BLOCKS_API @NAME_IMPL@ : public @NAME@ + class BLOCKS_API add_const_ii_impl : public add_const_ii { - @O_TYPE@ d_k; + private: + int d_k; public: - @NAME_IMPL@(@O_TYPE@ k); + add_const_ii_impl(int k); + + void setup_rpc(); - @O_TYPE@ k() const { return d_k; } - void set_k(@O_TYPE@ k) { d_k = k; } + int k() const { return d_k; } + void set_k(int k) { d_k = k; } int work(int noutput_items, gr_vector_const_void_star &input_items, @@ -48,4 +49,4 @@ namespace gr { } /* namespace blocks */ } /* namespace gr */ -#endif /* @GUARD_NAME_IMPL@ */ +#endif /* ADD_CONST_II_IMPL */ diff --git a/gr-blocks/lib/add_const_ss_impl.cc b/gr-blocks/lib/add_const_ss_impl.cc new file mode 100644 index 0000000000..e23a2ef9a8 --- /dev/null +++ b/gr-blocks/lib/add_const_ss_impl.cc @@ -0,0 +1,107 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2012,2015 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <add_const_ss_impl.h> +#include <gnuradio/io_signature.h> + +namespace gr { + namespace blocks { + + add_const_ss::sptr add_const_ss::make(short k) + { + return gnuradio::get_initial_sptr + (new add_const_ss_impl(k)); + } + + add_const_ss_impl::add_const_ss_impl(short k) + : sync_block("add_const_ss", + io_signature::make (1, 1, sizeof(short)), + io_signature::make (1, 1, sizeof(short))), + d_k(k) + { + } + + add_const_ss_impl::~add_const_ss_impl() + { + } + + int + add_const_ss_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const short *iptr = (const short *) input_items[0]; + short *optr = (short *) output_items[0]; + + int size = noutput_items; + + while(size >= 8) { + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + size -= 8; + } + + while(size-- > 0) { + *optr++ = *iptr++ + d_k; + } + + return noutput_items; + } + + void + add_const_ss_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<add_const_ss, short>( + alias(), "Constant", + &add_const_ss::k, + pmt::from_long(-65536), + pmt::from_long(65535), + pmt::from_long(0), + "", "Constant to add", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTCPLX | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<add_const_ss, short>( + alias(), "Constant", + &add_const_ss::set_k, + pmt::from_long(-65536), + pmt::from_long(65535), + pmt::from_long(0), + "", "Constant to add", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/add_const_ss_impl.h b/gr-blocks/lib/add_const_ss_impl.h new file mode 100644 index 0000000000..40bcfb9b45 --- /dev/null +++ b/gr-blocks/lib/add_const_ss_impl.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012,2015 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 ADD_CONST_SS_IMPL +#define ADD_CONST_SS_IMPL + +#include <gnuradio/blocks/add_const_ss.h> + +namespace gr { + namespace blocks { + + class BLOCKS_API add_const_ss_impl : public add_const_ss + { + private: + short d_k; + + public: + add_const_ss_impl(short k); + ~add_const_ss_impl(); + + void setup_rpc(); + + short k() const { return d_k; } + void set_k(short k) { d_k = k; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* ADD_CONST_SS_IMPL */ |