diff options
author | Marcus Müller <mmueller@gnuradio.org> | 2019-08-07 21:45:12 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2019-08-09 23:04:28 +0200 |
commit | f7bbf2c1d8d780294f3e016aff239ca35eb6516e (patch) | |
tree | e09ab6112e02b2215b2d59ac24d3d6ea2edac745 /gr-blocks/include/gnuradio/blocks | |
parent | 78431dc6941e3acc67c858277dfe4a0ed583643c (diff) |
Tree: clang-format without the include sorting
Diffstat (limited to 'gr-blocks/include/gnuradio/blocks')
158 files changed, 4770 insertions, 4765 deletions
diff --git a/gr-blocks/include/gnuradio/blocks/abs_blk.h b/gr-blocks/include/gnuradio/blocks/abs_blk.h index 83e3307e50..231b380a25 100644 --- a/gr-blocks/include/gnuradio/blocks/abs_blk.h +++ b/gr-blocks/include/gnuradio/blocks/abs_blk.h @@ -29,34 +29,33 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief output[m] = abs(input[m]) for all M streams. - * \ingroup boolean_operators_blk - * - * \details - * absolute value of data stream (Strip sign) - */ -template<class T> - class BLOCKS_API abs_blk : virtual public sync_block - { - - public: +/*! + * \brief output[m] = abs(input[m]) for all M streams. + * \ingroup boolean_operators_blk + * + * \details + * absolute value of data stream (Strip sign) + */ +template <class T> +class BLOCKS_API abs_blk : virtual public sync_block +{ - // gr::blocks::abs_blk::sptr - typedef boost::shared_ptr< abs_blk<T> > sptr; +public: + // gr::blocks::abs_blk::sptr + typedef boost::shared_ptr<abs_blk<T>> sptr; - /*! - * \brief Create an instance of abs_blk - */ - static sptr make(size_t vlen=1); - }; + /*! + * \brief Create an instance of abs_blk + */ + static sptr make(size_t vlen = 1); +}; typedef abs_blk<std::int16_t> abs_ss; typedef abs_blk<std::int32_t> abs_ii; typedef abs_blk<float> abs_ff; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* ABS_BLK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/add_blk.h b/gr-blocks/include/gnuradio/blocks/add_blk.h index 40408f7836..4025170a43 100644 --- a/gr-blocks/include/gnuradio/blocks/add_blk.h +++ b/gr-blocks/include/gnuradio/blocks/add_blk.h @@ -29,36 +29,35 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief output = sum(input[0], input[1], ..., input[M-1]) - * \ingroup math_operators_blk - * - * \details - * Add samples across all input streams. For all \f$n\f$ samples - * on all \f$M\f$ input streams \f$x_m\f$: - * - * \f[ - * y[n] = \sum_{m=0}^{M-1} x_m[n] - * \f] - */ -template<class T> - class BLOCKS_API add_blk : virtual public sync_block - { - public: - - // gr::blocks::add_blk::sptr - typedef boost::shared_ptr< add_blk<T> > sptr; +/*! + * \brief output = sum(input[0], input[1], ..., input[M-1]) + * \ingroup math_operators_blk + * + * \details + * Add samples across all input streams. For all \f$n\f$ samples + * on all \f$M\f$ input streams \f$x_m\f$: + * + * \f[ + * y[n] = \sum_{m=0}^{M-1} x_m[n] + * \f] + */ +template <class T> +class BLOCKS_API add_blk : virtual public sync_block +{ +public: + // gr::blocks::add_blk::sptr + typedef boost::shared_ptr<add_blk<T>> sptr; - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; typedef add_blk<std::int16_t> add_ss; typedef add_blk<std::int32_t> add_ii; typedef add_blk<gr_complex> add_cc; typedef add_blk<float> add_ff; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* ADD_BLK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_bb.h b/gr-blocks/include/gnuradio/blocks/add_const_bb.h index 6d4875d75a..06d14649dd 100644 --- a/gr-blocks/include/gnuradio/blocks/add_const_bb.h +++ b/gr-blocks/include/gnuradio/blocks/add_const_bb.h @@ -27,37 +27,36 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +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(unsigned char k); /*! - * \brief output = input + constant - * \ingroup math_operators_blk + * \brief Return additive constant */ - 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(unsigned char k); - - /*! - * \brief Return additive constant - */ - virtual unsigned char k() const = 0; - - /*! - * \brief Set additive constant - */ - virtual void set_k(unsigned char k) = 0; - }; - - } -} + virtual unsigned char k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(unsigned char k) = 0; +}; + +} // namespace blocks +} // namespace gr #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 index 35a15f72a8..810f04133e 100644 --- a/gr-blocks/include/gnuradio/blocks/add_const_cc.h +++ b/gr-blocks/include/gnuradio/blocks/add_const_cc.h @@ -27,37 +27,36 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +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 output = input + constant - * \ingroup math_operators_blk + * \brief Return additive constant */ - 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; - }; - - } -} + virtual gr_complex k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(gr_complex k) = 0; +}; + +} // namespace blocks +} // namespace gr #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 index 66be094dab..66fb9e5d07 100644 --- a/gr-blocks/include/gnuradio/blocks/add_const_ff.h +++ b/gr-blocks/include/gnuradio/blocks/add_const_ff.h @@ -27,37 +27,36 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +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 output = input + constant - * \ingroup math_operators_blk + * \brief Return additive constant */ - 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; - }; - - } -} + virtual float k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(float k) = 0; +}; + +} // namespace blocks +} // namespace gr #endif /* ADD_CONST_FF */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_ii.h b/gr-blocks/include/gnuradio/blocks/add_const_ii.h index 246902caf4..341d44d0bb 100644 --- a/gr-blocks/include/gnuradio/blocks/add_const_ii.h +++ b/gr-blocks/include/gnuradio/blocks/add_const_ii.h @@ -27,37 +27,36 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief output = input + constant + * \ingroup math_operators_blk + */ +class BLOCKS_API add_const_ii : virtual public sync_block +{ +public: + // gr::blocks::add_const_ii::sptr + typedef boost::shared_ptr<add_const_ii> sptr; + + /*! + * \brief Create an instance of add_const_ii + * \param k additive constant + */ + static sptr make(int k); /*! - * \brief output = input + constant - * \ingroup math_operators_blk + * \brief Return additive constant */ - class BLOCKS_API add_const_ii : virtual public sync_block - { - public: - - // gr::blocks::add_const_ii::sptr - typedef boost::shared_ptr<add_const_ii> sptr; - - /*! - * \brief Create an instance of add_const_ii - * \param k additive constant - */ - static sptr make(int k); - - /*! - * \brief Return additive constant - */ - virtual int k() const = 0; - - /*! - * \brief Set additive constant - */ - virtual void set_k(int k) = 0; - }; - - } -} + virtual int k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(int k) = 0; +}; + +} // namespace blocks +} // namespace gr #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 index f9beee1b7b..cfb4c353ab 100644 --- a/gr-blocks/include/gnuradio/blocks/add_const_ss.h +++ b/gr-blocks/include/gnuradio/blocks/add_const_ss.h @@ -27,37 +27,36 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +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 output = input + constant - * \ingroup math_operators_blk + * \brief Return additive constant */ - 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; - }; - - } -} + virtual short k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(short k) = 0; +}; + +} // namespace blocks +} // namespace gr #endif /* ADD_CONST_SS */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_v.h b/gr-blocks/include/gnuradio/blocks/add_const_v.h index f33393c668..3ed66bff2e 100644 --- a/gr-blocks/include/gnuradio/blocks/add_const_v.h +++ b/gr-blocks/include/gnuradio/blocks/add_const_v.h @@ -28,44 +28,43 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief output[m] = input[m] + constant vector for all M streams. - * \ingroup math_operators_blk - */ - template <class T> - class BLOCKS_API add_const_v : virtual public sync_block - { - - public: +/*! + * \brief output[m] = input[m] + constant vector for all M streams. + * \ingroup math_operators_blk + */ +template <class T> +class BLOCKS_API add_const_v : virtual public sync_block +{ - typedef boost::shared_ptr<add_const_v <T> > sptr; +public: + typedef boost::shared_ptr<add_const_v<T>> sptr; - /*! - * \brief Create an instance of add_const_v - * \param k additive constant vector - */ - static sptr make(std::vector<T> k); + /*! + * \brief Create an instance of add_const_v + * \param k additive constant vector + */ + static sptr make(std::vector<T> k); - /*! - * \brief Return additive constant vector - */ - virtual std::vector<T> k() const = 0; + /*! + * \brief Return additive constant vector + */ + virtual std::vector<T> k() const = 0; - /*! - * \brief Set additive constant vector - */ - virtual void set_k(std::vector<T> k) = 0; - }; + /*! + * \brief Set additive constant vector + */ + virtual void set_k(std::vector<T> k) = 0; +}; - typedef add_const_v<std::uint8_t> add_const_vbb; - typedef add_const_v<std::int16_t> add_const_vss; - typedef add_const_v<std::int32_t> add_const_vii; - typedef add_const_v<float> add_const_vff; - typedef add_const_v<gr_complex> add_const_vcc; +typedef add_const_v<std::uint8_t> add_const_vbb; +typedef add_const_v<std::int16_t> add_const_vss; +typedef add_const_v<std::int32_t> add_const_vii; +typedef add_const_v<float> add_const_vff; +typedef add_const_v<gr_complex> add_const_vcc; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* ADD_CONST_V_H */ diff --git a/gr-blocks/include/gnuradio/blocks/and_blk.h b/gr-blocks/include/gnuradio/blocks/and_blk.h index d24781b0f4..bdfa82a5dd 100644 --- a/gr-blocks/include/gnuradio/blocks/and_blk.h +++ b/gr-blocks/include/gnuradio/blocks/and_blk.h @@ -29,30 +29,29 @@ #include <cstdint> namespace gr { - namespace blocks { - - /*! - * \brief output = input[0] & input[1] & ... & input[M-1] - * \ingroup boolean_operators_blk - * - * \details - * bitwise boolean AND across all input streams. - */ -template<class T> - class BLOCKS_API and_blk : virtual public sync_block - { - public: - - // gr::blocks::and_blk::sptr - typedef boost::shared_ptr< and_blk<T> > sptr; - - static sptr make(size_t vlen=1); - }; +namespace blocks { + +/*! + * \brief output = input[0] & input[1] & ... & input[M-1] + * \ingroup boolean_operators_blk + * + * \details + * bitwise boolean AND across all input streams. + */ +template <class T> +class BLOCKS_API and_blk : virtual public sync_block +{ +public: + // gr::blocks::and_blk::sptr + typedef boost::shared_ptr<and_blk<T>> sptr; + + static sptr make(size_t vlen = 1); +}; typedef and_blk<std::uint8_t> and_bb; typedef and_blk<std::int16_t> and_ss; typedef and_blk<std::int32_t> and_ii; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* AND_BLK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/and_const.h b/gr-blocks/include/gnuradio/blocks/and_const.h index dbc664d170..f86e594f68 100644 --- a/gr-blocks/include/gnuradio/blocks/and_const.h +++ b/gr-blocks/include/gnuradio/blocks/and_const.h @@ -29,45 +29,44 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief output[m] = input[m] & value for all M streams. - * \ingroup boolean_operators_blk - * - * \details - * Bitwise boolean AND of constant \p k with the data stream. - */ -template<class T> - class BLOCKS_API and_const : virtual public sync_block - { - - public: +/*! + * \brief output[m] = input[m] & value for all M streams. + * \ingroup boolean_operators_blk + * + * \details + * Bitwise boolean AND of constant \p k with the data stream. + */ +template <class T> +class BLOCKS_API and_const : virtual public sync_block +{ - // gr::blocks::and_const::sptr - typedef boost::shared_ptr< and_const<T> > sptr; +public: + // gr::blocks::and_const::sptr + typedef boost::shared_ptr<and_const<T>> sptr; - /*! - * \brief Create an instance of and_const - * \param k AND constant - */ - static sptr make(T k); + /*! + * \brief Create an instance of and_const + * \param k AND constant + */ + static sptr make(T k); - /*! - * \brief Return AND constant - */ - virtual T k() const = 0; + /*! + * \brief Return AND constant + */ + virtual T k() const = 0; - /*! - * \brief Set AND constant - */ - virtual void set_k(T k) = 0; - }; + /*! + * \brief Set AND constant + */ + virtual void set_k(T k) = 0; +}; typedef and_const<std::uint8_t> and_const_bb; typedef and_const<std::int16_t> and_const_ss; typedef and_const<std::int32_t> and_const_ii; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* AND_CONST_H */ diff --git a/gr-blocks/include/gnuradio/blocks/annotator_1to1.h b/gr-blocks/include/gnuradio/blocks/annotator_1to1.h index 4ae23b1201..60bb4d6875 100644 --- a/gr-blocks/include/gnuradio/blocks/annotator_1to1.h +++ b/gr-blocks/include/gnuradio/blocks/annotator_1to1.h @@ -21,43 +21,43 @@ */ #ifndef INCLUDED_GR_ANNOTATOR_1TO1_H -#define INCLUDED_GR_ANNOTATOR_1TO1_H +#define INCLUDED_GR_ANNOTATOR_1TO1_H #include <gnuradio/blocks/api.h> #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { - - /*! - * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY. - * \ingroup debug_tools_blk - * - * \details - * 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. - * - * Warning: This block is only meant for testing and showing how to use the - * tags. - */ - class BLOCKS_API annotator_1to1 : virtual public 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<tag_t> data() const = 0; - }; - - } /* namespace blocks */ +namespace blocks { + +/*! + * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY. + * \ingroup debug_tools_blk + * + * \details + * 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. + * + * Warning: This block is only meant for testing and showing how to use the + * tags. + */ +class BLOCKS_API annotator_1to1 : virtual public 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<tag_t> data() const = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_ANNOTATOR_1TO1_H */ diff --git a/gr-blocks/include/gnuradio/blocks/annotator_alltoall.h b/gr-blocks/include/gnuradio/blocks/annotator_alltoall.h index 499c5f36b6..e13d32fde8 100644 --- a/gr-blocks/include/gnuradio/blocks/annotator_alltoall.h +++ b/gr-blocks/include/gnuradio/blocks/annotator_alltoall.h @@ -21,43 +21,43 @@ */ #ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H -#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H +#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H #include <gnuradio/blocks/api.h> #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { - - /*! - * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY. - * \ingroup debug_tools_blk - * - * \details - * 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 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<tag_t> data() const = 0; - }; - - } /* namespace blocks */ +namespace blocks { + +/*! + * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY. + * \ingroup debug_tools_blk + * + * \details + * 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 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<tag_t> data() const = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_ANNOTATOR_ALLTOALL_H */ diff --git a/gr-blocks/include/gnuradio/blocks/annotator_raw.h b/gr-blocks/include/gnuradio/blocks/annotator_raw.h index 5e9c702602..4d0f7a64af 100644 --- a/gr-blocks/include/gnuradio/blocks/annotator_raw.h +++ b/gr-blocks/include/gnuradio/blocks/annotator_raw.h @@ -21,39 +21,39 @@ */ #ifndef INCLUDED_GR_ANNOTATOR_RAW_H -#define INCLUDED_GR_ANNOTATOR_RAW_H +#define INCLUDED_GR_ANNOTATOR_RAW_H #include <gnuradio/blocks/api.h> #include <gnuradio/sync_block.h> #include <gnuradio/tags.h> namespace gr { - namespace blocks { - - /*! - * \brief raw stream annotator testing block. - * \ingroup debug_tools_blk - * - * \details - * This block creates arbitrary tags to be sent downstream gnuradio/blocks - * to be sent are set manually via accessor methods and are sent - * only once. - * - * This block is intended for testing of tag related gnuradio/blocks - */ - class BLOCKS_API annotator_raw : virtual public 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 - virtual void add_tag(uint64_t offset, pmt::pmt_t key, pmt::pmt_t val) = 0; - }; - - } /* namespace blocks */ +namespace blocks { + +/*! + * \brief raw stream annotator testing block. + * \ingroup debug_tools_blk + * + * \details + * This block creates arbitrary tags to be sent downstream gnuradio/blocks + * to be sent are set manually via accessor methods and are sent + * only once. + * + * This block is intended for testing of tag related gnuradio/blocks + */ +class BLOCKS_API annotator_raw : virtual public 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 + virtual void add_tag(uint64_t offset, pmt::pmt_t key, pmt::pmt_t val) = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_ANNOTATOR_RAW_H */ diff --git a/gr-blocks/include/gnuradio/blocks/api.h b/gr-blocks/include/gnuradio/blocks/api.h index fd4e605b56..a16a2c7a6a 100644 --- a/gr-blocks/include/gnuradio/blocks/api.h +++ b/gr-blocks/include/gnuradio/blocks/api.h @@ -25,9 +25,9 @@ #include <gnuradio/attributes.h> #ifdef gnuradio_blocks_EXPORTS -# define BLOCKS_API __GR_ATTR_EXPORT +#define BLOCKS_API __GR_ATTR_EXPORT #else -# define BLOCKS_API __GR_ATTR_IMPORT +#define BLOCKS_API __GR_ATTR_IMPORT #endif #endif /* INCLUDED_BLOCKS_API_H */ diff --git a/gr-blocks/include/gnuradio/blocks/argmax.h b/gr-blocks/include/gnuradio/blocks/argmax.h index fe4d750e7b..5661e83599 100644 --- a/gr-blocks/include/gnuradio/blocks/argmax.h +++ b/gr-blocks/include/gnuradio/blocks/argmax.h @@ -28,38 +28,38 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Compares vectors from multiple streams and determines - * the index in the vector and stream number where the maximum - * value occurred. - * \ingroup math_operators_blk - * - * \details - * Data is passed in as a vector of length \p vlen from multiple - * input sources. It will look through these streams of \p vlen - * data items and output two streams: - * - * \li Stream 0 will contain the index value in the vector where - * the maximum value occurred. - * - * \li Stream 1 will contain the number of the input stream that - * held the maximum value. - */ - template <class T> - class BLOCKS_API argmax : virtual public sync_block - { - public: - typedef boost::shared_ptr< argmax<T> > sptr; +/*! + * \brief Compares vectors from multiple streams and determines + * the index in the vector and stream number where the maximum + * value occurred. + * \ingroup math_operators_blk + * + * \details + * Data is passed in as a vector of length \p vlen from multiple + * input sources. It will look through these streams of \p vlen + * data items and output two streams: + * + * \li Stream 0 will contain the index value in the vector where + * the maximum value occurred. + * + * \li Stream 1 will contain the number of the input stream that + * held the maximum value. + */ +template <class T> +class BLOCKS_API argmax : virtual public sync_block +{ +public: + typedef boost::shared_ptr<argmax<T>> sptr; - static sptr make(size_t vlen); - }; + static sptr make(size_t vlen); +}; - typedef argmax<float> argmax_fs; - typedef argmax<std::int32_t> argmax_is; - typedef argmax<std::int16_t> argmax_ss; - } /* namespace blocks */ +typedef argmax<float> argmax_fs; +typedef argmax<std::int32_t> argmax_is; +typedef argmax<std::int16_t> argmax_ss; +} /* namespace blocks */ } /* namespace gr */ #endif /* ARGMAX_H */ diff --git a/gr-blocks/include/gnuradio/blocks/bin_statistics_f.h b/gr-blocks/include/gnuradio/blocks/bin_statistics_f.h index 5bd6022568..2330af5cef 100644 --- a/gr-blocks/include/gnuradio/blocks/bin_statistics_f.h +++ b/gr-blocks/include/gnuradio/blocks/bin_statistics_f.h @@ -29,48 +29,48 @@ #include <gnuradio/feval.h> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief control scanning and record frequency domain statistics - * \ingroup misc_blk - */ - class BLOCKS_API bin_statistics_f : virtual public sync_block - { - protected: - std::vector<float> d_max; // per bin maxima +/*! + * \brief control scanning and record frequency domain statistics + * \ingroup misc_blk + */ +class BLOCKS_API bin_statistics_f : virtual public sync_block +{ +protected: + std::vector<float> d_max; // per bin maxima - virtual size_t vlen() const = 0; - virtual double center_freq() const = 0; - virtual gr::msg_queue::sptr msgq() const = 0; + virtual size_t vlen() const = 0; + virtual double center_freq() const = 0; + virtual gr::msg_queue::sptr msgq() const = 0; - virtual void reset_stats() = 0; - virtual void accrue_stats(const float *input) = 0; - virtual void send_stats() = 0; + virtual void reset_stats() = 0; + virtual void accrue_stats(const float* input) = 0; + virtual void send_stats() = 0; - public: - // gr::blocks::bin_statistics_f::sptr - typedef boost::shared_ptr<bin_statistics_f> sptr; +public: + // gr::blocks::bin_statistics_f::sptr + typedef boost::shared_ptr<bin_statistics_f> sptr; - /*! - * Build a bin statistics block. See qa_bin_statistics.py and - * gr-uhd/examples/python/usrp_spectrum_sense.py for examples of - * its use, specifically how to use the callback function. - * - * \param vlen vector length - * \param msgq message queue - * \param tune a feval_dd callback function - * \param tune_delay number of samples for the tune delay - * \param dwell_delay number of samples for the dwell delay - */ - static sptr make(unsigned int vlen, // vector length - gr::msg_queue::sptr msgq, - feval_dd *tune, // callback - size_t tune_delay, // samples - size_t dwell_delay); // samples - }; + /*! + * Build a bin statistics block. See qa_bin_statistics.py and + * gr-uhd/examples/python/usrp_spectrum_sense.py for examples of + * its use, specifically how to use the callback function. + * + * \param vlen vector length + * \param msgq message queue + * \param tune a feval_dd callback function + * \param tune_delay number of samples for the tune delay + * \param dwell_delay number of samples for the dwell delay + */ + static sptr make(unsigned int vlen, // vector length + gr::msg_queue::sptr msgq, + feval_dd* tune, // callback + size_t tune_delay, // samples + size_t dwell_delay); // samples +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_BIN_STATISTICS_F_H */ diff --git a/gr-blocks/include/gnuradio/blocks/burst_tagger.h b/gr-blocks/include/gnuradio/blocks/burst_tagger.h index c5c1dc3eac..7956c7a20d 100644 --- a/gr-blocks/include/gnuradio/blocks/burst_tagger.h +++ b/gr-blocks/include/gnuradio/blocks/burst_tagger.h @@ -27,50 +27,50 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Sets a burst on/off tag based on the value of the trigger input. + * \ingroup peak_detectors_blk + * \ingroup stream_tag_tools_blk + * + * \details + * This block takes two inputs, a signal stream on the input + * stream 0 and a trigger stream of shorts on input stream 1. If + * the trigger stream goes above 0, a tag with the key "burst" + * will be transmitted as a pmt::PMT_T. When the trigger signal + * falls below 0, the "burst" tag will be transmitted as + * pmt::PMT_F. + * + * The signal on stream 0 is retransmitted to output stream 0. + */ +class BLOCKS_API burst_tagger : virtual public sync_block +{ +public: + // gr::blocks::burst_tagger::sptr + typedef boost::shared_ptr<burst_tagger> sptr; /*! - * \brief Sets a burst on/off tag based on the value of the trigger input. - * \ingroup peak_detectors_blk - * \ingroup stream_tag_tools_blk - * - * \details - * This block takes two inputs, a signal stream on the input - * stream 0 and a trigger stream of shorts on input stream 1. If - * the trigger stream goes above 0, a tag with the key "burst" - * will be transmitted as a pmt::PMT_T. When the trigger signal - * falls below 0, the "burst" tag will be transmitted as - * pmt::PMT_F. + * Build a burst tagger gnuradio/blocks. * - * The signal on stream 0 is retransmitted to output stream 0. + * \param itemsize itemsize of the signal stream on input 0. */ - class BLOCKS_API burst_tagger : virtual public sync_block - { - public: - // gr::blocks::burst_tagger::sptr - typedef boost::shared_ptr<burst_tagger> sptr; + static sptr make(size_t itemsize); - /*! - * Build a burst tagger gnuradio/blocks. - * - * \param itemsize itemsize of the signal stream on input 0. - */ - static sptr make(size_t itemsize); - - /*! - * For the true burst tag, change the key name to \p key and a - * new value of \p value. - */ - virtual void set_true_tag(const std::string &key, bool value) = 0; + /*! + * For the true burst tag, change the key name to \p key and a + * new value of \p value. + */ + virtual void set_true_tag(const std::string& key, bool value) = 0; - /*! - * For the false burst tag, change the key name to \p key and a - * new value of \p value. - */ - virtual void set_false_tag(const std::string &key, bool value) = 0; - }; + /*! + * For the false burst tag, change the key name to \p key and a + * new value of \p value. + */ + virtual void set_false_tag(const std::string& key, bool value) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_BURST_TAGGER_H */ diff --git a/gr-blocks/include/gnuradio/blocks/char_to_float.h b/gr-blocks/include/gnuradio/blocks/char_to_float.h index 1fce660427..0dfeb26d88 100644 --- a/gr-blocks/include/gnuradio/blocks/char_to_float.h +++ b/gr-blocks/include/gnuradio/blocks/char_to_float.h @@ -27,45 +27,44 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of chars to a stream of float. + * \ingroup type_converters_blk + * + * \details + * Converts \p vlen length vectors of input char samples to floats + * and applies a scaling factor of \p scale: + * + * \li output[0][m:m+vlen] = static_cast<float>(input[0][m:m+vlen]) / scale + */ +class BLOCKS_API char_to_float : virtual public sync_block +{ +public: + // gr::blocks::char_to_float_ff::sptr + typedef boost::shared_ptr<char_to_float> sptr; /*! - * \brief Convert stream of chars to a stream of float. - * \ingroup type_converters_blk - * - * \details - * Converts \p vlen length vectors of input char samples to floats - * and applies a scaling factor of \p scale: + * Build a chars to float stream converter block. * - * \li output[0][m:m+vlen] = static_cast<float>(input[0][m:m+vlen]) / scale + * \param vlen vector length of data streams. + * \param scale a scalar divider to change the output signal scale. */ - class BLOCKS_API char_to_float : virtual public sync_block - { - public: - - // gr::blocks::char_to_float_ff::sptr - typedef boost::shared_ptr<char_to_float> sptr; + static sptr make(size_t vlen = 1, float scale = 1.0); - /*! - * Build a chars to float stream converter block. - * - * \param vlen vector length of data streams. - * \param scale a scalar divider to change the output signal scale. - */ - static sptr make(size_t vlen=1, float scale=1.0); - - /*! - * Get the scalar divider value. - */ - virtual float scale() const = 0; + /*! + * Get the scalar divider value. + */ + virtual float scale() const = 0; - /*! - * Set the scalar divider value. - */ - virtual void set_scale(float scale) = 0; - }; + /*! + * Set the scalar divider value. + */ + virtual void set_scale(float scale) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_CHAR_TO_FLOAT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/char_to_short.h b/gr-blocks/include/gnuradio/blocks/char_to_short.h index aa45810eee..69109c7f57 100644 --- a/gr-blocks/include/gnuradio/blocks/char_to_short.h +++ b/gr-blocks/include/gnuradio/blocks/char_to_short.h @@ -27,29 +27,28 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Convert stream of chars to a stream of shorts. - * \ingroup type_converters_blk - * - * \details - * Converts \p vlen length vectors of input char samples to shorts, - * multiplying each element by 256: - * - * \li output[0][m:m+vlen] = 256 * static_cast<short>(input[0][m:m+vlen]) - */ - class BLOCKS_API char_to_short : virtual public sync_block - { - public: - - // gr::blocks::char_to_short_ff::sptr - typedef boost::shared_ptr<char_to_short> sptr; +/*! + * \brief Convert stream of chars to a stream of shorts. + * \ingroup type_converters_blk + * + * \details + * Converts \p vlen length vectors of input char samples to shorts, + * multiplying each element by 256: + * + * \li output[0][m:m+vlen] = 256 * static_cast<short>(input[0][m:m+vlen]) + */ +class BLOCKS_API char_to_short : virtual public sync_block +{ +public: + // gr::blocks::char_to_short_ff::sptr + typedef boost::shared_ptr<char_to_short> sptr; - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_CHAR_TO_SHORT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/check_lfsr_32k_s.h b/gr-blocks/include/gnuradio/blocks/check_lfsr_32k_s.h index 379155bcb4..33ce9f91d5 100644 --- a/gr-blocks/include/gnuradio/blocks/check_lfsr_32k_s.h +++ b/gr-blocks/include/gnuradio/blocks/check_lfsr_32k_s.h @@ -27,31 +27,31 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { - - /*! - * \brief sink that checks if its input stream consists of a lfsr_32k sequence. - * \ingroup misc_blk - * - * \details - * This sink is typically used along with - * gr::blocks::lfsr_32k_source_s to test the USRP using its - * digital loopback mode. - */ - class BLOCKS_API check_lfsr_32k_s : virtual public sync_block - { - public: - // gr::blocks::check_lfsr_32k_s::sptr - typedef boost::shared_ptr<check_lfsr_32k_s> sptr; - - static sptr make(); - - virtual long ntotal () const = 0; - virtual long nright () const = 0; - virtual long runlength () const = 0; - }; - - } /* namespace blocks */ +namespace blocks { + +/*! + * \brief sink that checks if its input stream consists of a lfsr_32k sequence. + * \ingroup misc_blk + * + * \details + * This sink is typically used along with + * gr::blocks::lfsr_32k_source_s to test the USRP using its + * digital loopback mode. + */ +class BLOCKS_API check_lfsr_32k_s : virtual public sync_block +{ +public: + // gr::blocks::check_lfsr_32k_s::sptr + typedef boost::shared_ptr<check_lfsr_32k_s> sptr; + + static sptr make(); + + virtual long ntotal() const = 0; + virtual long nright() const = 0; + virtual long runlength() const = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_CHECK_LFSR_32K_S_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_arg.h b/gr-blocks/include/gnuradio/blocks/complex_to_arg.h index 2ea14aba63..374aa2c290 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_arg.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_arg.h @@ -27,27 +27,27 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief complex in, arg (arctan) out (float) + * \ingroup type_converters_blk + */ +class BLOCKS_API complex_to_arg : virtual public sync_block +{ +public: + // gr::blocks::complex_to_arg_ff::sptr + typedef boost::shared_ptr<complex_to_arg> sptr; /*! - * \brief complex in, arg (arctan) out (float) - * \ingroup type_converters_blk + * Build a complex to arg block. + * + * \param vlen vector len (default 1) */ - class BLOCKS_API complex_to_arg : virtual public sync_block - { - public: - // gr::blocks::complex_to_arg_ff::sptr - typedef boost::shared_ptr<complex_to_arg> sptr; - - /*! - * Build a complex to arg block. - * - * \param vlen vector len (default 1) - */ - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_COMPLEX_TO_ARG_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_float.h b/gr-blocks/include/gnuradio/blocks/complex_to_float.h index 40fcb729b4..11be9785ce 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_float.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_float.h @@ -27,33 +27,33 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert a stream of gr_complex to 1 or 2 streams of float. + * \ingroup type_converters_blk + * + * \details + * If a single output stream is attached, this will output the + * real part of the input complex samples. If a second output + * stream is connected, output[0] is the real part and output[1] + * is the imaginary part. + */ +class BLOCKS_API complex_to_float : virtual public sync_block +{ +public: + // gr::blocks::complex_to_float_ff::sptr + typedef boost::shared_ptr<complex_to_float> sptr; /*! - * \brief Convert a stream of gr_complex to 1 or 2 streams of float. - * \ingroup type_converters_blk + * Build a complex to float block. * - * \details - * If a single output stream is attached, this will output the - * real part of the input complex samples. If a second output - * stream is connected, output[0] is the real part and output[1] - * is the imaginary part. + * \param vlen vector len (default 1) */ - class BLOCKS_API complex_to_float : virtual public sync_block - { - public: - // gr::blocks::complex_to_float_ff::sptr - typedef boost::shared_ptr<complex_to_float> sptr; - - /*! - * Build a complex to float block. - * - * \param vlen vector len (default 1) - */ - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_COMPLEX_TO_FLOAT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_imag.h b/gr-blocks/include/gnuradio/blocks/complex_to_imag.h index 1311fa4dc2..95a060f8ea 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_imag.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_imag.h @@ -27,27 +27,27 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Produces the imaginary part (as a float0 of a complex stream. + * \ingroup type_converters_blk + */ +class BLOCKS_API complex_to_imag : virtual public sync_block +{ +public: + // gr::blocks::complex_to_imag_ff::sptr + typedef boost::shared_ptr<complex_to_imag> sptr; /*! - * \brief Produces the imaginary part (as a float0 of a complex stream. - * \ingroup type_converters_blk + * Build a complex to imaginary part block. + * + * \param vlen vector len (default 1) */ - class BLOCKS_API complex_to_imag : virtual public sync_block - { - public: - // gr::blocks::complex_to_imag_ff::sptr - typedef boost::shared_ptr<complex_to_imag> sptr; - - /*! - * Build a complex to imaginary part block. - * - * \param vlen vector len (default 1) - */ - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_COMPLEX_TO_IMAG_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_char.h b/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_char.h index edf96f7186..5fd7912a15 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_char.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_char.h @@ -27,34 +27,34 @@ #include <gnuradio/sync_interpolator.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of complex to a stream of interleaved chars. + * \ingroup type_converters_blk + * + * \details + * The output stream contains chars with twice as many output + * items as input items. For every complex input item, we produce + * two output chars that contain the real part and imaginary part + * converted to chars: + * + * \li output[0][n] = static_cast<char>(input[0][m].real()); + * \li output[0][n+1] = static_cast<char>(input[0][m].imag()); + */ +class BLOCKS_API complex_to_interleaved_char : virtual public sync_interpolator +{ +public: + // gr::blocks::complex_to_interleaved_char::sptr + typedef boost::shared_ptr<complex_to_interleaved_char> sptr; /*! - * \brief Convert stream of complex to a stream of interleaved chars. - * \ingroup type_converters_blk - * - * \details - * The output stream contains chars with twice as many output - * items as input items. For every complex input item, we produce - * two output chars that contain the real part and imaginary part - * converted to chars: - * - * \li output[0][n] = static_cast<char>(input[0][m].real()); - * \li output[0][n+1] = static_cast<char>(input[0][m].imag()); + * Build a complex to interleaved chars block. */ - class BLOCKS_API complex_to_interleaved_char : virtual public sync_interpolator - { - public: - // gr::blocks::complex_to_interleaved_char::sptr - typedef boost::shared_ptr<complex_to_interleaved_char> sptr; - - /*! - * Build a complex to interleaved chars block. - */ - static sptr make(bool vector=false); - }; + static sptr make(bool vector = false); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_COMPLEX_TO_INTERLEAVED_CHAR_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h b/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h index d68482c448..447016b29f 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h @@ -27,34 +27,34 @@ #include <gnuradio/sync_interpolator.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of complex to a stream of interleaved shorts. + * \ingroup type_converters_blk + * + * \details + * The output stream contains shorts with twice as many output + * items as input items. For every complex input item, we produce + * two output shorts that contain the real part and imaginary part + * converted to shorts: + * + * \li output[0][n] = static_cast<short>(input[0][m].real()); + * \li output[0][n+1] = static_cast<short>(input[0][m].imag()); + */ +class BLOCKS_API complex_to_interleaved_short : virtual public sync_interpolator +{ +public: + // gr::blocks::complex_to_interleaved_short::sptr + typedef boost::shared_ptr<complex_to_interleaved_short> sptr; /*! - * \brief Convert stream of complex to a stream of interleaved shorts. - * \ingroup type_converters_blk - * - * \details - * The output stream contains shorts with twice as many output - * items as input items. For every complex input item, we produce - * two output shorts that contain the real part and imaginary part - * converted to shorts: - * - * \li output[0][n] = static_cast<short>(input[0][m].real()); - * \li output[0][n+1] = static_cast<short>(input[0][m].imag()); + * Build a complex to interleaved shorts block. */ - class BLOCKS_API complex_to_interleaved_short : virtual public sync_interpolator - { - public: - // gr::blocks::complex_to_interleaved_short::sptr - typedef boost::shared_ptr<complex_to_interleaved_short> sptr; - - /*! - * Build a complex to interleaved shorts block. - */ - static sptr make(bool vector=false); - }; + static sptr make(bool vector = false); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_COMPLEX_TO_INTERLEAVED_SHORT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_mag.h b/gr-blocks/include/gnuradio/blocks/complex_to_mag.h index d6023a7681..d549d7db1e 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_mag.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_mag.h @@ -27,40 +27,40 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief complex in, magnitude out (float) + * \ingroup type_converters_blk + * + * \details + * Calculates the magnitude of the complex samples: + * + * \li output[0][m] = |input[0][m]| + * + * Or: + * \li output[0][m] = sqrt(Re{input[0][m]}^2 + Im{input[0][m]}^2) + * + * The input stream can be a vector of length \p vlen, and for + * each vector, each item is converted using the above + * function. So above, m is from 0 to noutput_items*vlen for each + * call to work. + */ +class BLOCKS_API complex_to_mag : virtual public sync_block +{ +public: + // gr::blocks::complex_to_mag_ff::sptr + typedef boost::shared_ptr<complex_to_mag> sptr; /*! - * \brief complex in, magnitude out (float) - * \ingroup type_converters_blk - * - * \details - * Calculates the magnitude of the complex samples: - * - * \li output[0][m] = |input[0][m]| + * Build a complex to magnitude block. * - * Or: - * \li output[0][m] = sqrt(Re{input[0][m]}^2 + Im{input[0][m]}^2) - * - * The input stream can be a vector of length \p vlen, and for - * each vector, each item is converted using the above - * function. So above, m is from 0 to noutput_items*vlen for each - * call to work. + * \param vlen vector len (default 1) */ - class BLOCKS_API complex_to_mag : virtual public sync_block - { - public: - // gr::blocks::complex_to_mag_ff::sptr - typedef boost::shared_ptr<complex_to_mag> sptr; - - /*! - * Build a complex to magnitude block. - * - * \param vlen vector len (default 1) - */ - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_COMPLEX_TO_MAG_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h b/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h index 2165a5c521..67dd37eb70 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h @@ -27,40 +27,40 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief complex in, magnitude squared out (float) + * \ingroup type_converters_blk + * + * \details + * Calculates the magnitude squared of the complex samples: + * + * \li output[0][m] = |input[0][m]|^2 + * + * Or: + * \li output[0][m] = Re{input[0][m]}^2 + Im{input[0][m]}^2 + * + * The input stream can be a vector of length \p vlen, and for + * each vector, each item is converted using the above + * function. So above, m is from 0 to noutput_items*vlen for each + * call to work. + */ +class BLOCKS_API complex_to_mag_squared : virtual public sync_block +{ +public: + // gr::blocks::complex_to_mag_squared_ff::sptr + typedef boost::shared_ptr<complex_to_mag_squared> sptr; /*! - * \brief complex in, magnitude squared out (float) - * \ingroup type_converters_blk - * - * \details - * Calculates the magnitude squared of the complex samples: - * - * \li output[0][m] = |input[0][m]|^2 + * Build a complex to magnitude squared block. * - * Or: - * \li output[0][m] = Re{input[0][m]}^2 + Im{input[0][m]}^2 - * - * The input stream can be a vector of length \p vlen, and for - * each vector, each item is converted using the above - * function. So above, m is from 0 to noutput_items*vlen for each - * call to work. + * \param vlen vector len (default 1) */ - class BLOCKS_API complex_to_mag_squared : virtual public sync_block - { - public: - // gr::blocks::complex_to_mag_squared_ff::sptr - typedef boost::shared_ptr<complex_to_mag_squared> sptr; - - /*! - * Build a complex to magnitude squared block. - * - * \param vlen vector len (default 1) - */ - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_COMPLEX_TO_MAG_SQUARED_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_magphase.h b/gr-blocks/include/gnuradio/blocks/complex_to_magphase.h index 6e0dfef27e..9ba96098ad 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_magphase.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_magphase.h @@ -27,31 +27,31 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert a stream of gr_complex to magnitude and phase (both floats) + * \ingroup type_converters_blk + * + * \details + * output[0] is the magnitude + * output[1] is the phase (in radians) + */ +class BLOCKS_API complex_to_magphase : virtual public sync_block +{ +public: + // gr::blocks::complex_to_magphase_ff::sptr + typedef boost::shared_ptr<complex_to_magphase> sptr; /*! - * \brief Convert a stream of gr_complex to magnitude and phase (both floats) - * \ingroup type_converters_blk + * Build a complex to magnitude and phase block. * - * \details - * output[0] is the magnitude - * output[1] is the phase (in radians) + * \param vlen vector len (default 1) */ - class BLOCKS_API complex_to_magphase : virtual public sync_block - { - public: - // gr::blocks::complex_to_magphase_ff::sptr - typedef boost::shared_ptr<complex_to_magphase> sptr; - - /*! - * Build a complex to magnitude and phase block. - * - * \param vlen vector len (default 1) - */ - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_COMPLEX_TO_MAGPHASE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_real.h b/gr-blocks/include/gnuradio/blocks/complex_to_real.h index 2b8bcbe2a7..580c3039de 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_real.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_real.h @@ -27,27 +27,27 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Produces the real part (as a float0 of a complex stream. + * \ingroup type_converters_blk + */ +class BLOCKS_API complex_to_real : virtual public sync_block +{ +public: + // gr::blocks::complex_to_real_ff::sptr + typedef boost::shared_ptr<complex_to_real> sptr; /*! - * \brief Produces the real part (as a float0 of a complex stream. - * \ingroup type_converters_blk + * Build a complex to real part block. + * + * \param vlen vector len (default 1) */ - class BLOCKS_API complex_to_real : virtual public sync_block - { - public: - // gr::blocks::complex_to_real_ff::sptr - typedef boost::shared_ptr<complex_to_real> sptr; - - /*! - * Build a complex to real part block. - * - * \param vlen vector len (default 1) - */ - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_COMPLEX_TO_REAL_H */ diff --git a/gr-blocks/include/gnuradio/blocks/conjugate_cc.h b/gr-blocks/include/gnuradio/blocks/conjugate_cc.h index 6be3219e70..ae83571afc 100644 --- a/gr-blocks/include/gnuradio/blocks/conjugate_cc.h +++ b/gr-blocks/include/gnuradio/blocks/conjugate_cc.h @@ -27,23 +27,22 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief output = complex conjugate of input - * \ingroup math_operators_blk - */ - class BLOCKS_API conjugate_cc : virtual public sync_block - { - public: - - // gr::blocks::conjugate_cc_ff::sptr - typedef boost::shared_ptr<conjugate_cc> sptr; +/*! + * \brief output = complex conjugate of input + * \ingroup math_operators_blk + */ +class BLOCKS_API conjugate_cc : virtual public sync_block +{ +public: + // gr::blocks::conjugate_cc_ff::sptr + typedef boost::shared_ptr<conjugate_cc> sptr; - static sptr make(); - }; + static sptr make(); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_CONJUGATE_CC_H */ diff --git a/gr-blocks/include/gnuradio/blocks/control_loop.h b/gr-blocks/include/gnuradio/blocks/control_loop.h index 3826d711fa..e654320fab 100644 --- a/gr-blocks/include/gnuradio/blocks/control_loop.h +++ b/gr-blocks/include/gnuradio/blocks/control_loop.h @@ -26,330 +26,321 @@ #include <gnuradio/blocks/api.h> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief A second-order control loop implementation class. +/*! + * \brief A second-order control loop implementation class. + * + * \details + * This class implements a second order control loop and is + * intended to act as a parent class to blocks which need a control + * loop (e.g., gr::digital::costas_loop_cc, + * gr::analog::pll_refout_cc, etc.). It takes in a loop bandwidth + * as well as a max and min frequency and provides the functions + * that control the update of the loop. + * + * The loop works of alpha and beta gains. These gains are + * calculated using the input loop bandwidth and a pre-set damping + * factor. The damping factor can be changed using the + * #set_damping_factor after the block is + * constructed. The alpha and beta values can be set using their + * respective #set_alpha or #set_beta functions if very precise + * control over these is required. + * + * The class tracks both phase and frequency of a signal based on + * an error signal. The error calculation is unique for each + * algorithm and is calculated externally and passed to the + * advance_loop function, which uses this to update its phase and + * frequency estimates. + * + * This class also provides the functions #phase_wrap and + * #frequency_limit to easily keep the phase and frequency + * estimates within our set bounds (phase_wrap keeps it within + * +/-2pi). + */ +class BLOCKS_API control_loop +{ +protected: + float d_phase, d_freq; + float d_max_freq, d_min_freq; + float d_damping, d_loop_bw; + float d_alpha, d_beta; + +public: + control_loop(void) {} + control_loop(float loop_bw, float max_freq, float min_freq); + virtual ~control_loop(); + + /*! \brief Update the system gains from the loop bandwidth and damping factor. * * \details - * This class implements a second order control loop and is - * intended to act as a parent class to blocks which need a control - * loop (e.g., gr::digital::costas_loop_cc, - * gr::analog::pll_refout_cc, etc.). It takes in a loop bandwidth - * as well as a max and min frequency and provides the functions - * that control the update of the loop. - * - * The loop works of alpha and beta gains. These gains are - * calculated using the input loop bandwidth and a pre-set damping - * factor. The damping factor can be changed using the - * #set_damping_factor after the block is - * constructed. The alpha and beta values can be set using their - * respective #set_alpha or #set_beta functions if very precise - * control over these is required. - * - * The class tracks both phase and frequency of a signal based on - * an error signal. The error calculation is unique for each - * algorithm and is calculated externally and passed to the - * advance_loop function, which uses this to update its phase and - * frequency estimates. - * - * This class also provides the functions #phase_wrap and - * #frequency_limit to easily keep the phase and frequency - * estimates within our set bounds (phase_wrap keeps it within - * +/-2pi). + * This function updates the system gains based on the loop + * bandwidth and damping factor of the system. These two + * factors can be set separately through their own set + * functions. */ - class BLOCKS_API control_loop - { - protected: - float d_phase, d_freq; - float d_max_freq, d_min_freq; - float d_damping, d_loop_bw; - float d_alpha, d_beta; + void update_gains(); - public: - control_loop(void) {} - control_loop(float loop_bw, float max_freq, float min_freq); - virtual ~control_loop(); - - /*! \brief Update the system gains from the loop bandwidth and damping factor. - * - * \details - * This function updates the system gains based on the loop - * bandwidth and damping factor of the system. These two - * factors can be set separately through their own set - * functions. - */ - void update_gains(); - - /*! \brief Advance the control loop based on the current gain - * settings and the inputted error signal. - */ - void advance_loop(float error); - - /*! \brief Keep the phase between -2pi and 2pi. - * - * \details - * This function keeps the phase between -2pi and 2pi. If the - * phase is greater than 2pi by d, it wraps around to be -2pi+d; - * similarly if it is less than -2pi by d, it wraps around to - * 2pi-d. - * - * This function should be called after advance_loop to keep the - * phase in a good operating region. It is set as a separate - * method in case another way is desired as this is fairly - * heavy-handed. - */ - void phase_wrap(); - - /*! \brief Keep the frequency between d_min_freq and d_max_freq. - * - * \details - * This function keeps the frequency between d_min_freq and - * d_max_freq. If the frequency is greater than d_max_freq, it - * is set to d_max_freq. If the frequency is less than - * d_min_freq, it is set to d_min_freq. - * - * This function should be called after advance_loop to keep the - * frequency in the specified region. It is set as a separate - * method in case another way is desired as this is fairly - * heavy-handed. - */ - void frequency_limit(); + /*! \brief Advance the control loop based on the current gain + * settings and the inputted error signal. + */ + void advance_loop(float error); - /******************************************************************* - * SET FUNCTIONS - *******************************************************************/ + /*! \brief Keep the phase between -2pi and 2pi. + * + * \details + * This function keeps the phase between -2pi and 2pi. If the + * phase is greater than 2pi by d, it wraps around to be -2pi+d; + * similarly if it is less than -2pi by d, it wraps around to + * 2pi-d. + * + * This function should be called after advance_loop to keep the + * phase in a good operating region. It is set as a separate + * method in case another way is desired as this is fairly + * heavy-handed. + */ + void phase_wrap(); - /*! - * \brief Set the loop bandwidth. - * - * \details - * Set the loop filter's bandwidth to \p bw. This should be - * between 2*pi/200 and 2*pi/100 (in rads/samp). It must also be - * a positive number. - * - * When a new damping factor is set, the gains, alpha and beta, - * of the loop are recalculated by a call to update_gains(). - * - * \param bw (float) new bandwidth - */ - virtual void set_loop_bandwidth(float bw); + /*! \brief Keep the frequency between d_min_freq and d_max_freq. + * + * \details + * This function keeps the frequency between d_min_freq and + * d_max_freq. If the frequency is greater than d_max_freq, it + * is set to d_max_freq. If the frequency is less than + * d_min_freq, it is set to d_min_freq. + * + * This function should be called after advance_loop to keep the + * frequency in the specified region. It is set as a separate + * method in case another way is desired as this is fairly + * heavy-handed. + */ + void frequency_limit(); - /*! - * \brief Set the loop damping factor. - * - * \details - * Set the loop filter's damping factor to \p df. The damping - * factor should be sqrt(2)/2.0 for critically damped systems. - * Set it to anything else only if you know what you are - * doing. It must be a number between 0 and 1. - * - * When a new damping factor is set, the gains, alpha and beta, - * of the loop are recalculated by a call to update_gains(). - * - * \param df (float) new damping factor - */ - void set_damping_factor(float df); + /******************************************************************* + * SET FUNCTIONS + *******************************************************************/ - /*! - * \brief Set the loop gain alpha. - * - * \details - * Sets the loop filter's alpha gain parameter. - * - * This value should really only be set by adjusting the loop - * bandwidth and damping factor. - * - * \param alpha (float) new alpha gain - */ - void set_alpha(float alpha); + /*! + * \brief Set the loop bandwidth. + * + * \details + * Set the loop filter's bandwidth to \p bw. This should be + * between 2*pi/200 and 2*pi/100 (in rads/samp). It must also be + * a positive number. + * + * When a new damping factor is set, the gains, alpha and beta, + * of the loop are recalculated by a call to update_gains(). + * + * \param bw (float) new bandwidth + */ + virtual void set_loop_bandwidth(float bw); - /*! - * \brief Set the loop gain beta. - * - * \details - * Sets the loop filter's beta gain parameter. - * - * This value should really only be set by adjusting the loop - * bandwidth and damping factor. - * - * \param beta (float) new beta gain - */ - void set_beta(float beta); + /*! + * \brief Set the loop damping factor. + * + * \details + * Set the loop filter's damping factor to \p df. The damping + * factor should be sqrt(2)/2.0 for critically damped systems. + * Set it to anything else only if you know what you are + * doing. It must be a number between 0 and 1. + * + * When a new damping factor is set, the gains, alpha and beta, + * of the loop are recalculated by a call to update_gains(). + * + * \param df (float) new damping factor + */ + void set_damping_factor(float df); - /*! - * \brief Set the control loop's frequency. - * - * \details - * Sets the control loop's frequency. While this is normally - * updated by the inner loop of the algorithm, it could be - * useful to manually initialize, set, or reset this under - * certain circumstances. - * - * \param freq (float) new frequency - */ - void set_frequency(float freq); + /*! + * \brief Set the loop gain alpha. + * + * \details + * Sets the loop filter's alpha gain parameter. + * + * This value should really only be set by adjusting the loop + * bandwidth and damping factor. + * + * \param alpha (float) new alpha gain + */ + void set_alpha(float alpha); - /*! - * \brief Set the control loop's phase. - * - * \details - * Sets the control loop's phase. While this is normally - * updated by the inner loop of the algorithm, it could be - * useful to manually initialize, set, or reset this under - * certain circumstances. - * - * \param phase (float) new phase - */ - void set_phase(float phase); + /*! + * \brief Set the loop gain beta. + * + * \details + * Sets the loop filter's beta gain parameter. + * + * This value should really only be set by adjusting the loop + * bandwidth and damping factor. + * + * \param beta (float) new beta gain + */ + void set_beta(float beta); - /*! - * \brief Set the control loop's maximum frequency. - * - * \details - * Set the maximum frequency the control loop can track. - * - * \param freq (float) new max frequency - */ - void set_max_freq(float freq); + /*! + * \brief Set the control loop's frequency. + * + * \details + * Sets the control loop's frequency. While this is normally + * updated by the inner loop of the algorithm, it could be + * useful to manually initialize, set, or reset this under + * certain circumstances. + * + * \param freq (float) new frequency + */ + void set_frequency(float freq); - /*! - * \brief Set the control loop's minimum frequency. - * - * \details - * Set the minimum frequency the control loop can track. - * - * \param freq (float) new min frequency - */ - void set_min_freq(float freq); + /*! + * \brief Set the control loop's phase. + * + * \details + * Sets the control loop's phase. While this is normally + * updated by the inner loop of the algorithm, it could be + * useful to manually initialize, set, or reset this under + * certain circumstances. + * + * \param phase (float) new phase + */ + void set_phase(float phase); - /******************************************************************* - * GET FUNCTIONS - *******************************************************************/ + /*! + * \brief Set the control loop's maximum frequency. + * + * \details + * Set the maximum frequency the control loop can track. + * + * \param freq (float) new max frequency + */ + void set_max_freq(float freq); - /*! - * \brief Returns the loop bandwidth. - */ - float get_loop_bandwidth() const; + /*! + * \brief Set the control loop's minimum frequency. + * + * \details + * Set the minimum frequency the control loop can track. + * + * \param freq (float) new min frequency + */ + void set_min_freq(float freq); - /*! - * \brief Returns the loop damping factor. - */ - float get_damping_factor() const; + /******************************************************************* + * GET FUNCTIONS + *******************************************************************/ - /*! - * \brief Returns the loop gain alpha. - */ - float get_alpha() const; + /*! + * \brief Returns the loop bandwidth. + */ + float get_loop_bandwidth() const; - /*! - * \brief Returns the loop gain beta. - */ - float get_beta() const; + /*! + * \brief Returns the loop damping factor. + */ + float get_damping_factor() const; - /*! - * \brief Get the control loop's frequency estimate. - */ - float get_frequency() const; + /*! + * \brief Returns the loop gain alpha. + */ + float get_alpha() const; - /*! - * \brief Get the control loop's phase estimate. - */ - float get_phase() const; + /*! + * \brief Returns the loop gain beta. + */ + float get_beta() const; - /*! - * \brief Get the control loop's maximum frequency. - */ - float get_max_freq() const; + /*! + * \brief Get the control loop's frequency estimate. + */ + float get_frequency() const; - /*! - * \brief Get the control loop's minimum frequency. - */ - float get_min_freq() const; - }; + /*! + * \brief Get the control loop's phase estimate. + */ + float get_phase() const; - // This is a table of tanh(x) for x in [-2, 2] used in tanh_lut. - static float - tanh_lut_table[256] = { -0.96402758, -0.96290241, -0.96174273, -0.96054753, -0.95931576, - -0.95804636, -0.95673822, -0.95539023, -0.95400122, -0.95257001, - -0.95109539, -0.9495761 , -0.94801087, -0.94639839, -0.94473732, - -0.94302627, -0.94126385, -0.93944862, -0.93757908, -0.93565374, - -0.93367104, -0.93162941, -0.92952723, -0.92736284, -0.92513456, - -0.92284066, -0.92047938, -0.91804891, -0.91554743, -0.91297305, - -0.91032388, -0.90759795, -0.9047933 , -0.90190789, -0.89893968, - -0.89588656, -0.89274642, -0.88951709, -0.88619637, -0.88278203, - -0.87927182, -0.87566342, -0.87195453, -0.86814278, -0.86422579, - -0.86020115, -0.85606642, -0.85181914, -0.84745683, -0.84297699, - -0.83837709, -0.83365461, -0.82880699, -0.82383167, -0.81872609, - -0.81348767, -0.80811385, -0.80260204, -0.7969497 , -0.79115425, - -0.78521317, -0.77912392, -0.772884 , -0.76649093, -0.75994227, - -0.75323562, -0.74636859, -0.73933889, -0.73214422, -0.7247824 , - -0.71725127, -0.70954876, -0.70167287, -0.6936217 , -0.68539341, - -0.67698629, -0.66839871, -0.65962916, -0.65067625, -0.64153871, - -0.6322154 , -0.62270534, -0.61300768, -0.60312171, -0.59304692, - -0.58278295, -0.57232959, -0.56168685, -0.55085493, -0.53983419, - -0.52862523, -0.51722883, -0.50564601, -0.49387799, -0.48192623, - -0.46979241, -0.45747844, -0.44498647, -0.4323189 , -0.41947836, - -0.40646773, -0.39329014, -0.37994896, -0.36644782, -0.35279057, - -0.33898135, -0.32502449, -0.31092459, -0.2966865 , -0.28231527, - -0.26781621, -0.25319481, -0.23845682, -0.22360817, -0.208655 , - -0.19360362, -0.17846056, -0.16323249, -0.14792623, -0.13254879, - -0.11710727, -0.10160892, -0.08606109, -0.07047123, -0.05484686, - -0.0391956 , -0.02352507, -0.00784298, 0.00784298, 0.02352507, - 0.0391956 , 0.05484686, 0.07047123, 0.08606109, 0.10160892, - 0.11710727, 0.13254879, 0.14792623, 0.16323249, 0.17846056, - 0.19360362, 0.208655 , 0.22360817, 0.23845682, 0.25319481, - 0.26781621, 0.28231527, 0.2966865 , 0.31092459, 0.32502449, - 0.33898135, 0.35279057, 0.36644782, 0.37994896, 0.39329014, - 0.40646773, 0.41947836, 0.4323189 , 0.44498647, 0.45747844, - 0.46979241, 0.48192623, 0.49387799, 0.50564601, 0.51722883, - 0.52862523, 0.53983419, 0.55085493, 0.56168685, 0.57232959, - 0.58278295, 0.59304692, 0.60312171, 0.61300768, 0.62270534, - 0.6322154 , 0.64153871, 0.65067625, 0.65962916, 0.66839871, - 0.67698629, 0.68539341, 0.6936217 , 0.70167287, 0.70954876, - 0.71725127, 0.7247824 , 0.73214422, 0.73933889, 0.74636859, - 0.75323562, 0.75994227, 0.76649093, 0.772884 , 0.77912392, - 0.78521317, 0.79115425, 0.7969497 , 0.80260204, 0.80811385, - 0.81348767, 0.81872609, 0.82383167, 0.82880699, 0.83365461, - 0.83837709, 0.84297699, 0.84745683, 0.85181914, 0.85606642, - 0.86020115, 0.86422579, 0.86814278, 0.87195453, 0.87566342, - 0.87927182, 0.88278203, 0.88619637, 0.88951709, 0.89274642, - 0.89588656, 0.89893968, 0.90190789, 0.9047933 , 0.90759795, - 0.91032388, 0.91297305, 0.91554743, 0.91804891, 0.92047938, - 0.92284066, 0.92513456, 0.92736284, 0.92952723, 0.93162941, - 0.93367104, 0.93565374, 0.93757908, 0.93944862, 0.94126385, - 0.94302627, 0.94473732, 0.94639839, 0.94801087, 0.9495761 , - 0.95109539, 0.95257001, 0.95400122, 0.95539023, 0.95673822, - 0.95804636, 0.95931576, 0.96054753, 0.96174273, 0.96290241, - 0.96402758 }; + /*! + * \brief Get the control loop's maximum frequency. + */ + float get_max_freq() const; /*! - * A look-up table (LUT) tanh calcuation. This function returns an - * estimate to tanh(x) based on a 256-point LUT between -2 and - * 2. If x < -2, it returns -1; if > 2, it returns 1. - * - * This LUT form of the tanh is "hidden" in this code because it - * is likely too coarse an estimate for any real uses of a - * tanh. It is useful, however, in certain control loop - * applications where the input is expected to be within these - * bounds and the noise will be greater than the quanitzation of - * this small LUT. For more accurate forms of tanh, see - * volk_32f_tanh_32f. + * \brief Get the control loop's minimum frequency. */ - static inline float - tanhf_lut(float x) - { - if(x > 2) + float get_min_freq() const; +}; + +// This is a table of tanh(x) for x in [-2, 2] used in tanh_lut. +static float tanh_lut_table[256] = { + -0.96402758, -0.96290241, -0.96174273, -0.96054753, -0.95931576, -0.95804636, + -0.95673822, -0.95539023, -0.95400122, -0.95257001, -0.95109539, -0.9495761, + -0.94801087, -0.94639839, -0.94473732, -0.94302627, -0.94126385, -0.93944862, + -0.93757908, -0.93565374, -0.93367104, -0.93162941, -0.92952723, -0.92736284, + -0.92513456, -0.92284066, -0.92047938, -0.91804891, -0.91554743, -0.91297305, + -0.91032388, -0.90759795, -0.9047933, -0.90190789, -0.89893968, -0.89588656, + -0.89274642, -0.88951709, -0.88619637, -0.88278203, -0.87927182, -0.87566342, + -0.87195453, -0.86814278, -0.86422579, -0.86020115, -0.85606642, -0.85181914, + -0.84745683, -0.84297699, -0.83837709, -0.83365461, -0.82880699, -0.82383167, + -0.81872609, -0.81348767, -0.80811385, -0.80260204, -0.7969497, -0.79115425, + -0.78521317, -0.77912392, -0.772884, -0.76649093, -0.75994227, -0.75323562, + -0.74636859, -0.73933889, -0.73214422, -0.7247824, -0.71725127, -0.70954876, + -0.70167287, -0.6936217, -0.68539341, -0.67698629, -0.66839871, -0.65962916, + -0.65067625, -0.64153871, -0.6322154, -0.62270534, -0.61300768, -0.60312171, + -0.59304692, -0.58278295, -0.57232959, -0.56168685, -0.55085493, -0.53983419, + -0.52862523, -0.51722883, -0.50564601, -0.49387799, -0.48192623, -0.46979241, + -0.45747844, -0.44498647, -0.4323189, -0.41947836, -0.40646773, -0.39329014, + -0.37994896, -0.36644782, -0.35279057, -0.33898135, -0.32502449, -0.31092459, + -0.2966865, -0.28231527, -0.26781621, -0.25319481, -0.23845682, -0.22360817, + -0.208655, -0.19360362, -0.17846056, -0.16323249, -0.14792623, -0.13254879, + -0.11710727, -0.10160892, -0.08606109, -0.07047123, -0.05484686, -0.0391956, + -0.02352507, -0.00784298, 0.00784298, 0.02352507, 0.0391956, 0.05484686, + 0.07047123, 0.08606109, 0.10160892, 0.11710727, 0.13254879, 0.14792623, + 0.16323249, 0.17846056, 0.19360362, 0.208655, 0.22360817, 0.23845682, + 0.25319481, 0.26781621, 0.28231527, 0.2966865, 0.31092459, 0.32502449, + 0.33898135, 0.35279057, 0.36644782, 0.37994896, 0.39329014, 0.40646773, + 0.41947836, 0.4323189, 0.44498647, 0.45747844, 0.46979241, 0.48192623, + 0.49387799, 0.50564601, 0.51722883, 0.52862523, 0.53983419, 0.55085493, + 0.56168685, 0.57232959, 0.58278295, 0.59304692, 0.60312171, 0.61300768, + 0.62270534, 0.6322154, 0.64153871, 0.65067625, 0.65962916, 0.66839871, + 0.67698629, 0.68539341, 0.6936217, 0.70167287, 0.70954876, 0.71725127, + 0.7247824, 0.73214422, 0.73933889, 0.74636859, 0.75323562, 0.75994227, + 0.76649093, 0.772884, 0.77912392, 0.78521317, 0.79115425, 0.7969497, + 0.80260204, 0.80811385, 0.81348767, 0.81872609, 0.82383167, 0.82880699, + 0.83365461, 0.83837709, 0.84297699, 0.84745683, 0.85181914, 0.85606642, + 0.86020115, 0.86422579, 0.86814278, 0.87195453, 0.87566342, 0.87927182, + 0.88278203, 0.88619637, 0.88951709, 0.89274642, 0.89588656, 0.89893968, + 0.90190789, 0.9047933, 0.90759795, 0.91032388, 0.91297305, 0.91554743, + 0.91804891, 0.92047938, 0.92284066, 0.92513456, 0.92736284, 0.92952723, + 0.93162941, 0.93367104, 0.93565374, 0.93757908, 0.93944862, 0.94126385, + 0.94302627, 0.94473732, 0.94639839, 0.94801087, 0.9495761, 0.95109539, + 0.95257001, 0.95400122, 0.95539023, 0.95673822, 0.95804636, 0.95931576, + 0.96054753, 0.96174273, 0.96290241, 0.96402758 +}; + +/*! + * A look-up table (LUT) tanh calcuation. This function returns an + * estimate to tanh(x) based on a 256-point LUT between -2 and + * 2. If x < -2, it returns -1; if > 2, it returns 1. + * + * This LUT form of the tanh is "hidden" in this code because it + * is likely too coarse an estimate for any real uses of a + * tanh. It is useful, however, in certain control loop + * applications where the input is expected to be within these + * bounds and the noise will be greater than the quanitzation of + * this small LUT. For more accurate forms of tanh, see + * volk_32f_tanh_32f. + */ +static inline float tanhf_lut(float x) +{ + if (x > 2) return 1; - else if(x <= -2) + else if (x <= -2) return -1; - else { - int index = 128 + 64*x; + else { + int index = 128 + 64 * x; return tanh_lut_table[index]; - } } +} - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* GR_BLOCKS_CONTROL_LOOP */ diff --git a/gr-blocks/include/gnuradio/blocks/copy.h b/gr-blocks/include/gnuradio/blocks/copy.h index a953b413af..8305485a13 100644 --- a/gr-blocks/include/gnuradio/blocks/copy.h +++ b/gr-blocks/include/gnuradio/blocks/copy.h @@ -27,35 +27,35 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { - - /*! - * \brief output[i] = input[i] - * \ingroup misc_blk - * - * \details - * When enabled (default), this block copies its input to its - * output. When disabled, this block drops its input on the floor. - * - * Message Ports: - * - * - en (input): - * Receives a PMT bool message to either enable to disable - * copy. - */ - class BLOCKS_API copy : virtual public 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 blocks { + +/*! + * \brief output[i] = input[i] + * \ingroup misc_blk + * + * \details + * When enabled (default), this block copies its input to its + * output. When disabled, this block drops its input on the floor. + * + * Message Ports: + * + * - en (input): + * Receives a PMT bool message to either enable to disable + * copy. + */ +class BLOCKS_API copy : virtual public 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/gnuradio/blocks/count_bits.h b/gr-blocks/include/gnuradio/blocks/count_bits.h index 80b58041bd..264b6ed363 100644 --- a/gr-blocks/include/gnuradio/blocks/count_bits.h +++ b/gr-blocks/include/gnuradio/blocks/count_bits.h @@ -26,21 +26,21 @@ #include <gnuradio/blocks/api.h> namespace gr { - namespace blocks { +namespace blocks { - //! return number of set bits in the low 8 bits of x - BLOCKS_API unsigned int count_bits8(unsigned int x); +//! return number of set bits in the low 8 bits of x +BLOCKS_API unsigned int count_bits8(unsigned int x); - //! return number of set bits in the low 16 bits of x - BLOCKS_API unsigned int count_bits16(unsigned int x); +//! return number of set bits in the low 16 bits of x +BLOCKS_API unsigned int count_bits16(unsigned int x); - //! return number of set bits in the low 32 bits of x - BLOCKS_API unsigned int count_bits32(unsigned int x); +//! return number of set bits in the low 32 bits of x +BLOCKS_API unsigned int count_bits32(unsigned int x); - //! return number of set bits in a 64-bit word - BLOCKS_API unsigned int count_bits64(unsigned long long int x); +//! return number of set bits in a 64-bit word +BLOCKS_API unsigned int count_bits64(unsigned long long int x); - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* _GR_COUNT_BITS_H_ */ diff --git a/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_b.h b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_b.h index 5ad31655cf..a5db817f29 100644 --- a/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_b.h +++ b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_b.h @@ -27,43 +27,42 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief A ControlPort probe to export vectors of signals. + * \ingroup measurement_tools_blk + * \ingroup controlport_blk + * + * \details + * This block acts as a sink in the flowgraph but also exports + * vectors of complex samples over ControlPort. This block holds + * the latest \p len number of complex samples so that every query + * by a ControlPort client will get the same length vector. + */ +class BLOCKS_API ctrlport_probe2_b : virtual public sync_block +{ +public: + // gr::blocks::ctrlport_probe2_b::sptr + typedef boost::shared_ptr<ctrlport_probe2_b> sptr; /*! - * \brief A ControlPort probe to export vectors of signals. - * \ingroup measurement_tools_blk - * \ingroup controlport_blk - * - * \details - * This block acts as a sink in the flowgraph but also exports - * vectors of complex samples over ControlPort. This block holds - * the latest \p len number of complex samples so that every query - * by a ControlPort client will get the same length vector. + * \brief Make a ControlPort probe block. + * \param id A string ID to name the probe over ControlPort. + * \param desc A string describing the probe. + * \param len Number of samples to transmit. + * \param disp_mask Mask to set default display params. */ - class BLOCKS_API ctrlport_probe2_b : virtual public sync_block - { - public: - // gr::blocks::ctrlport_probe2_b::sptr - typedef boost::shared_ptr<ctrlport_probe2_b> sptr; + static sptr + make(const std::string& id, const std::string& desc, int len, unsigned int disp_mask); - /*! - * \brief Make a ControlPort probe block. - * \param id A string ID to name the probe over ControlPort. - * \param desc A string describing the probe. - * \param len Number of samples to transmit. - * \param disp_mask Mask to set default display params. - */ - static sptr make(const std::string &id, const std::string &desc, - int len, unsigned int disp_mask); + virtual std::vector<signed char> get() = 0; - virtual std::vector<signed char> get() = 0; + virtual void set_length(int len) = 0; + virtual int length() const = 0; +}; - virtual void set_length(int len) = 0; - virtual int length() const = 0; - }; - - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_CTRLPORT_PROBE2_B_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_c.h b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_c.h index 51d908b47a..89c5a60437 100644 --- a/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_c.h +++ b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_c.h @@ -27,43 +27,42 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief A ControlPort probe to export vectors of signals. + * \ingroup measurement_tools_blk + * \ingroup controlport_blk + * + * \details + * This block acts as a sink in the flowgraph but also exports + * vectors of complex samples over ControlPort. This block holds + * the latest \p len number of complex samples so that every query + * by a ControlPort client will get the same length vector. + */ +class BLOCKS_API ctrlport_probe2_c : virtual public sync_block +{ +public: + // gr::blocks::ctrlport_probe2_c::sptr + typedef boost::shared_ptr<ctrlport_probe2_c> sptr; /*! - * \brief A ControlPort probe to export vectors of signals. - * \ingroup measurement_tools_blk - * \ingroup controlport_blk - * - * \details - * This block acts as a sink in the flowgraph but also exports - * vectors of complex samples over ControlPort. This block holds - * the latest \p len number of complex samples so that every query - * by a ControlPort client will get the same length vector. + * \brief Make a ControlPort probe block. + * \param id A string ID to name the probe over ControlPort. + * \param desc A string describing the probe. + * \param len Number of samples to transmit. + * \param disp_mask Mask to set default display params. */ - class BLOCKS_API ctrlport_probe2_c : virtual public sync_block - { - public: - // gr::blocks::ctrlport_probe2_c::sptr - typedef boost::shared_ptr<ctrlport_probe2_c> sptr; + static sptr + make(const std::string& id, const std::string& desc, int len, unsigned int disp_mask); - /*! - * \brief Make a ControlPort probe block. - * \param id A string ID to name the probe over ControlPort. - * \param desc A string describing the probe. - * \param len Number of samples to transmit. - * \param disp_mask Mask to set default display params. - */ - static sptr make(const std::string &id, const std::string &desc, - int len, unsigned int disp_mask); + virtual std::vector<gr_complex> get() = 0; - virtual std::vector<gr_complex> get() = 0; + virtual void set_length(int len) = 0; + virtual int length() const = 0; +}; - virtual void set_length(int len) = 0; - virtual int length() const = 0; - }; - - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_CTRLPORT_PROBE2_C_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_f.h b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_f.h index 38d1906ed0..930853af50 100644 --- a/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_f.h +++ b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_f.h @@ -27,43 +27,42 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief A ControlPort probe to export vectors of signals. + * \ingroup measurement_tools_blk + * \ingroup controlport_blk + * + * \details + * This block acts as a sink in the flowgraph but also exports + * vectors of complex samples over ControlPort. This block holds + * the latest \p len number of complex samples so that every query + * by a ControlPort client will get the same length vector. + */ +class BLOCKS_API ctrlport_probe2_f : virtual public sync_block +{ +public: + // gr::blocks::ctrlport_probe2_f::sptr + typedef boost::shared_ptr<ctrlport_probe2_f> sptr; /*! - * \brief A ControlPort probe to export vectors of signals. - * \ingroup measurement_tools_blk - * \ingroup controlport_blk - * - * \details - * This block acts as a sink in the flowgraph but also exports - * vectors of complex samples over ControlPort. This block holds - * the latest \p len number of complex samples so that every query - * by a ControlPort client will get the same length vector. + * \brief Make a ControlPort probe block. + * \param id A string ID to name the probe over ControlPort. + * \param desc A string describing the probe. + * \param len Number of samples to transmit. + * \param disp_mask Mask to set default display params. */ - class BLOCKS_API ctrlport_probe2_f : virtual public sync_block - { - public: - // gr::blocks::ctrlport_probe2_f::sptr - typedef boost::shared_ptr<ctrlport_probe2_f> sptr; + static sptr + make(const std::string& id, const std::string& desc, int len, unsigned int disp_mask); - /*! - * \brief Make a ControlPort probe block. - * \param id A string ID to name the probe over ControlPort. - * \param desc A string describing the probe. - * \param len Number of samples to transmit. - * \param disp_mask Mask to set default display params. - */ - static sptr make(const std::string &id, const std::string &desc, - int len, unsigned int disp_mask); + virtual std::vector<float> get() = 0; - virtual std::vector<float> get() = 0; + virtual void set_length(int len) = 0; + virtual int length() const = 0; +}; - virtual void set_length(int len) = 0; - virtual int length() const = 0; - }; - - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_CTRLPORT_PROBE2_F_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_i.h b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_i.h index cdfb1b86a4..7f07e03452 100644 --- a/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_i.h +++ b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_i.h @@ -27,43 +27,42 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief A ControlPort probe to export vectors of signals. + * \ingroup measurement_tools_blk + * \ingroup controlport_blk + * + * \details + * This block acts as a sink in the flowgraph but also exports + * vectors of complex samples over ControlPort. This block holds + * the latest \p len number of complex samples so that every query + * by a ControlPort client will get the same length vector. + */ +class BLOCKS_API ctrlport_probe2_i : virtual public sync_block +{ +public: + // gr::blocks::ctrlport_probe2_i::sptr + typedef boost::shared_ptr<ctrlport_probe2_i> sptr; /*! - * \brief A ControlPort probe to export vectors of signals. - * \ingroup measurement_tools_blk - * \ingroup controlport_blk - * - * \details - * This block acts as a sink in the flowgraph but also exports - * vectors of complex samples over ControlPort. This block holds - * the latest \p len number of complex samples so that every query - * by a ControlPort client will get the same length vector. + * \brief Make a ControlPort probe block. + * \param id A string ID to name the probe over ControlPort. + * \param desc A string describing the probe. + * \param len Number of samples to transmit. + * \param disp_mask Mask to set default display params. */ - class BLOCKS_API ctrlport_probe2_i : virtual public sync_block - { - public: - // gr::blocks::ctrlport_probe2_i::sptr - typedef boost::shared_ptr<ctrlport_probe2_i> sptr; + static sptr + make(const std::string& id, const std::string& desc, int len, unsigned int disp_mask); - /*! - * \brief Make a ControlPort probe block. - * \param id A string ID to name the probe over ControlPort. - * \param desc A string describing the probe. - * \param len Number of samples to transmit. - * \param disp_mask Mask to set default display params. - */ - static sptr make(const std::string &id, const std::string &desc, - int len, unsigned int disp_mask); + virtual std::vector<int> get() = 0; - virtual std::vector<int> get() = 0; + virtual void set_length(int len) = 0; + virtual int length() const = 0; +}; - virtual void set_length(int len) = 0; - virtual int length() const = 0; - }; - - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_CTRLPORT_PROBE2_I_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_s.h b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_s.h index 676a24822a..b382e46af8 100644 --- a/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_s.h +++ b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_s.h @@ -27,43 +27,42 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief A ControlPort probe to export vectors of signals. + * \ingroup measurement_tools_blk + * \ingroup controlport_blk + * + * \details + * This block acts as a sink in the flowgraph but also exports + * vectors of complex samples over ControlPort. This block holds + * the latest \p len number of complex samples so that every query + * by a ControlPort client will get the same length vector. + */ +class BLOCKS_API ctrlport_probe2_s : virtual public sync_block +{ +public: + // gr::blocks::ctrlport_probe2_s::sptr + typedef boost::shared_ptr<ctrlport_probe2_s> sptr; /*! - * \brief A ControlPort probe to export vectors of signals. - * \ingroup measurement_tools_blk - * \ingroup controlport_blk - * - * \details - * This block acts as a sink in the flowgraph but also exports - * vectors of complex samples over ControlPort. This block holds - * the latest \p len number of complex samples so that every query - * by a ControlPort client will get the same length vector. + * \brief Make a ControlPort probe block. + * \param id A string ID to name the probe over ControlPort. + * \param desc A string describing the probe. + * \param len Number of samples to transmit. + * \param disp_mask Mask to set default display params. */ - class BLOCKS_API ctrlport_probe2_s : virtual public sync_block - { - public: - // gr::blocks::ctrlport_probe2_s::sptr - typedef boost::shared_ptr<ctrlport_probe2_s> sptr; + static sptr + make(const std::string& id, const std::string& desc, int len, unsigned int disp_mask); - /*! - * \brief Make a ControlPort probe block. - * \param id A string ID to name the probe over ControlPort. - * \param desc A string describing the probe. - * \param len Number of samples to transmit. - * \param disp_mask Mask to set default display params. - */ - static sptr make(const std::string &id, const std::string &desc, - int len, unsigned int disp_mask); + virtual std::vector<short> get() = 0; - virtual std::vector<short> get() = 0; + virtual void set_length(int len) = 0; + virtual int length() const = 0; +}; - virtual void set_length(int len) = 0; - virtual int length() const = 0; - }; - - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_CTRLPORT_PROBE2_S_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/ctrlport_probe_c.h b/gr-blocks/include/gnuradio/blocks/ctrlport_probe_c.h index 2b9bd12788..40ef05ed82 100644 --- a/gr-blocks/include/gnuradio/blocks/ctrlport_probe_c.h +++ b/gr-blocks/include/gnuradio/blocks/ctrlport_probe_c.h @@ -29,37 +29,36 @@ #include <boost/thread/shared_mutex.hpp> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief A ControlPort probe to export vectors of signals. + * \ingroup measurement_tools_blk + * \ingroup controlport_blk + * + * \details + * This block acts as a sink in the flowgraph but also exports + * vectors of complex samples over ControlPort. This block simply + * sends the current vector held in the work function when the + * queried by a ControlPort client. + */ +class BLOCKS_API ctrlport_probe_c : virtual public sync_block +{ +public: + // gr::blocks::ctrlport_probe_c::sptr + typedef boost::shared_ptr<ctrlport_probe_c> sptr; /*! - * \brief A ControlPort probe to export vectors of signals. - * \ingroup measurement_tools_blk - * \ingroup controlport_blk - * - * \details - * This block acts as a sink in the flowgraph but also exports - * vectors of complex samples over ControlPort. This block simply - * sends the current vector held in the work function when the - * queried by a ControlPort client. + * \brief Make a ControlPort probe block. + * \param id A string ID to name the probe over ControlPort. + * \param desc A string describing the probe. */ - class BLOCKS_API ctrlport_probe_c : virtual public sync_block - { - public: - // gr::blocks::ctrlport_probe_c::sptr - typedef boost::shared_ptr<ctrlport_probe_c> sptr; + static sptr make(const std::string& id, const std::string& desc); - /*! - * \brief Make a ControlPort probe block. - * \param id A string ID to name the probe over ControlPort. - * \param desc A string describing the probe. - */ - static sptr make(const std::string &id, const std::string &desc); + virtual std::vector<gr_complex> get() = 0; +}; - virtual std::vector<gr_complex> get() = 0; - }; - - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_CTRLPORT_GR_CTRLPORT_PROBE_C_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/deinterleave.h b/gr-blocks/include/gnuradio/blocks/deinterleave.h index a3b5480089..1589ebae16 100644 --- a/gr-blocks/include/gnuradio/blocks/deinterleave.h +++ b/gr-blocks/include/gnuradio/blocks/deinterleave.h @@ -27,51 +27,51 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief deinterleave an input block of samples into N outputs. + * \ingroup stream_operators_blk + * + * \details + * This block deinterleaves blocks of samples. For each output + * connection, the input stream will be deinterleaved successively + * to the output connections. By default, the block deinterleaves + * a single input to each output unless blocksize is given in the + * constructor. + * + * \code + * blocksize = 1 + * connections = 2 + * input = [a, b, c, d, e, f, g, h] + * output[0] = [a, c, e, g] + * output[1] = [b, d, f, h] + * \endcode + * + * \code + * blocksize = 2 + * connections = 2 + * input = [a, b, c, d, e, f, g, h] + * output[0] = [a, b, e, f] + * output[1] = [c, d, g, h] + * \endcode + */ +class BLOCKS_API deinterleave : virtual public block +{ +public: + // gr::blocks::deinterleave::sptr + typedef boost::shared_ptr<deinterleave> sptr; /*! - * \brief deinterleave an input block of samples into N outputs. - * \ingroup stream_operators_blk - * - * \details - * This block deinterleaves blocks of samples. For each output - * connection, the input stream will be deinterleaved successively - * to the output connections. By default, the block deinterleaves - * a single input to each output unless blocksize is given in the - * constructor. + * Make a deinterleave block. * - * \code - * blocksize = 1 - * connections = 2 - * input = [a, b, c, d, e, f, g, h] - * output[0] = [a, c, e, g] - * output[1] = [b, d, f, h] - * \endcode - * - * \code - * blocksize = 2 - * connections = 2 - * input = [a, b, c, d, e, f, g, h] - * output[0] = [a, b, e, f] - * output[1] = [c, d, g, h] - * \endcode + * \param itemsize stream itemsize + * \param blocksize size of block to deinterleave */ - class BLOCKS_API deinterleave : virtual public block - { - public: - // gr::blocks::deinterleave::sptr - typedef boost::shared_ptr<deinterleave> sptr; - - /*! - * Make a deinterleave block. - * - * \param itemsize stream itemsize - * \param blocksize size of block to deinterleave - */ - static sptr make(size_t itemsize, unsigned int blocksize = 1); - }; + static sptr make(size_t itemsize, unsigned int blocksize = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_DEINTERLEAVE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/delay.h b/gr-blocks/include/gnuradio/blocks/delay.h index 381669b7ed..771212501b 100644 --- a/gr-blocks/include/gnuradio/blocks/delay.h +++ b/gr-blocks/include/gnuradio/blocks/delay.h @@ -27,44 +27,44 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief delay the input by a certain number of samples + * \ingroup misc_blk + * + * Positive delays insert zero items at the beginning of the stream. + * Negative delays discard items from the stream. + * + * You cannot initialize this block with a negative delay, + * however. That leads to a causality issue with the buffers when + * they are initialized. If you need to negetively delay one path, + * then put the positive delay on the other path instead. + */ +class BLOCKS_API delay : virtual public block +{ +public: + // gr::blocks::delay::sptr + typedef boost::shared_ptr<delay> sptr; /*! - * \brief delay the input by a certain number of samples - * \ingroup misc_blk - * - * Positive delays insert zero items at the beginning of the stream. - * Negative delays discard items from the stream. - * - * You cannot initialize this block with a negative delay, - * however. That leads to a causality issue with the buffers when - * they are initialized. If you need to negetively delay one path, - * then put the positive delay on the other path instead. + * \brief Make a delay block. + * \param itemsize size of the data items. + * \param delay number of samples to delay stream (>= 0). */ - class BLOCKS_API delay : virtual public block - { - public: - // gr::blocks::delay::sptr - typedef boost::shared_ptr<delay> sptr; + static sptr make(size_t itemsize, int delay); - /*! - * \brief Make a delay block. - * \param itemsize size of the data items. - * \param delay number of samples to delay stream (>= 0). - */ - static sptr make(size_t itemsize, int delay); + virtual int dly() const = 0; - virtual int dly() const = 0; - - /*! - * \brief Reset the delay. - * \param d change the delay value. This can be a positive or - * negative value. - */ - virtual void set_dly(int d) = 0; - }; + /*! + * \brief Reset the delay. + * \param d change the delay value. This can be a positive or + * negative value. + */ + virtual void set_dly(int d) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_DELAY_H */ diff --git a/gr-blocks/include/gnuradio/blocks/divide.h b/gr-blocks/include/gnuradio/blocks/divide.h index 0ad62e50b4..d30e1c2cb6 100644 --- a/gr-blocks/include/gnuradio/blocks/divide.h +++ b/gr-blocks/include/gnuradio/blocks/divide.h @@ -29,31 +29,30 @@ #include <cstdint> namespace gr { - namespace blocks { - - /*! - * \brief output = input[0] / input[1] / ... / input[M-1] - * \ingroup math_operators_blk - * - * \details - * Divide across all input streams. - */ -template<class T> - class BLOCKS_API divide : virtual public sync_block - { - public: - - // gr::blocks::divide::sptr - typedef boost::shared_ptr< divide<T> > sptr; - - static sptr make(size_t vlen=1); - }; +namespace blocks { + +/*! + * \brief output = input[0] / input[1] / ... / input[M-1] + * \ingroup math_operators_blk + * + * \details + * Divide across all input streams. + */ +template <class T> +class BLOCKS_API divide : virtual public sync_block +{ +public: + // gr::blocks::divide::sptr + typedef boost::shared_ptr<divide<T>> sptr; + + static sptr make(size_t vlen = 1); +}; typedef divide<std::int16_t> divide_ss; typedef divide<std::int32_t> divide_ii; typedef divide<float> divide_ff; typedef divide<gr_complex> divide_cc; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* DIVIDE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/endian_swap.h b/gr-blocks/include/gnuradio/blocks/endian_swap.h index 379ee734c7..91338e718c 100644 --- a/gr-blocks/include/gnuradio/blocks/endian_swap.h +++ b/gr-blocks/include/gnuradio/blocks/endian_swap.h @@ -27,28 +27,28 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of items into their byte swapped version + * \ingroup stream_operators_blk + */ +class BLOCKS_API endian_swap : virtual public sync_block +{ +public: + // gr::blocks::endian_swap::sptr + typedef boost::shared_ptr<endian_swap> sptr; /*! - * \brief Convert stream of items into their byte swapped version - * \ingroup stream_operators_blk + * Make an endian swap block. + * + * \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 sync_block - { - public: - // gr::blocks::endian_swap::sptr - typedef boost::shared_ptr<endian_swap> sptr; - - /*! - * Make an endian swap block. - * - * \param item_size_bytes number of bytes per item, 1=no-op, - * 2=uint16_t, 4=uint32_t, 8=uint64_t - */ - static sptr make(size_t item_size_bytes=1); - }; + static sptr make(size_t item_size_bytes = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_ENDIAN_SWAP_H */ diff --git a/gr-blocks/include/gnuradio/blocks/exponentiate_const_cci.h b/gr-blocks/include/gnuradio/blocks/exponentiate_const_cci.h index 0d96c645cf..c0a897f394 100644 --- a/gr-blocks/include/gnuradio/blocks/exponentiate_const_cci.h +++ b/gr-blocks/include/gnuradio/blocks/exponentiate_const_cci.h @@ -28,39 +28,38 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Exponentiates a complex stream with an integer exponent - * \ingroup blocks - * - * \details - * This block raises a complex stream to an integer exponent. The exponent - * must be at least 1. There is a callback function so the exponent can be - * changed at runtime. - * - * NOTE: The algorithm uses iterative multiplication to achieve exponentiation, - * hence it is O(exponent). Therefore, this block could be inefficient for large - * exponents. - */ - class BLOCKS_API exponentiate_const_cci : virtual public gr::sync_block - { - public: - typedef boost::shared_ptr<exponentiate_const_cci> sptr; +/*! + * \brief Exponentiates a complex stream with an integer exponent + * \ingroup blocks + * + * \details + * This block raises a complex stream to an integer exponent. The exponent + * must be at least 1. There is a callback function so the exponent can be + * changed at runtime. + * + * NOTE: The algorithm uses iterative multiplication to achieve exponentiation, + * hence it is O(exponent). Therefore, this block could be inefficient for large + * exponents. + */ +class BLOCKS_API exponentiate_const_cci : virtual public gr::sync_block +{ +public: + typedef boost::shared_ptr<exponentiate_const_cci> sptr; - /* - * \param exponent Exponent the input stream is raised to, which must be an integer. - * The algorithm uses iterative multiplication to achieve exponentiation, hence it is - * O(exponent). Therefore, this block could be inefficient for large exponents. - * \param vlen Vector length of input/output stream - */ - static sptr make(int exponent, size_t vlen = 1); + /* + * \param exponent Exponent the input stream is raised to, which must be an integer. + * The algorithm uses iterative multiplication to achieve exponentiation, hence it is + * O(exponent). Therefore, this block could be inefficient for large exponents. + * \param vlen Vector length of input/output stream + */ + static sptr make(int exponent, size_t vlen = 1); - virtual void set_exponent(int exponent) = 0; - }; + virtual void set_exponent(int exponent) = 0; +}; - } // namespace blocks +} // namespace blocks } // namespace gr #endif /* INCLUDED_BLOCKS_EXPONENTIATE_CONST_CCI_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/file_descriptor_sink.h b/gr-blocks/include/gnuradio/blocks/file_descriptor_sink.h index 6399aec854..2613ef8bf8 100644 --- a/gr-blocks/include/gnuradio/blocks/file_descriptor_sink.h +++ b/gr-blocks/include/gnuradio/blocks/file_descriptor_sink.h @@ -27,29 +27,29 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Write stream to file descriptor. + * \ingroup file_operators_blk + */ +class BLOCKS_API file_descriptor_sink : virtual public sync_block +{ +public: + // gr::blocks::file_descriptor_sink::sptr + typedef boost::shared_ptr<file_descriptor_sink> sptr; /*! - * \brief Write stream to file descriptor. - * \ingroup file_operators_blk + * Build a file descriptor sink block. The provided file descriptor will + * be closed when the sink is destroyed. + * + * \param itemsize item size of the incoming data stream. + * \param fd file descriptor (as an integer). */ - class BLOCKS_API file_descriptor_sink : virtual public sync_block - { - public: - // gr::blocks::file_descriptor_sink::sptr - typedef boost::shared_ptr<file_descriptor_sink> sptr; - - /*! - * Build a file descriptor sink block. The provided file descriptor will - * be closed when the sink is destroyed. - * - * \param itemsize item size of the incoming data stream. - * \param fd file descriptor (as an integer). - */ - static sptr make(size_t itemsize, int fd); - }; + static sptr make(size_t itemsize, int fd); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_FILE_DESCRIPTOR_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_descriptor_source.h b/gr-blocks/include/gnuradio/blocks/file_descriptor_source.h index d78b10a84f..12f03bb84d 100644 --- a/gr-blocks/include/gnuradio/blocks/file_descriptor_source.h +++ b/gr-blocks/include/gnuradio/blocks/file_descriptor_source.h @@ -28,35 +28,35 @@ namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Read stream from file descriptor. + * \ingroup file_operators_blk + */ +class BLOCKS_API file_descriptor_source : virtual public sync_block +{ +protected: + virtual int read_items(char* buf, int nitems) = 0; + virtual int handle_residue(char* buf, int nbytes_read) = 0; + virtual void flush_residue() = 0; + +public: + // gr::blocks::file_descriptor_source::sptr + typedef boost::shared_ptr<file_descriptor_source> sptr; /*! - * \brief Read stream from file descriptor. - * \ingroup file_operators_blk + * Build a file descriptor source block. The provided file descriptor will + * be closed when the sink is destroyed. + * + * \param itemsize item size of the incoming data stream. + * \param fd file descriptor (as an integer). + * \param repeat repeat the data stream continuously. */ - class BLOCKS_API file_descriptor_source : virtual public sync_block - { - protected: - virtual int read_items(char *buf, int nitems) = 0; - virtual int handle_residue(char *buf, int nbytes_read) = 0; - virtual void flush_residue() = 0; - - public: - // gr::blocks::file_descriptor_source::sptr - typedef boost::shared_ptr<file_descriptor_source> sptr; - - /*! - * Build a file descriptor source block. The provided file descriptor will - * be closed when the sink is destroyed. - * - * \param itemsize item size of the incoming data stream. - * \param fd file descriptor (as an integer). - * \param repeat repeat the data stream continuously. - */ - static sptr make(size_t itemsize, int fd, bool repeat=false); - }; - - } /* namespace blocks */ + static sptr make(size_t itemsize, int fd, bool repeat = false); +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_meta_sink.h b/gr-blocks/include/gnuradio/blocks/file_meta_sink.h index 36d44b545a..f967ea042c 100644 --- a/gr-blocks/include/gnuradio/blocks/file_meta_sink.h +++ b/gr-blocks/include/gnuradio/blocks/file_meta_sink.h @@ -27,89 +27,89 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { - const char METADATA_VERSION = 0; - const size_t METADATA_HEADER_SIZE = 149; +const char METADATA_VERSION = 0; +const size_t METADATA_HEADER_SIZE = 149; - enum gr_file_types { - GR_FILE_BYTE=0, - GR_FILE_CHAR=0, - GR_FILE_SHORT=1, - GR_FILE_INT, - GR_FILE_LONG, - GR_FILE_LONG_LONG, - GR_FILE_FLOAT, - GR_FILE_DOUBLE, - }; +enum gr_file_types { + GR_FILE_BYTE = 0, + GR_FILE_CHAR = 0, + GR_FILE_SHORT = 1, + GR_FILE_INT, + GR_FILE_LONG, + GR_FILE_LONG_LONG, + GR_FILE_FLOAT, + GR_FILE_DOUBLE, +}; + +/*! + * \brief Write stream to file with meta-data headers. + * \ingroup file_operators_blk + * + * \details + * These files represent data as binary information in between + * meta-data headers. The headers contain information about the + * type of data and properties of the data in the next segment of + * samples. The information includes: + * + * \li rx_rate (double): sample rate of data. + * \li rx_time (uint64_t, double): time stamp of first sample in segment. + * \li size (uint32_t): item size in bytes. + * \li type (::gr_file_types as int32_t): data type. + * \li cplx (bool): Is data complex? + * \li strt (uint64_t): Starting byte of data in this segment. + * \li bytes (uint64_t): Size in bytes of data in this segment. + * + * Tags can be sent to the file to update the information, which + * will create a new header. Headers are found by searching from + * the first header (at position 0 in the file) and reading where + * the data segment starts plus the data segment size. Following + * will either be a new header or EOF. + */ +class BLOCKS_API file_meta_sink : virtual public sync_block +{ +public: + // gr::blocks::file_meta_sink::sptr + typedef boost::shared_ptr<file_meta_sink> sptr; /*! - * \brief Write stream to file with meta-data headers. - * \ingroup file_operators_blk - * - * \details - * These files represent data as binary information in between - * meta-data headers. The headers contain information about the - * type of data and properties of the data in the next segment of - * samples. The information includes: + * \brief Create a meta-data file sink. * - * \li rx_rate (double): sample rate of data. - * \li rx_time (uint64_t, double): time stamp of first sample in segment. - * \li size (uint32_t): item size in bytes. - * \li type (::gr_file_types as int32_t): data type. - * \li cplx (bool): Is data complex? - * \li strt (uint64_t): Starting byte of data in this segment. - * \li bytes (uint64_t): Size in bytes of data in this segment. - * - * Tags can be sent to the file to update the information, which - * will create a new header. Headers are found by searching from - * the first header (at position 0 in the file) and reading where - * the data segment starts plus the data segment size. Following - * will either be a new header or EOF. + * \param itemsize (size_t): Size of data type. + * \param filename (string): Name of file to write data to. + * \param samp_rate (double): Sample rate of data. If sample rate will be + * set by a tag, such as rx_tag from a UHD source, this is + * basically ignored. + * \param relative_rate (double): Rate chance from source of sample + * rate tag to sink. + * \param type (gr_file_types): Data type (int, float, etc.) + * \param complex (bool): If data stream is complex + * \param max_segment_size (size_t): Length of a single segment + * before the header is repeated (in items). + * \param extra_dict: a PMT dictionary of extra + * information. + * \param detached_header (bool): Set to true to store the header + * info in a separate file (named filename.hdr) */ - class BLOCKS_API file_meta_sink : virtual public sync_block - { - public: - // gr::blocks::file_meta_sink::sptr - typedef boost::shared_ptr<file_meta_sink> sptr; - - /*! - * \brief Create a meta-data file sink. - * - * \param itemsize (size_t): Size of data type. - * \param filename (string): Name of file to write data to. - * \param samp_rate (double): Sample rate of data. If sample rate will be - * set by a tag, such as rx_tag from a UHD source, this is - * basically ignored. - * \param relative_rate (double): Rate chance from source of sample - * rate tag to sink. - * \param type (gr_file_types): Data type (int, float, etc.) - * \param complex (bool): If data stream is complex - * \param max_segment_size (size_t): Length of a single segment - * before the header is repeated (in items). - * \param extra_dict: a PMT dictionary of extra - * information. - * \param detached_header (bool): Set to true to store the header - * info in a separate file (named filename.hdr) - */ - static sptr make(size_t itemsize, - const std::string &filename, - double samp_rate=1, - double relative_rate=1, - gr_file_types type=GR_FILE_FLOAT, - bool complex=true, - size_t max_segment_size=1000000, - pmt::pmt_t extra_dict=pmt::make_dict(), - bool detached_header=false); + static sptr make(size_t itemsize, + const std::string& filename, + double samp_rate = 1, + double relative_rate = 1, + gr_file_types type = GR_FILE_FLOAT, + bool complex = true, + size_t max_segment_size = 1000000, + pmt::pmt_t extra_dict = pmt::make_dict(), + bool detached_header = false); - virtual bool open(const std::string &filename) = 0; - virtual void close() = 0; - virtual void do_update() = 0; + virtual bool open(const std::string& filename) = 0; + virtual void close() = 0; + virtual void do_update() = 0; - virtual void set_unbuffered(bool unbuffered) = 0; - }; + virtual void set_unbuffered(bool unbuffered) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_FILE_META_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_meta_source.h b/gr-blocks/include/gnuradio/blocks/file_meta_source.h index 57bac1eca1..fef90e473d 100644 --- a/gr-blocks/include/gnuradio/blocks/file_meta_source.h +++ b/gr-blocks/include/gnuradio/blocks/file_meta_source.h @@ -27,56 +27,56 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Reads stream from file with meta-data headers. Headers + * are parsed into tags. + * \ingroup file_operators_blk + * + * \details + * The information in the metadata headers includes: + * + * \li rx_rate (double): sample rate of data. + * \li rx_time (uint64_t, double): time stamp of first sample in segment. + * \li size (uint32_t): item size in bytes. + * \li type (::gr_file_types as int32_t): data type. + * \li cplx (bool): Is data complex? + * \li strt (uint64_t): Starting byte of data in this segment. + * \li bytes (uint64_t): Size in bytes of data in this segment. + * + * Any item inside of the extra header dictionary is ready out and + * made into a stream tag. + */ +class BLOCKS_API file_meta_source : virtual public sync_block +{ +public: + // gr::blocks::file_meta_source::sptr + typedef boost::shared_ptr<file_meta_source> sptr; /*! - * \brief Reads stream from file with meta-data headers. Headers - * are parsed into tags. - * \ingroup file_operators_blk - * - * \details - * The information in the metadata headers includes: + * \brief Create a meta-data file source. * - * \li rx_rate (double): sample rate of data. - * \li rx_time (uint64_t, double): time stamp of first sample in segment. - * \li size (uint32_t): item size in bytes. - * \li type (::gr_file_types as int32_t): data type. - * \li cplx (bool): Is data complex? - * \li strt (uint64_t): Starting byte of data in this segment. - * \li bytes (uint64_t): Size in bytes of data in this segment. - * - * Any item inside of the extra header dictionary is ready out and - * made into a stream tag. + * \param filename (string): Name of file to write data to. + * \param repeat (bool): Repeats file when EOF is found. + * \param detached_header (bool): Set to true if header + * info is stored in a separate file (usually named filename.hdr) + * \param hdr_filename (string): Name of detached header file if used. + * Defaults to 'filename.hdr' if detached_header is true but this + * field is an empty string. */ - class BLOCKS_API file_meta_source : virtual public sync_block - { - public: - // gr::blocks::file_meta_source::sptr - typedef boost::shared_ptr<file_meta_source> sptr; - - /*! - * \brief Create a meta-data file source. - * - * \param filename (string): Name of file to write data to. - * \param repeat (bool): Repeats file when EOF is found. - * \param detached_header (bool): Set to true if header - * info is stored in a separate file (usually named filename.hdr) - * \param hdr_filename (string): Name of detached header file if used. - * Defaults to 'filename.hdr' if detached_header is true but this - * field is an empty string. - */ - static sptr make(const std::string &filename, - bool repeat=false, - bool detached_header=false, - const std::string &hdr_filename=""); + static sptr make(const std::string& filename, + bool repeat = false, + bool detached_header = false, + const std::string& hdr_filename = ""); - virtual bool open(const std::string &filename, - const std::string &hdr_filename="") = 0; - virtual void close() = 0; - virtual void do_update() = 0; - }; + virtual bool open(const std::string& filename, + const std::string& hdr_filename = "") = 0; + virtual void close() = 0; + virtual void do_update() = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_FILE_META_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_sink.h b/gr-blocks/include/gnuradio/blocks/file_sink.h index 177964682d..43d77213ed 100644 --- a/gr-blocks/include/gnuradio/blocks/file_sink.h +++ b/gr-blocks/include/gnuradio/blocks/file_sink.h @@ -28,30 +28,29 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Write stream to file. + * \ingroup file_operators_blk + */ +class BLOCKS_API file_sink : virtual public sync_block, virtual public file_sink_base +{ +public: + // gr::blocks::file_sink::sptr + typedef boost::shared_ptr<file_sink> sptr; /*! - * \brief Write stream to file. - * \ingroup file_operators_blk + * \brief Make a file sink. + * \param itemsize size of the input data items. + * \param filename name of the file to open and write output to. + * \param append if true, data is appended to the file instead of + * overwriting the initial content. */ - class BLOCKS_API file_sink : virtual public sync_block, - virtual public file_sink_base - { - public: - // gr::blocks::file_sink::sptr - typedef boost::shared_ptr<file_sink> sptr; - - /*! - * \brief Make a file sink. - * \param itemsize size of the input data items. - * \param filename name of the file to open and write output to. - * \param append if true, data is appended to the file instead of - * overwriting the initial content. - */ - static sptr make(size_t itemsize, const char *filename, bool append=false); - }; + static sptr make(size_t itemsize, const char* filename, bool append = false); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_FILE_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_sink_base.h b/gr-blocks/include/gnuradio/blocks/file_sink_base.h index 253b5ea122..fa62cb4972 100644 --- a/gr-blocks/include/gnuradio/blocks/file_sink_base.h +++ b/gr-blocks/include/gnuradio/blocks/file_sink_base.h @@ -28,54 +28,54 @@ #include <cstdio> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Common base class for file sinks - */ - class BLOCKS_API file_sink_base - { - protected: - FILE *d_fp; // current FILE pointer - FILE *d_new_fp; // new FILE pointer - bool d_updated; // is there a new FILE pointer? - bool d_is_binary; - boost::mutex d_mutex; - bool d_unbuffered; - bool d_append; +/*! + * \brief Common base class for file sinks + */ +class BLOCKS_API file_sink_base +{ +protected: + FILE* d_fp; // current FILE pointer + FILE* d_new_fp; // new FILE pointer + bool d_updated; // is there a new FILE pointer? + bool d_is_binary; + boost::mutex d_mutex; + bool d_unbuffered; + bool d_append; - protected: - file_sink_base(const char *filename, bool is_binary, bool append); +protected: + file_sink_base(const char* filename, bool is_binary, bool append); - public: - file_sink_base() {} - ~file_sink_base(); +public: + file_sink_base() {} + ~file_sink_base(); - /*! - * \brief Open filename and begin output to it. - */ - bool open(const char *filename); + /*! + * \brief Open filename and begin output to it. + */ + bool open(const char* filename); - /*! - * \brief Close current output file. - * - * Closes current output file and ignores any output until - * open is called to connect to another file. - */ - void close(); + /*! + * \brief Close current output file. + * + * Closes current output file and ignores any output until + * open is called to connect to another file. + */ + void close(); - /*! - * \brief if we've had an update, do it now. - */ - void do_update(); + /*! + * \brief if we've had an update, do it now. + */ + void do_update(); - /*! - * \brief turn on unbuffered writes for slower outputs - */ - void set_unbuffered(bool unbuffered); - }; + /*! + * \brief turn on unbuffered writes for slower outputs + */ + void set_unbuffered(bool unbuffered); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_FILE_SINK_BASE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_source.h b/gr-blocks/include/gnuradio/blocks/file_source.h index bb1ea84a8a..f8ed700e5c 100644 --- a/gr-blocks/include/gnuradio/blocks/file_source.h +++ b/gr-blocks/include/gnuradio/blocks/file_source.h @@ -27,73 +27,76 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Read stream from file + * \ingroup file_operators_blk + */ +class BLOCKS_API file_source : virtual public sync_block +{ +public: + // gr::blocks::file_source::sptr + typedef boost::shared_ptr<file_source> sptr; /*! - * \brief Read stream from file - * \ingroup file_operators_blk + * \brief Create a file source. + * + * Opens \p filename as a source of items into a flowgraph. The + * data is expected to be in binary format, item after item. The + * \p itemsize of the block determines the conversion from bits + * to items. The first \p offset items (default 0) will be + * skipped. + * + * If \p repeat is turned on, the file will repeat the file after + * it's reached the end. + * + * If \p len is non-zero, only items (offset, offset+len) will + * be produced. + * + * \param itemsize the size of each item in the file, in bytes + * \param filename name of the file to source from + * \param repeat repeat file from start + * \param offset begin this many items into file + * \param len produce only items (offset, offset+len) */ - class BLOCKS_API file_source : virtual public sync_block - { - public: - - // gr::blocks::file_source::sptr - typedef boost::shared_ptr<file_source> sptr; + static sptr make(size_t itemsize, + const char* filename, + bool repeat = false, + uint64_t offset = 0, + uint64_t len = 0); - /*! - * \brief Create a file source. - * - * Opens \p filename as a source of items into a flowgraph. The - * data is expected to be in binary format, item after item. The - * \p itemsize of the block determines the conversion from bits - * to items. The first \p offset items (default 0) will be - * skipped. - * - * If \p repeat is turned on, the file will repeat the file after - * it's reached the end. - * - * If \p len is non-zero, only items (offset, offset+len) will - * be produced. - * - * \param itemsize the size of each item in the file, in bytes - * \param filename name of the file to source from - * \param repeat repeat file from start - * \param offset begin this many items into file - * \param len produce only items (offset, offset+len) - */ - static sptr make(size_t itemsize, const char *filename, bool repeat = false, - uint64_t offset = 0, uint64_t len = 0); - - /*! - * \brief seek file to \p seek_point relative to \p whence - * - * \param seek_point sample offset in file - * \param whence one of SEEK_SET, SEEK_CUR, SEEK_END (man fseek) - */ - virtual bool seek(int64_t seek_point, int whence) = 0; + /*! + * \brief seek file to \p seek_point relative to \p whence + * + * \param seek_point sample offset in file + * \param whence one of SEEK_SET, SEEK_CUR, SEEK_END (man fseek) + */ + virtual bool seek(int64_t seek_point, int whence) = 0; - /*! - * \brief Opens a new file. - * - * \param filename name of the file to source from - * \param repeat repeat file from start - * \param offset begin this many items into file - * \param len produce only items [offset, offset+len) - */ - virtual void open(const char *filename, bool repeat, uint64_t offset = 0, uint64_t len = 0) = 0; + /*! + * \brief Opens a new file. + * + * \param filename name of the file to source from + * \param repeat repeat file from start + * \param offset begin this many items into file + * \param len produce only items [offset, offset+len) + */ + virtual void + open(const char* filename, bool repeat, uint64_t offset = 0, uint64_t len = 0) = 0; - /*! - * \brief Close the file handle. - */ - virtual void close() = 0; + /*! + * \brief Close the file handle. + */ + virtual void close() = 0; - /*! - * \brief Add a stream tag to the first sample of the file if true - */ - virtual void set_begin_tag(pmt::pmt_t val) = 0; - }; + /*! + * \brief Add a stream tag to the first sample of the file if true + */ + virtual void set_begin_tag(pmt::pmt_t val) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_FILE_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/float_to_char.h b/gr-blocks/include/gnuradio/blocks/float_to_char.h index f5dcd4363e..12eb2bb3b6 100644 --- a/gr-blocks/include/gnuradio/blocks/float_to_char.h +++ b/gr-blocks/include/gnuradio/blocks/float_to_char.h @@ -27,38 +27,38 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of floats to a stream of char + * \ingroup type_converters_blk + */ +class BLOCKS_API float_to_char : virtual public sync_block +{ +public: + // gr::blocks::float_to_char_ff::sptr + typedef boost::shared_ptr<float_to_char> sptr; /*! - * \brief Convert stream of floats to a stream of char - * \ingroup type_converters_blk + * Build a float to char block. + * + * \param vlen vector length of data streams. + * \param scale a scalar multiplier to change the output signal scale. */ - class BLOCKS_API float_to_char : virtual public sync_block - { - public: - // gr::blocks::float_to_char_ff::sptr - typedef boost::shared_ptr<float_to_char> sptr; + static sptr make(size_t vlen = 1, float scale = 1.0); - /*! - * Build a float to char block. - * - * \param vlen vector length of data streams. - * \param scale a scalar multiplier to change the output signal scale. - */ - static sptr make(size_t vlen=1, float scale=1.0); - - /*! - * Get the scalar multiplier value. - */ - virtual float scale() const = 0; + /*! + * Get the scalar multiplier value. + */ + virtual float scale() const = 0; - /*! - * Set the scalar multiplier value. - */ - virtual void set_scale(float scale) = 0; - }; + /*! + * Set the scalar multiplier value. + */ + virtual void set_scale(float scale) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_FLOAT_TO_CHAR_H */ diff --git a/gr-blocks/include/gnuradio/blocks/float_to_complex.h b/gr-blocks/include/gnuradio/blocks/float_to_complex.h index 03de245f70..5b6438472c 100644 --- a/gr-blocks/include/gnuradio/blocks/float_to_complex.h +++ b/gr-blocks/include/gnuradio/blocks/float_to_complex.h @@ -27,27 +27,27 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief one or two floats in, complex out + * \ingroup type_converters_blk + */ +class BLOCKS_API float_to_complex : virtual public sync_block +{ +public: + // gr::blocks::float_to_complex_ff::sptr + typedef boost::shared_ptr<float_to_complex> sptr; /*! - * \brief one or two floats in, complex out - * \ingroup type_converters_blk + * Build a float to complex block. + * + * \param vlen vector len (default 1) */ - class BLOCKS_API float_to_complex : virtual public sync_block - { - public: - // gr::blocks::float_to_complex_ff::sptr - typedef boost::shared_ptr<float_to_complex> sptr; - - /*! - * Build a float to complex block. - * - * \param vlen vector len (default 1) - */ - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_FLOAT_TO_COMPLEX_H */ diff --git a/gr-blocks/include/gnuradio/blocks/float_to_int.h b/gr-blocks/include/gnuradio/blocks/float_to_int.h index 71e26d6f90..f49d4b54f4 100644 --- a/gr-blocks/include/gnuradio/blocks/float_to_int.h +++ b/gr-blocks/include/gnuradio/blocks/float_to_int.h @@ -27,38 +27,38 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of floats to a stream of ints. + * \ingroup type_converters_blk + */ +class BLOCKS_API float_to_int : virtual public sync_block +{ +public: + // gr::blocks::float_to_int_ff::sptr + typedef boost::shared_ptr<float_to_int> sptr; /*! - * \brief Convert stream of floats to a stream of ints. - * \ingroup type_converters_blk + * Build a float to int block. + * + * \param vlen vector length of data streams. + * \param scale a scalar multiplier to change the output signal scale. */ - class BLOCKS_API float_to_int : virtual public sync_block - { - public: - // gr::blocks::float_to_int_ff::sptr - typedef boost::shared_ptr<float_to_int> sptr; + static sptr make(size_t vlen = 1, float scale = 1.0); - /*! - * Build a float to int block. - * - * \param vlen vector length of data streams. - * \param scale a scalar multiplier to change the output signal scale. - */ - static sptr make(size_t vlen=1, float scale=1.0); - - /*! - * Get the scalar multiplier value. - */ - virtual float scale() const = 0; + /*! + * Get the scalar multiplier value. + */ + virtual float scale() const = 0; - /*! - * Set the scalar multiplier value. - */ - virtual void set_scale(float scale) = 0; - }; + /*! + * Set the scalar multiplier value. + */ + virtual void set_scale(float scale) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_FLOAT_TO_INT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/float_to_short.h b/gr-blocks/include/gnuradio/blocks/float_to_short.h index 48426dde14..62339f5b05 100644 --- a/gr-blocks/include/gnuradio/blocks/float_to_short.h +++ b/gr-blocks/include/gnuradio/blocks/float_to_short.h @@ -27,38 +27,38 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of floats to a stream of shorts + * \ingroup type_converters_blk + */ +class BLOCKS_API float_to_short : virtual public sync_block +{ +public: + // gr::blocks::float_to_short_ff::sptr + typedef boost::shared_ptr<float_to_short> sptr; /*! - * \brief Convert stream of floats to a stream of shorts - * \ingroup type_converters_blk + * Build a float to short block. + * + * \param vlen vector length of data streams. + * \param scale a scalar multiplier to change the output signal scale. */ - class BLOCKS_API float_to_short : virtual public sync_block - { - public: - // gr::blocks::float_to_short_ff::sptr - typedef boost::shared_ptr<float_to_short> sptr; + static sptr make(size_t vlen = 1, float scale = 1.0); - /*! - * Build a float to short block. - * - * \param vlen vector length of data streams. - * \param scale a scalar multiplier to change the output signal scale. - */ - static sptr make(size_t vlen=1, float scale=1.0); - - /*! - * Get the scalar multiplier value. - */ - virtual float scale() const = 0; + /*! + * Get the scalar multiplier value. + */ + virtual float scale() const = 0; - /*! - * Set the scalar multiplier value. - */ - virtual void set_scale(float scale) = 0; - }; + /*! + * Set the scalar multiplier value. + */ + virtual void set_scale(float scale) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_FLOAT_TO_SHORT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/float_to_uchar.h b/gr-blocks/include/gnuradio/blocks/float_to_uchar.h index 26189ac981..2d9f3afc02 100644 --- a/gr-blocks/include/gnuradio/blocks/float_to_uchar.h +++ b/gr-blocks/include/gnuradio/blocks/float_to_uchar.h @@ -27,26 +27,25 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of floats to a stream of unsigned chars + * \ingroup type_converters_blk + */ +class BLOCKS_API float_to_uchar : virtual public sync_block +{ +public: + // gr::blocks::float_to_uchar_ff::sptr + typedef boost::shared_ptr<float_to_uchar> sptr; /*! - * \brief Convert stream of floats to a stream of unsigned chars - * \ingroup type_converters_blk + * Build a float to uchar block. */ - class BLOCKS_API float_to_uchar : virtual public sync_block - { - public: - - // gr::blocks::float_to_uchar_ff::sptr - typedef boost::shared_ptr<float_to_uchar> sptr; - - /*! - * Build a float to uchar block. - */ - static sptr make(); - }; + static sptr make(); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_FLOAT_TO_UCHAR_H */ diff --git a/gr-blocks/include/gnuradio/blocks/head.h b/gr-blocks/include/gnuradio/blocks/head.h index a41137c023..6096c5dfe2 100644 --- a/gr-blocks/include/gnuradio/blocks/head.h +++ b/gr-blocks/include/gnuradio/blocks/head.h @@ -25,32 +25,31 @@ #include <gnuradio/blocks/api.h> #include <gnuradio/sync_block.h> -#include <stddef.h> // size_t +#include <stddef.h> // size_t namespace gr { - namespace blocks { - - /*! - * \brief copies the first N items to the output then signals done - * \ingroup misc_blk - * - * \details - * Useful for building test cases - */ - class BLOCKS_API head : virtual public 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(uint64_t nitems) = 0; - }; - - } /* namespace blocks */ +namespace blocks { + +/*! + * \brief copies the first N items to the output then signals done + * \ingroup misc_blk + * + * \details + * Useful for building test cases + */ +class BLOCKS_API head : virtual public 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(uint64_t nitems) = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_HEAD_H */ diff --git a/gr-blocks/include/gnuradio/blocks/int_to_float.h b/gr-blocks/include/gnuradio/blocks/int_to_float.h index b8075f2df8..89aeb02fa0 100644 --- a/gr-blocks/include/gnuradio/blocks/int_to_float.h +++ b/gr-blocks/include/gnuradio/blocks/int_to_float.h @@ -27,38 +27,38 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of ints to a stream of floats. + * \ingroup type_converters_blk + */ +class BLOCKS_API int_to_float : virtual public sync_block +{ +public: + // gr::blocks::int_to_float_ff::sptr + typedef boost::shared_ptr<int_to_float> sptr; /*! - * \brief Convert stream of ints to a stream of floats. - * \ingroup type_converters_blk + * Build an int to float block. + * + * \param vlen vector length of data streams. + * \param scale a scalar divider to change the output signal scale. */ - class BLOCKS_API int_to_float : virtual public sync_block - { - public: - // gr::blocks::int_to_float_ff::sptr - typedef boost::shared_ptr<int_to_float> sptr; + static sptr make(size_t vlen = 1, float scale = 1.0); - /*! - * Build an int to float block. - * - * \param vlen vector length of data streams. - * \param scale a scalar divider to change the output signal scale. - */ - static sptr make(size_t vlen=1, float scale=1.0); - - /*! - * Get the scalar divider value. - */ - virtual float scale() const = 0; + /*! + * Get the scalar divider value. + */ + virtual float scale() const = 0; - /*! - * Set the scalar divider value. - */ - virtual void set_scale(float scale) = 0; - }; + /*! + * Set the scalar divider value. + */ + virtual void set_scale(float scale) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_INT_TO_FLOAT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/integrate.h b/gr-blocks/include/gnuradio/blocks/integrate.h index 0eef4bfd34..bf9b6959a5 100644 --- a/gr-blocks/include/gnuradio/blocks/integrate.h +++ b/gr-blocks/include/gnuradio/blocks/integrate.h @@ -29,28 +29,27 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Integrate successive samples and decimate - * \ingroup math_operators_blk - */ -template<class T> - class BLOCKS_API integrate : virtual public sync_decimator - { - public: - - // gr::blocks::integrate::sptr - typedef boost::shared_ptr< integrate<T> > sptr; +/*! + * \brief Integrate successive samples and decimate + * \ingroup math_operators_blk + */ +template <class T> +class BLOCKS_API integrate : virtual public sync_decimator +{ +public: + // gr::blocks::integrate::sptr + typedef boost::shared_ptr<integrate<T>> sptr; - static sptr make(int decim, unsigned int vlen = 1); - }; + static sptr make(int decim, unsigned int vlen = 1); +}; typedef integrate<std::int16_t> integrate_ss; typedef integrate<std::int32_t> integrate_ii; typedef integrate<float> integrate_ff; typedef integrate<gr_complex> integrate_cc; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INTEGRATE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/interleave.h b/gr-blocks/include/gnuradio/blocks/interleave.h index 5de75fcce4..8b4be52b26 100644 --- a/gr-blocks/include/gnuradio/blocks/interleave.h +++ b/gr-blocks/include/gnuradio/blocks/interleave.h @@ -27,52 +27,52 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief interleave N inputs into a single output + * \ingroup stream_operators_blk + * + * \details + * + * This block interleaves blocks of samples. For each input + * connection, the samples are interleaved successively to the + * output connection. By default, the block interleaves a single + * sample from each input to the output unless blocksize is given + * in the constructor. + * + * \code + * blocksize = 1 + * connections = 2 + * input[0] = [a, c, e, g] + * input[1] = [b, d, f, h] + * output = [a, b, c, d, e, f, g, h] + * \endcode + * + * \code + * blocksize = 2 + * connections = 2 + * input[0] = [a, b, e, f] + * input[1] = [c, d, g, h] + * output = [a, b, c, d, e, f, g, h] + * \endcode + */ +class BLOCKS_API interleave : virtual public block +{ +public: + // gr::blocks::interleave::sptr + typedef boost::shared_ptr<interleave> sptr; /*! - * \brief interleave N inputs into a single output - * \ingroup stream_operators_blk - * - * \details - * - * This block interleaves blocks of samples. For each input - * connection, the samples are interleaved successively to the - * output connection. By default, the block interleaves a single - * sample from each input to the output unless blocksize is given - * in the constructor. + * Make a stream interleave block. * - * \code - * blocksize = 1 - * connections = 2 - * input[0] = [a, c, e, g] - * input[1] = [b, d, f, h] - * output = [a, b, c, d, e, f, g, h] - * \endcode - * - * \code - * blocksize = 2 - * connections = 2 - * input[0] = [a, b, e, f] - * input[1] = [c, d, g, h] - * output = [a, b, c, d, e, f, g, h] - * \endcode + * \param itemsize stream itemsize + * \param blocksize size of block of samples to interleave */ - class BLOCKS_API interleave : virtual public block - { - public: - // gr::blocks::interleave::sptr - typedef boost::shared_ptr<interleave> sptr; - - /*! - * Make a stream interleave block. - * - * \param itemsize stream itemsize - * \param blocksize size of block of samples to interleave - */ - static sptr make(size_t itemsize, unsigned int blocksize = 1); - }; + static sptr make(size_t itemsize, unsigned int blocksize = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_INTERLEAVE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/interleaved_char_to_complex.h b/gr-blocks/include/gnuradio/blocks/interleaved_char_to_complex.h index 53a77e7cd0..29b2d14699 100644 --- a/gr-blocks/include/gnuradio/blocks/interleaved_char_to_complex.h +++ b/gr-blocks/include/gnuradio/blocks/interleaved_char_to_complex.h @@ -27,25 +27,25 @@ #include <gnuradio/sync_decimator.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of interleaved chars to a stream of complex + * \ingroup type_converters_blk + */ +class BLOCKS_API interleaved_char_to_complex : virtual public sync_decimator +{ +public: + // gr::blocks::interleaved_char_to_complex::sptr + typedef boost::shared_ptr<interleaved_char_to_complex> sptr; /*! - * \brief Convert stream of interleaved chars to a stream of complex - * \ingroup type_converters_blk + * Build an interleaved char to complex block. */ - class BLOCKS_API interleaved_char_to_complex : virtual public sync_decimator - { - public: - // gr::blocks::interleaved_char_to_complex::sptr - typedef boost::shared_ptr<interleaved_char_to_complex> sptr; - - /*! - * Build an interleaved char to complex block. - */ - static sptr make(bool vector_input=false); - }; + static sptr make(bool vector_input = false); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_INTERLEAVED_CHAR_TO_COMPLEX_H */ diff --git a/gr-blocks/include/gnuradio/blocks/interleaved_short_to_complex.h b/gr-blocks/include/gnuradio/blocks/interleaved_short_to_complex.h index fee4352b71..7e15d99ed2 100644 --- a/gr-blocks/include/gnuradio/blocks/interleaved_short_to_complex.h +++ b/gr-blocks/include/gnuradio/blocks/interleaved_short_to_complex.h @@ -27,27 +27,27 @@ #include <gnuradio/sync_decimator.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of interleaved shorts to a stream of complex + * \ingroup type_converters_blk + */ +class BLOCKS_API interleaved_short_to_complex : virtual public sync_decimator +{ +public: + // gr::blocks::interleaved_short_to_complex::sptr + typedef boost::shared_ptr<interleaved_short_to_complex> sptr; /*! - * \brief Convert stream of interleaved shorts to a stream of complex - * \ingroup type_converters_blk + * Build an interleaved short to complex block. */ - class BLOCKS_API interleaved_short_to_complex : virtual public sync_decimator - { - public: - // gr::blocks::interleaved_short_to_complex::sptr - typedef boost::shared_ptr<interleaved_short_to_complex> sptr; - - /*! - * Build an interleaved short to complex block. - */ - static sptr make(bool vector_input=false, bool swap=false); + static sptr make(bool vector_input = false, bool swap = false); - virtual void set_swap(bool swap)=0; - }; + virtual void set_swap(bool swap) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_INTERLEAVED_SHORT_TO_COMPLEX_H */ diff --git a/gr-blocks/include/gnuradio/blocks/keep_m_in_n.h b/gr-blocks/include/gnuradio/blocks/keep_m_in_n.h index 909b62316e..38d6a3cb3f 100644 --- a/gr-blocks/include/gnuradio/blocks/keep_m_in_n.h +++ b/gr-blocks/include/gnuradio/blocks/keep_m_in_n.h @@ -27,35 +27,34 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief decimate a stream, keeping the first \p m items out of every \p n starting after + * \p offset items. \ingroup stream_operators_blk + */ +class BLOCKS_API keep_m_in_n : virtual public block +{ +public: + // gr::blocks::keep_m_in_n::sptr + typedef boost::shared_ptr<keep_m_in_n> sptr; /*! - * \brief decimate a stream, keeping the first \p m items out of every \p n starting after \p offset items. - * \ingroup stream_operators_blk + * Make a keep m in n block. + * + * \param itemsize stream itemsize + * \param m number of items to take in block of \p n items + * \param n block size in items + * \param offset initial item offset into the stream */ - class BLOCKS_API keep_m_in_n : virtual public block - { - public: - - // gr::blocks::keep_m_in_n::sptr - typedef boost::shared_ptr<keep_m_in_n> sptr; - - /*! - * Make a keep m in n block. - * - * \param itemsize stream itemsize - * \param m number of items to take in block of \p n items - * \param n block size in items - * \param offset initial item offset into the stream - */ - static sptr make(size_t itemsize, int m, int n, int offset); - - virtual void set_m(int m) = 0; - virtual void set_n(int n) = 0; - virtual void set_offset(int offset) = 0; - }; - - } /* namespace blocks */ + static sptr make(size_t itemsize, int m, int n, int offset); + + virtual void set_m(int m) = 0; + virtual void set_n(int n) = 0; + virtual void set_offset(int offset) = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_KEEP_M_IN_N_H */ diff --git a/gr-blocks/include/gnuradio/blocks/keep_one_in_n.h b/gr-blocks/include/gnuradio/blocks/keep_one_in_n.h index af5c7de7d2..f95146ca36 100644 --- a/gr-blocks/include/gnuradio/blocks/keep_one_in_n.h +++ b/gr-blocks/include/gnuradio/blocks/keep_one_in_n.h @@ -27,31 +27,30 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief decimate a stream, keeping the last item out of every \p n. + * \ingroup stream_operators_blk + */ +class BLOCKS_API keep_one_in_n : virtual public block +{ +public: + // gr::blocks::keep_one_in_n::sptr + typedef boost::shared_ptr<keep_one_in_n> sptr; /*! - * \brief decimate a stream, keeping the last item out of every \p n. - * \ingroup stream_operators_blk + * Make a keep one in n block. + * + * \param itemsize stream itemsize + * \param n block size in items */ - class BLOCKS_API keep_one_in_n : virtual public block - { - public: - - // gr::blocks::keep_one_in_n::sptr - typedef boost::shared_ptr<keep_one_in_n> sptr; - - /*! - * Make a keep one in n block. - * - * \param itemsize stream itemsize - * \param n block size in items - */ - static sptr make(size_t itemsize, int n); + static sptr make(size_t itemsize, int n); - virtual void set_n(int n) = 0; - }; + virtual void set_n(int n) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_KEEP_ONE_IN_N_H */ diff --git a/gr-blocks/include/gnuradio/blocks/lfsr_15_1_0.h b/gr-blocks/include/gnuradio/blocks/lfsr_15_1_0.h index 2ebfe08319..22c9521e3d 100644 --- a/gr-blocks/include/gnuradio/blocks/lfsr_15_1_0.h +++ b/gr-blocks/include/gnuradio/blocks/lfsr_15_1_0.h @@ -26,45 +26,45 @@ #include <gnuradio/blocks/api.h> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Linear Feedback Shift Register using primitive polynomial x^15 + x + 1 - * \ingroup misc - * - * \details - * Generates a maximal length pseudo-random sequence of length - * 2^15 - 1 bits. - */ - class BLOCKS_API lfsr_15_1_0 - { - private: - unsigned long d_sr; // shift register +/*! + * \brief Linear Feedback Shift Register using primitive polynomial x^15 + x + 1 + * \ingroup misc + * + * \details + * Generates a maximal length pseudo-random sequence of length + * 2^15 - 1 bits. + */ +class BLOCKS_API lfsr_15_1_0 +{ +private: + unsigned long d_sr; // shift register - public: - lfsr_15_1_0() { reset(); } +public: + lfsr_15_1_0() { reset(); } - void reset() { d_sr = 0x7fff; } + void reset() { d_sr = 0x7fff; } - int next_bit() - { + int next_bit() + { d_sr = ((((d_sr >> 1) ^ d_sr) & 0x1) << 14) | (d_sr >> 1); return d_sr & 0x1; - } + } - int next_byte () - { - int v = 0; - for(int i = 0; i < 8; i++) { - v >>= 1; - if(next_bit ()) - v |= 0x80; + int next_byte() + { + int v = 0; + for (int i = 0; i < 8; i++) { + v >>= 1; + if (next_bit()) + v |= 0x80; } return v; - } - }; + } +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GRI_LFSR_15_1_0_H */ diff --git a/gr-blocks/include/gnuradio/blocks/lfsr_32k.h b/gr-blocks/include/gnuradio/blocks/lfsr_32k.h index 502efebc5d..2b34460a66 100644 --- a/gr-blocks/include/gnuradio/blocks/lfsr_32k.h +++ b/gr-blocks/include/gnuradio/blocks/lfsr_32k.h @@ -27,65 +27,65 @@ #include <gnuradio/blocks/lfsr_15_1_0.h> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief generate pseudo-random sequence of length 32768 bits. - * \ingroup misc - * - * \details - * This is based on gri_lfsr_15_1_0 with an extra 0 added at the - * end of the sequence. - */ - class BLOCKS_API lfsr_32k - { - private: - lfsr_15_1_0 d_lfsr; - unsigned int d_count; +/*! + * \brief generate pseudo-random sequence of length 32768 bits. + * \ingroup misc + * + * \details + * This is based on gri_lfsr_15_1_0 with an extra 0 added at the + * end of the sequence. + */ +class BLOCKS_API lfsr_32k +{ +private: + lfsr_15_1_0 d_lfsr; + unsigned int d_count; - public: - lfsr_32k() { reset (); } +public: + lfsr_32k() { reset(); } - void reset() - { + void reset() + { d_lfsr.reset(); d_count = 0; - } + } - int next_bit() - { - if(d_count == 32767) { - d_count = 0; - return 0; + int next_bit() + { + if (d_count == 32767) { + d_count = 0; + return 0; } d_count++; return d_lfsr.next_bit(); - } + } - int next_byte() - { - int v = 0; - for(int i = 0; i < 8; i++) { - v >>= 1; - if(next_bit ()) - v |= 0x80; + int next_byte() + { + int v = 0; + for (int i = 0; i < 8; i++) { + v >>= 1; + if (next_bit()) + v |= 0x80; } return v; - } + } - int next_short() - { + int next_short() + { int v = 0; - for(int i = 0; i < 16; i++) { - v >>= 1; - if(next_bit ()) - v |= 0x8000; + for (int i = 0; i < 16; i++) { + v >>= 1; + if (next_bit()) + v |= 0x8000; } return v; - } - }; + } +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GRI_LFSR_32k_H */ diff --git a/gr-blocks/include/gnuradio/blocks/lfsr_32k_source_s.h b/gr-blocks/include/gnuradio/blocks/lfsr_32k_source_s.h index 0d13eafed7..390d1ed9f3 100644 --- a/gr-blocks/include/gnuradio/blocks/lfsr_32k_source_s.h +++ b/gr-blocks/include/gnuradio/blocks/lfsr_32k_source_s.h @@ -28,29 +28,29 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief LFSR pseudo-random source with period of 2^15 bits (2^11 shorts) + * \ingroup misc_blk + * + * \details + * This source is typically used along with gr::blocks::check_lfsr_32k_s to + * test the USRP using its digital loopback mode. + */ +class BLOCKS_API lfsr_32k_source_s : virtual public sync_block +{ +public: + // gr::blocks::lfsr_32k_source_s::sptr + typedef boost::shared_ptr<lfsr_32k_source_s> sptr; /*! - * \brief LFSR pseudo-random source with period of 2^15 bits (2^11 shorts) - * \ingroup misc_blk - * - * \details - * This source is typically used along with gr::blocks::check_lfsr_32k_s to - * test the USRP using its digital loopback mode. + * \brief Make a LFSR 32k source block. */ - class BLOCKS_API lfsr_32k_source_s : virtual public sync_block - { - public: - // gr::blocks::lfsr_32k_source_s::sptr - typedef boost::shared_ptr<lfsr_32k_source_s> sptr; - - /*! - * \brief Make a LFSR 32k source block. - */ - static sptr make(); - }; + static sptr make(); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_LFSR_32K_SOURCE_S_H */ diff --git a/gr-blocks/include/gnuradio/blocks/log2_const.h b/gr-blocks/include/gnuradio/blocks/log2_const.h index c2526e76ed..7fc04a94f3 100644 --- a/gr-blocks/include/gnuradio/blocks/log2_const.h +++ b/gr-blocks/include/gnuradio/blocks/log2_const.h @@ -31,23 +31,72 @@ #include <assert.h> namespace gr { - namespace blocks { - - template<unsigned int k> static inline int log2_const() { assert(0); return 0; } - - template<> inline int log2_const<1>() { return 0; } - template<> inline int log2_const<2>() { return 1; } - template<> inline int log2_const<4>() { return 2; } - template<> inline int log2_const<8>() { return 3; } - template<> inline int log2_const<16>() { return 4; } - template<> inline int log2_const<32>() { return 5; } - template<> inline int log2_const<64>() { return 6; } - template<> inline int log2_const<128>() { return 7; } - template<> inline int log2_const<256>() { return 8; } - template<> inline int log2_const<512>() { return 9; } - template<> inline int log2_const<1024>(){ return 10; } - - } /* namespace blocks */ +namespace blocks { + +template <unsigned int k> +static inline int log2_const() +{ + assert(0); + return 0; +} + +template <> +inline int log2_const<1>() +{ + return 0; +} +template <> +inline int log2_const<2>() +{ + return 1; +} +template <> +inline int log2_const<4>() +{ + return 2; +} +template <> +inline int log2_const<8>() +{ + return 3; +} +template <> +inline int log2_const<16>() +{ + return 4; +} +template <> +inline int log2_const<32>() +{ + return 5; +} +template <> +inline int log2_const<64>() +{ + return 6; +} +template <> +inline int log2_const<128>() +{ + return 7; +} +template <> +inline int log2_const<256>() +{ + return 8; +} +template <> +inline int log2_const<512>() +{ + return 9; +} +template <> +inline int log2_const<1024>() +{ + return 10; +} + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_LOG2_CONST_H */ diff --git a/gr-blocks/include/gnuradio/blocks/magphase_to_complex.h b/gr-blocks/include/gnuradio/blocks/magphase_to_complex.h index be2eb3af88..a3704cbeee 100644 --- a/gr-blocks/include/gnuradio/blocks/magphase_to_complex.h +++ b/gr-blocks/include/gnuradio/blocks/magphase_to_complex.h @@ -27,27 +27,27 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief two floats in (mag and phase), complex out + * \ingroup type_converters_blk + */ +class BLOCKS_API magphase_to_complex : virtual public sync_block +{ +public: + // gr::blocks::magphase_to_complex_ff::sptr + typedef boost::shared_ptr<magphase_to_complex> sptr; /*! - * \brief two floats in (mag and phase), complex out - * \ingroup type_converters_blk + * Build a mag and phase to complex block. + * + * \param vlen vector len (default 1) */ - class BLOCKS_API magphase_to_complex : virtual public sync_block - { - public: - // gr::blocks::magphase_to_complex_ff::sptr - typedef boost::shared_ptr<magphase_to_complex> sptr; - - /*! - * Build a mag and phase to complex block. - * - * \param vlen vector len (default 1) - */ - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_MAGPHASE_TO_COMPLEX_H */ diff --git a/gr-blocks/include/gnuradio/blocks/max_blk.h b/gr-blocks/include/gnuradio/blocks/max_blk.h index dcdc3204d1..7e0acdec39 100644 --- a/gr-blocks/include/gnuradio/blocks/max_blk.h +++ b/gr-blocks/include/gnuradio/blocks/max_blk.h @@ -29,37 +29,37 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Compares vectors from multiple streams and determines - * the maximum value from each vector over all streams. - * \ingroup math_operators_blk - * - * \details - * Data is passed in as a vector of length \p vlen from multiple - * input sources. If vlen_out == 1 then - * It will look through these streams of \p vlen - * data items and the output stream will contain the maximum value - * in the vector. - * If vlen_out == vlen and not equal to 1 then - * output will be a vector with individual items selected from - * the maximum corresponding input vector items. - */ -template<class T> - class BLOCKS_API max_blk : virtual public sync_block - { - public: - // gr::blocks::max_blk::sptr - typedef boost::shared_ptr< max_blk<T> > sptr; +/*! + * \brief Compares vectors from multiple streams and determines + * the maximum value from each vector over all streams. + * \ingroup math_operators_blk + * + * \details + * Data is passed in as a vector of length \p vlen from multiple + * input sources. If vlen_out == 1 then + * It will look through these streams of \p vlen + * data items and the output stream will contain the maximum value + * in the vector. + * If vlen_out == vlen and not equal to 1 then + * output will be a vector with individual items selected from + * the maximum corresponding input vector items. + */ +template <class T> +class BLOCKS_API max_blk : virtual public sync_block +{ +public: + // gr::blocks::max_blk::sptr + typedef boost::shared_ptr<max_blk<T>> sptr; - static sptr make(size_t vlen, size_t vlen_out = 1); - }; + static sptr make(size_t vlen, size_t vlen_out = 1); +}; typedef max_blk<std::int16_t> max_ss; typedef max_blk<std::int32_t> max_ii; typedef max_blk<float> max_ff; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* MAX_BLK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/message_debug.h b/gr-blocks/include/gnuradio/blocks/message_debug.h index c6c43f5644..6b83da76bb 100644 --- a/gr-blocks/include/gnuradio/blocks/message_debug.h +++ b/gr-blocks/include/gnuradio/blocks/message_debug.h @@ -27,62 +27,62 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Debug block for the message passing system. + * \ingroup message_tools_blk + * \ingroup measurement_tools_blk + * \ingroup debug_tools_blk + * + * \details + * The message debug block is used to capture and print or store + * messages as they are received. Any block that generates a + * message may connect that message port to one or more of the + * three message input ports of this debug block. The message + * ports are: + * + * \li print: prints the message directly to standard out. + * \li store: stores the message in an internal vector. May be + * access using the get_message function. + * \li print_pdu: specifically designed to handle formatted PDUs + * (see pdu.h). + */ +class BLOCKS_API message_debug : virtual public block +{ +public: + // gr::blocks::message_debug::sptr + typedef boost::shared_ptr<message_debug> sptr; /*! - * \brief Debug block for the message passing system. - * \ingroup message_tools_blk - * \ingroup measurement_tools_blk - * \ingroup debug_tools_blk - * - * \details - * The message debug block is used to capture and print or store - * messages as they are received. Any block that generates a - * message may connect that message port to one or more of the - * three message input ports of this debug block. The message - * ports are: - * - * \li print: prints the message directly to standard out. - * \li store: stores the message in an internal vector. May be - * access using the get_message function. - * \li print_pdu: specifically designed to handle formatted PDUs - * (see pdu.h). + * \brief Build the message debug block. It takes no parameters + * and has three message ports: print, store, and + * print_pdu. */ - class BLOCKS_API message_debug : virtual public block - { - public: - // gr::blocks::message_debug::sptr - typedef boost::shared_ptr<message_debug> sptr; - - /*! - * \brief Build the message debug block. It takes no parameters - * and has three message ports: print, store, and - * print_pdu. - */ - static sptr make(); + static sptr make(); - /*! - * \brief Reports the number of messages received by this block. - */ - virtual int num_messages() = 0; + /*! + * \brief Reports the number of messages received by this block. + */ + virtual int num_messages() = 0; - /*! - * \brief Get a message (as a PMT) from the message vector at index \p i. - * - * Messages passed to the 'store' port will be stored in a - * vector. This function retrieves those messages by index. They - * are index in order of when they were received (all messages - * are just pushed onto the back of a vector). This is mostly - * useful in debugging message passing graphs and in QA code. - * - * \param i The index in the vector for the message to retrieve. - * - * \return a message at index \p i as a pmt_t. - */ - virtual pmt::pmt_t get_message(int i) = 0; - }; + /*! + * \brief Get a message (as a PMT) from the message vector at index \p i. + * + * Messages passed to the 'store' port will be stored in a + * vector. This function retrieves those messages by index. They + * are index in order of when they were received (all messages + * are just pushed onto the back of a vector). This is mostly + * useful in debugging message passing graphs and in QA code. + * + * \param i The index in the vector for the message to retrieve. + * + * \return a message at index \p i as a pmt_t. + */ + virtual pmt::pmt_t get_message(int i) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_MESSAGE_DEBUG_H */ diff --git a/gr-blocks/include/gnuradio/blocks/message_strobe.h b/gr-blocks/include/gnuradio/blocks/message_strobe.h index 553a1c0f9e..2a2fbdae5b 100644 --- a/gr-blocks/include/gnuradio/blocks/message_strobe.h +++ b/gr-blocks/include/gnuradio/blocks/message_strobe.h @@ -27,56 +27,56 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Send message at defined interval + * \ingroup message_tools_blk + * + * \details + * Takes a PMT message and sends it out every \p period_ms + * milliseconds. Useful for testing/debugging the message system. + */ +class BLOCKS_API message_strobe : virtual public block +{ +public: + // gr::blocks::message_strobe::sptr + typedef boost::shared_ptr<message_strobe> sptr; /*! - * \brief Send message at defined interval - * \ingroup message_tools_blk + * Make a message stobe block to send message \p msg every \p + * period_ms milliseconds. * - * \details - * Takes a PMT message and sends it out every \p period_ms - * milliseconds. Useful for testing/debugging the message system. + * \param msg The message to send as a PMT. + * \param period_ms the time period in milliseconds in which to + * send \p msg. */ - class BLOCKS_API message_strobe : virtual public block - { - public: - // gr::blocks::message_strobe::sptr - typedef boost::shared_ptr<message_strobe> sptr; + static sptr make(pmt::pmt_t msg, long period_ms); - /*! - * Make a message stobe block to send message \p msg every \p - * period_ms milliseconds. - * - * \param msg The message to send as a PMT. - * \param period_ms the time period in milliseconds in which to - * send \p msg. - */ - static sptr make(pmt::pmt_t msg, long period_ms); - - /*! - * Reset the message being sent. - * \param msg The message to send as a PMT. - */ - virtual void set_msg(pmt::pmt_t msg) = 0; + /*! + * Reset the message being sent. + * \param msg The message to send as a PMT. + */ + virtual void set_msg(pmt::pmt_t msg) = 0; - /*! - * Get the value of the message being sent. - */ - virtual pmt::pmt_t msg() const = 0; + /*! + * Get the value of the message being sent. + */ + virtual pmt::pmt_t msg() const = 0; - /*! - * Reset the sending interval. - * \param period_ms the time period in milliseconds. - */ - virtual void set_period(long period_ms) = 0; + /*! + * Reset the sending interval. + * \param period_ms the time period in milliseconds. + */ + virtual void set_period(long period_ms) = 0; - /*! - * Get the time interval of the strobe. - */ - virtual long period() const = 0; - }; + /*! + * Get the time interval of the strobe. + */ + virtual long period() const = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_MESSAGE_STROBE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/message_strobe_random.h b/gr-blocks/include/gnuradio/blocks/message_strobe_random.h index 8f5a20e1b3..e481d670e0 100644 --- a/gr-blocks/include/gnuradio/blocks/message_strobe_random.h +++ b/gr-blocks/include/gnuradio/blocks/message_strobe_random.h @@ -27,92 +27,94 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { - /* - * strobing models - */ - typedef enum { - STROBE_POISSON=1, - STROBE_GAUSSIAN=2, - STROBE_UNIFORM=3 - } message_strobe_random_distribution_t; +/* + * strobing models + */ +typedef enum { + STROBE_POISSON = 1, + STROBE_GAUSSIAN = 2, + STROBE_UNIFORM = 3 +} message_strobe_random_distribution_t; + +/*! + * \brief Send message at defined interval + * \ingroup message_tools_blk + * + * \details + + * Takes a PMT message and sends it out every at random + * intervals. The interval is basedon a random distribution, \p + * dist, with specified mean (\p mean_ms) and variance (\p + * std_ms). Useful for testing/debugging the message system. + */ +class BLOCKS_API message_strobe_random : virtual public block +{ +public: + // gr::blocks::message_strobe_random::sptr + typedef boost::shared_ptr<message_strobe_random> sptr; /*! - * \brief Send message at defined interval - * \ingroup message_tools_blk + * Make a message stobe block to sends message \p msg at random + * intervals defined by the distribution \p dist with mean \p + * mean_ms and standard deviation \p std_ms. * - * \details + * \param msg The message to send as a PMT. + * \param dist The random distribution from which to draw events. + * \param mean_ms The mean of the distribution. + * \param std_ms The standard deviation of the distribution. + */ + static sptr make(pmt::pmt_t msg, + message_strobe_random_distribution_t dist, + float mean_ms, + float std_ms); - * Takes a PMT message and sends it out every at random - * intervals. The interval is basedon a random distribution, \p - * dist, with specified mean (\p mean_ms) and variance (\p - * std_ms). Useful for testing/debugging the message system. + /*! + * Reset the message being sent. + * \param msg The message to send as a PMT. */ - class BLOCKS_API message_strobe_random : virtual public block - { - public: - // gr::blocks::message_strobe_random::sptr - typedef boost::shared_ptr<message_strobe_random> sptr; - - /*! - * Make a message stobe block to sends message \p msg at random - * intervals defined by the distribution \p dist with mean \p - * mean_ms and standard deviation \p std_ms. - * - * \param msg The message to send as a PMT. - * \param dist The random distribution from which to draw events. - * \param mean_ms The mean of the distribution. - * \param std_ms The standard deviation of the distribution. - */ - static sptr make(pmt::pmt_t msg, message_strobe_random_distribution_t dist, float mean_ms, float std_ms); - - /*! - * Reset the message being sent. - * \param msg The message to send as a PMT. - */ - virtual void set_msg(pmt::pmt_t msg) = 0; - - /*! - * Get the value of the message being sent. - */ - virtual pmt::pmt_t msg() const = 0; - - /*! - * \param dist new distribution. - */ - virtual void set_dist(message_strobe_random_distribution_t dist) = 0; - - /*! - * get the current distribution. - */ - virtual message_strobe_random_distribution_t dist() const = 0; - - /*! - * Reset the sending interval. - * \param mean delay in milliseconds. - */ - virtual void set_mean(float mean) = 0; - - /*! - * Get the time interval of the strobe_random. - */ - virtual float mean() const = 0; - - /*! - * Reset the sending interval. - * \param std delay in milliseconds. - */ - virtual void set_std(float std) = 0; - - /*! - * Get the std of strobe_random. - */ - virtual float std() const = 0; - - }; - - } /* namespace blocks */ + virtual void set_msg(pmt::pmt_t msg) = 0; + + /*! + * Get the value of the message being sent. + */ + virtual pmt::pmt_t msg() const = 0; + + /*! + * \param dist new distribution. + */ + virtual void set_dist(message_strobe_random_distribution_t dist) = 0; + + /*! + * get the current distribution. + */ + virtual message_strobe_random_distribution_t dist() const = 0; + + /*! + * Reset the sending interval. + * \param mean delay in milliseconds. + */ + virtual void set_mean(float mean) = 0; + + /*! + * Get the time interval of the strobe_random. + */ + virtual float mean() const = 0; + + /*! + * Reset the sending interval. + * \param std delay in milliseconds. + */ + virtual void set_std(float std) = 0; + + /*! + * Get the std of strobe_random. + */ + virtual float std() const = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_MESSAGE_STROBE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/min_blk.h b/gr-blocks/include/gnuradio/blocks/min_blk.h index 29dc75ae18..1d4e272931 100644 --- a/gr-blocks/include/gnuradio/blocks/min_blk.h +++ b/gr-blocks/include/gnuradio/blocks/min_blk.h @@ -29,36 +29,36 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Compares vectors from multiple streams and determines - * the minimum value from each vector over all streams. - * \ingroup math_operators_blk - * - * \details - * Data is passed in as a vector of length \p vlen from multiple - * input sources. If vlen_out == 1 then - * It will look through these streams of \p vlen - * data items and the output stream will contain the minimum value - * in the vector. - * If vlen_out == vlen and not equal to 1 then - * output will be a vector with individual items selected from - * the minimum corresponding input vector items. - */ -template<class T> - class BLOCKS_API min_blk : virtual public sync_block - { - public: - typedef boost::shared_ptr< min_blk<T> > sptr; +/*! + * \brief Compares vectors from multiple streams and determines + * the minimum value from each vector over all streams. + * \ingroup math_operators_blk + * + * \details + * Data is passed in as a vector of length \p vlen from multiple + * input sources. If vlen_out == 1 then + * It will look through these streams of \p vlen + * data items and the output stream will contain the minimum value + * in the vector. + * If vlen_out == vlen and not equal to 1 then + * output will be a vector with individual items selected from + * the minimum corresponding input vector items. + */ +template <class T> +class BLOCKS_API min_blk : virtual public sync_block +{ +public: + typedef boost::shared_ptr<min_blk<T>> sptr; - static sptr make(size_t vlen, size_t vlen_out = 1); - }; + static sptr make(size_t vlen, size_t vlen_out = 1); +}; typedef min_blk<std::int16_t> min_ss; typedef min_blk<std::int32_t> min_ii; typedef min_blk<float> min_ff; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* MIN_BLK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/moving_average.h b/gr-blocks/include/gnuradio/blocks/moving_average.h index 8448c45ded..a66decfc64 100644 --- a/gr-blocks/include/gnuradio/blocks/moving_average.h +++ b/gr-blocks/include/gnuradio/blocks/moving_average.h @@ -29,63 +29,61 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief output is the moving sum of the last N samples, scaled by the scale factor + * \ingroup level_controllers_blk + */ +template <class T> +class BLOCKS_API moving_average : virtual public sync_block +{ +public: + // gr::blocks::moving_average::sptr + typedef boost::shared_ptr<moving_average<T>> sptr; /*! - * \brief output is the moving sum of the last N samples, scaled by the scale factor - * \ingroup level_controllers_blk + * Create a moving average block. + * + * \param length Number of samples to use in the average. + * \param scale scale factor for the result. + * \param max_iter limits how long we go without flushing the accumulator + * This is necessary to avoid numerical instability for float and complex. + * \param vlen When > 1, do a per-vector-element moving average */ -template<class T> - class BLOCKS_API moving_average : virtual public sync_block - { - public: - // gr::blocks::moving_average::sptr - typedef boost::shared_ptr< moving_average<T> > sptr; + static sptr make(int length, T scale, int max_iter = 4096, unsigned int vlen = 1); - /*! - * Create a moving average block. - * - * \param length Number of samples to use in the average. - * \param scale scale factor for the result. - * \param max_iter limits how long we go without flushing the accumulator - * This is necessary to avoid numerical instability for float and complex. - * \param vlen When > 1, do a per-vector-element moving average - */ - static sptr make(int length, T scale, - int max_iter = 4096, - unsigned int vlen = 1); - - /*! - * Get the length used in the avaraging calculation. - */ - virtual int length() const = 0; + /*! + * Get the length used in the avaraging calculation. + */ + virtual int length() const = 0; - /*! - * Get the scale factor being used. - */ - virtual T scale() const = 0; + /*! + * Get the scale factor being used. + */ + virtual T scale() const = 0; - /*! - * Set both the length and the scale factor together. - */ - virtual void set_length_and_scale(int length, T scale) = 0; + /*! + * Set both the length and the scale factor together. + */ + virtual void set_length_and_scale(int length, T scale) = 0; - /*! - * Set the length. - */ - virtual void set_length(int length) = 0; + /*! + * Set the length. + */ + virtual void set_length(int length) = 0; - /*! - * Set the scale factor. - */ - virtual void set_scale(T scale) = 0; - }; + /*! + * Set the scale factor. + */ + virtual void set_scale(T scale) = 0; +}; typedef moving_average<std::int16_t> moving_average_ss; typedef moving_average<std::int32_t> moving_average_ii; typedef moving_average<float> moving_average_ff; typedef moving_average<gr_complex> moving_average_cc; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* MOVING_AVERAGE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply.h b/gr-blocks/include/gnuradio/blocks/multiply.h index 06bda22cbf..467b341cc9 100644 --- a/gr-blocks/include/gnuradio/blocks/multiply.h +++ b/gr-blocks/include/gnuradio/blocks/multiply.h @@ -29,31 +29,30 @@ #include <cstdint> namespace gr { - namespace blocks { - - /*! - * \brief output = prod (input_0, input_1, ...) - * \ingroup math_operators_blk - * - * \details - * Multiply across all input streams. - */ -template<class T> - class BLOCKS_API multiply : virtual public sync_block - { - public: - - // gr::blocks::multiply::sptr - typedef boost::shared_ptr< multiply<T> > sptr; - - static sptr make(size_t vlen=1); - }; +namespace blocks { + +/*! + * \brief output = prod (input_0, input_1, ...) + * \ingroup math_operators_blk + * + * \details + * Multiply across all input streams. + */ +template <class T> +class BLOCKS_API multiply : virtual public sync_block +{ +public: + // gr::blocks::multiply::sptr + typedef boost::shared_ptr<multiply<T>> sptr; + + static sptr make(size_t vlen = 1); +}; typedef multiply<std::int16_t> multiply_ss; typedef multiply<std::int32_t> multiply_ii; typedef multiply<float> multiply_ff; typedef multiply<gr_complex> multiply_cc; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* MULTIPLY_H */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_by_tag_value_cc.h b/gr-blocks/include/gnuradio/blocks/multiply_by_tag_value_cc.h index f4aba9db65..3867960e81 100644 --- a/gr-blocks/include/gnuradio/blocks/multiply_by_tag_value_cc.h +++ b/gr-blocks/include/gnuradio/blocks/multiply_by_tag_value_cc.h @@ -27,43 +27,42 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief output = input * complex constant + * \ingroup math_operators_blk + * + * \details + * The complex constant used by this block is found from a tag + * with the name specified by \p tag_name. The tag must contain a + * float/double or complex PMT value that will be converted into a + * gr_complex value. All input data is multiplied by this + * value until a new tag with an update value is found. The block + * starts with a value of '1.0' for the multiplier constant. + */ +class BLOCKS_API multiply_by_tag_value_cc : virtual public sync_block +{ +public: + // gr::blocks::multiply_by_tag_value_cc::sptr + typedef boost::shared_ptr<multiply_by_tag_value_cc> sptr; /*! - * \brief output = input * complex constant - * \ingroup math_operators_blk - * - * \details - * The complex constant used by this block is found from a tag - * with the name specified by \p tag_name. The tag must contain a - * float/double or complex PMT value that will be converted into a - * gr_complex value. All input data is multiplied by this - * value until a new tag with an update value is found. The block - * starts with a value of '1.0' for the multiplier constant. + * \brief Create an instance of multiply_by_tag_value_cc + * \param tag_name Tag's key that it will use to get the + * multiplicative constant. + * \param vlen Vector length of incoming stream */ - class BLOCKS_API multiply_by_tag_value_cc : virtual public sync_block - { - public: - // gr::blocks::multiply_by_tag_value_cc::sptr - typedef boost::shared_ptr<multiply_by_tag_value_cc> sptr; + static sptr make(const std::string& tag_name, size_t vlen = 1); - /*! - * \brief Create an instance of multiply_by_tag_value_cc - * \param tag_name Tag's key that it will use to get the - * multiplicative constant. - * \param vlen Vector length of incoming stream - */ - static sptr make(const std::string& tag_name, - size_t vlen=1); - - /*! - * Get the current multiplicative constant. - * This block does not allow external setters. - */ - virtual gr_complex k() const = 0; - }; + /*! + * Get the current multiplicative constant. + * This block does not allow external setters. + */ + virtual gr_complex k() const = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_MULTIPLY_BY_TAG_VALUE_CC_H */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_conjugate_cc.h b/gr-blocks/include/gnuradio/blocks/multiply_conjugate_cc.h index da032da3ed..ff1e799a44 100644 --- a/gr-blocks/include/gnuradio/blocks/multiply_conjugate_cc.h +++ b/gr-blocks/include/gnuradio/blocks/multiply_conjugate_cc.h @@ -27,28 +27,27 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Multiplies stream 0 by the complex conjugate of stream 1. + * \ingroup math_operators_blk + */ +class BLOCKS_API multiply_conjugate_cc : virtual public sync_block +{ +public: + // gr::blocks::multiply_conjugate_cc::sptr + typedef boost::shared_ptr<multiply_conjugate_cc> sptr; /*! - * \brief Multiplies stream 0 by the complex conjugate of stream 1. - * \ingroup math_operators_blk + * \brief Multiplies a streams by the conjugate of a second stream + * \param vlen Vector length + * \ingroup math_blk */ - class BLOCKS_API multiply_conjugate_cc : virtual public sync_block - { - public: - - // gr::blocks::multiply_conjugate_cc::sptr - typedef boost::shared_ptr<multiply_conjugate_cc> sptr; - - /*! - * \brief Multiplies a streams by the conjugate of a second stream - * \param vlen Vector length - * \ingroup math_blk - */ - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_MULTIPLY_CONJUGATE_CC_H */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const.h b/gr-blocks/include/gnuradio/blocks/multiply_const.h index 8781d57659..7ebaffff5d 100644 --- a/gr-blocks/include/gnuradio/blocks/multiply_const.h +++ b/gr-blocks/include/gnuradio/blocks/multiply_const.h @@ -29,44 +29,43 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief output = input * constant - * \ingroup math_operators_blk - */ -template<class T> - class BLOCKS_API multiply_const : virtual public sync_block - { - - public: +/*! + * \brief output = input * constant + * \ingroup math_operators_blk + */ +template <class T> +class BLOCKS_API multiply_const : virtual public sync_block +{ - // gr::blocks::multiply_const::sptr - typedef boost::shared_ptr< multiply_const<T> > sptr; +public: + // gr::blocks::multiply_const::sptr + typedef boost::shared_ptr<multiply_const<T>> sptr; - /*! - * \brief Create an instance of multiply_const - * \param k multiplicative constant - * \param vlen number of items in vector - */ - static sptr make(T k, size_t vlen=1); + /*! + * \brief Create an instance of multiply_const + * \param k multiplicative constant + * \param vlen number of items in vector + */ + static sptr make(T k, size_t vlen = 1); - /*! - * \brief Return multiplicative constant - */ - virtual T k() const = 0; + /*! + * \brief Return multiplicative constant + */ + virtual T k() const = 0; - /*! - * \brief Set multiplicative constant - */ - virtual void set_k(T k) = 0; - }; + /*! + * \brief Set multiplicative constant + */ + virtual void set_k(T k) = 0; +}; typedef multiply_const<std::int16_t> multiply_const_ss; typedef multiply_const<std::int32_t> multiply_const_ii; typedef multiply_const<float> multiply_const_ff; typedef multiply_const<gr_complex> multiply_const_cc; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* MULTIPLY_CONST_H */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_v.h b/gr-blocks/include/gnuradio/blocks/multiply_const_v.h index b1cc2dca36..529dca260f 100644 --- a/gr-blocks/include/gnuradio/blocks/multiply_const_v.h +++ b/gr-blocks/include/gnuradio/blocks/multiply_const_v.h @@ -28,43 +28,42 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief output = input * constant vector (element-wise) - * \ingroup math_operators_blk - */ - template <class T> - class BLOCKS_API multiply_const_v : virtual public sync_block - { - - public: +/*! + * \brief output = input * constant vector (element-wise) + * \ingroup math_operators_blk + */ +template <class T> +class BLOCKS_API multiply_const_v : virtual public sync_block +{ - // gr::blocks::multiply_const_v::sptr - typedef boost::shared_ptr< multiply_const_v<T> > sptr; +public: + // gr::blocks::multiply_const_v::sptr + typedef boost::shared_ptr<multiply_const_v<T>> sptr; - /*! - * \brief Create an instance of multiply_const_v - * \param k multiplicative constant vector - */ - static sptr make(std::vector<T> k); + /*! + * \brief Create an instance of multiply_const_v + * \param k multiplicative constant vector + */ + static sptr make(std::vector<T> k); - /*! - * \brief Return multiplicative constant vector - */ - virtual std::vector<T> k() const = 0; + /*! + * \brief Return multiplicative constant vector + */ + virtual std::vector<T> k() const = 0; - /*! - * \brief Set multiplicative constant vector - */ - virtual void set_k(std::vector<T> k) = 0; - }; + /*! + * \brief Set multiplicative constant vector + */ + virtual void set_k(std::vector<T> k) = 0; +}; - typedef multiply_const_v<std::int16_t> multiply_const_vss; - typedef multiply_const_v<std::int32_t> multiply_const_vii; - typedef multiply_const_v<float> multiply_const_vff; - typedef multiply_const_v<gr_complex> multiply_const_vcc; - } /* namespace blocks */ +typedef multiply_const_v<std::int16_t> multiply_const_vss; +typedef multiply_const_v<std::int32_t> multiply_const_vii; +typedef multiply_const_v<float> multiply_const_vff; +typedef multiply_const_v<gr_complex> multiply_const_vcc; +} /* namespace blocks */ } /* namespace gr */ #endif /* MULTIPLY_CONST_V_H */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_matrix.h b/gr-blocks/include/gnuradio/blocks/multiply_matrix.h index fba4930fcd..c07b8c6b1e 100644 --- a/gr-blocks/include/gnuradio/blocks/multiply_matrix.h +++ b/gr-blocks/include/gnuradio/blocks/multiply_matrix.h @@ -29,72 +29,74 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Matrix multiplexer/multiplier: y(k) = A x(k) + * \ingroup blocks + * + * This block is similar to gr::blocks::multiply_const_ff, the difference + * being it can handle several inputs and outputs, and the input-to-output + * relation can be described by the following mathematical equation: + * \f[ + * \mathbf{y}(k) = \mathbf{A} \mathbf{x}(k) \, , \, y \in \mathbb{R}^N, \mathbf{x} \in + * \mathbb{R}^M, A \in \mathbb{R}^{N \times M} \f] \f$\mathbf{y}(k)\f$ and + * \f$\mathbf{x}(i)\f$ are column-vectors describing the elements on the input port at + * time step \f$k\f$ (this is a sync block with no memory). + * + * Examples for where to use this block include: + * - Switch matrices (i.e. switch which ports go where), assuming all ports run on the + * same rate + * - Simulation of static MIMO-Channels (in that case, \f$\mathbf{A}\f$ is the channel + * matrix) + * - Summing up streams with variable coefficients + * + * This block features a special tag propagation mode: When setting the tag propagation + * policy to gr::block::TPP_CUSTOM, a tag is propagated from input \f$k\f$ to output + * \f$l\f$, if \f$(A)_{l,k} \neq 0\f$. + * + * \section blocks_matrixmult_msgports_multiply_matrix Message Ports + * + * This block as one input message port (\p set_A). A message sent to this port will + * be converted to a std::vector<std::vector<T> >, and then passed on to set_A(). + * If no conversion is possible, a warning is issued via the logging interface, and + * A remains unchanged. + * + * *Note*: It is not possible to change the dimension of the matrix after initialization, + * as this affects the I/O signature! If a matrix of invalid size is passed to the block, + * an alert is raised via the logging interface, and A remains unchanged. + */ +template <class T> +class BLOCKS_API multiply_matrix : virtual public gr::sync_block +{ +public: + typedef boost::shared_ptr<multiply_matrix<T>> sptr; /*! - * \brief Matrix multiplexer/multiplier: y(k) = A x(k) - * \ingroup blocks - * - * This block is similar to gr::blocks::multiply_const_ff, the difference - * being it can handle several inputs and outputs, and the input-to-output - * relation can be described by the following mathematical equation: - * \f[ - * \mathbf{y}(k) = \mathbf{A} \mathbf{x}(k) \, , \, y \in \mathbb{R}^N, \mathbf{x} \in \mathbb{R}^M, A \in \mathbb{R}^{N \times M} - * \f] - * \f$\mathbf{y}(k)\f$ and \f$\mathbf{x}(i)\f$ are column-vectors describing the elements on the input port - * at time step \f$k\f$ (this is a sync block with no memory). - * - * Examples for where to use this block include: - * - Switch matrices (i.e. switch which ports go where), assuming all ports run on the same rate - * - Simulation of static MIMO-Channels (in that case, \f$\mathbf{A}\f$ is the channel matrix) - * - Summing up streams with variable coefficients - * - * This block features a special tag propagation mode: When setting the tag propagation policy - * to gr::block::TPP_CUSTOM, a tag is propagated from input \f$k\f$ - * to output \f$l\f$, if \f$(A)_{l,k} \neq 0\f$. - * - * \section blocks_matrixmult_msgports_multiply_matrix Message Ports - * - * This block as one input message port (\p set_A). A message sent to this port will - * be converted to a std::vector<std::vector<T> >, and then passed on to set_A(). - * If no conversion is possible, a warning is issued via the logging interface, and - * A remains unchanged. - * - * *Note*: It is not possible to change the dimension of the matrix after initialization, - * as this affects the I/O signature! If a matrix of invalid size is passed to the block, - * an alert is raised via the logging interface, and A remains unchanged. + * \param A The matrix + * \param tag_propagation_policy The tag propagation policy. + * Note this can be any + * gr::block::tag_propagation_policy_t + * value. In case of TPP_CUSTOM, tags are + * only transferred from input \f$k\f$ to + * output \f$l \iff (A)_{l,k} \neq 0\f$. */ -template<class T> - class BLOCKS_API multiply_matrix : virtual public gr::sync_block - { - public: - typedef boost::shared_ptr< multiply_matrix<T> > sptr; - - /*! - * \param A The matrix - * \param tag_propagation_policy The tag propagation policy. - * Note this can be any - * gr::block::tag_propagation_policy_t - * value. In case of TPP_CUSTOM, tags are - * only transferred from input \f$k\f$ to - * output \f$l \iff (A)_{l,k} \neq 0\f$. - */ - static sptr make( - std::vector<std::vector<T> > A, - gr::block::tag_propagation_policy_t tag_propagation_policy=gr::block::TPP_ALL_TO_ALL - ); + static sptr make(std::vector<std::vector<T>> A, + gr::block::tag_propagation_policy_t tag_propagation_policy = + gr::block::TPP_ALL_TO_ALL); - //! Returns the current matrix - virtual const std::vector<std::vector<T> >& get_A() const = 0; - //! Sets the matrix to a new value \p new_A. Returns true if the new matrix was valid and could be changed. - virtual bool set_A(const std::vector<std::vector<T> > &new_A) = 0; + //! Returns the current matrix + virtual const std::vector<std::vector<T>>& get_A() const = 0; + //! Sets the matrix to a new value \p new_A. Returns true if the new matrix was valid + //! and could be changed. + virtual bool set_A(const std::vector<std::vector<T>>& new_A) = 0; - std::string MSG_PORT_NAME_SET_A; - }; + std::string MSG_PORT_NAME_SET_A; +}; - typedef multiply_matrix<float> multiply_matrix_ff; - typedef multiply_matrix<gr_complex> multiply_matrix_cc; - } // namespace blocks +typedef multiply_matrix<float> multiply_matrix_ff; +typedef multiply_matrix<gr_complex> multiply_matrix_cc; +} // namespace blocks } // namespace gr #endif /* MULTIPLY_MATRIX_H */ diff --git a/gr-blocks/include/gnuradio/blocks/mute.h b/gr-blocks/include/gnuradio/blocks/mute.h index 1d5f3a3e22..a6ede3cca5 100644 --- a/gr-blocks/include/gnuradio/blocks/mute.h +++ b/gr-blocks/include/gnuradio/blocks/mute.h @@ -29,30 +29,29 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief output = input or zero if muted. - * \ingroup level_controllers_blk - */ -template<class T> - class BLOCKS_API mute_blk : virtual public sync_block - { - public: - typedef boost::shared_ptr< mute_blk<T> > sptr; +/*! + * \brief output = input or zero if muted. + * \ingroup level_controllers_blk + */ +template <class T> +class BLOCKS_API mute_blk : virtual public sync_block +{ +public: + typedef boost::shared_ptr<mute_blk<T>> sptr; - static sptr make(bool mute=false); + static sptr make(bool mute = false); - virtual bool mute() const = 0; - virtual void set_mute(bool mute=false) = 0; - }; + virtual bool mute() const = 0; + virtual void set_mute(bool mute = false) = 0; +}; typedef mute_blk<std::int16_t> mute_ss; typedef mute_blk<std::int32_t> mute_ii; typedef mute_blk<float> mute_ff; typedef mute_blk<gr_complex> mute_cc; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* MUTE_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/nlog10_ff.h b/gr-blocks/include/gnuradio/blocks/nlog10_ff.h index e5f7d7bc2a..55bd275a3c 100644 --- a/gr-blocks/include/gnuradio/blocks/nlog10_ff.h +++ b/gr-blocks/include/gnuradio/blocks/nlog10_ff.h @@ -27,29 +27,28 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief output = n*log10(input) + k + * \ingroup math_operators_blk + */ +class BLOCKS_API nlog10_ff : virtual public sync_block +{ +public: + // gr::blocks::nlog10_ff::sptr + typedef boost::shared_ptr<nlog10_ff> sptr; /*! - * \brief output = n*log10(input) + k - * \ingroup math_operators_blk + * \brief Make an instance of an nlog10_ff block. + * \param n Scalar multiplicative constant + * \param vlen Input vector length + * \param k Scalar additive constant */ - class BLOCKS_API nlog10_ff : virtual public sync_block - { - public: - - // gr::blocks::nlog10_ff::sptr - typedef boost::shared_ptr<nlog10_ff> sptr; - - /*! - * \brief Make an instance of an nlog10_ff block. - * \param n Scalar multiplicative constant - * \param vlen Input vector length - * \param k Scalar additive constant - */ - static sptr make(float n=1.0, size_t vlen=1, float k=0.0); - }; + static sptr make(float n = 1.0, size_t vlen = 1, float k = 0.0); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_NLOG10_FF_H */ diff --git a/gr-blocks/include/gnuradio/blocks/nop.h b/gr-blocks/include/gnuradio/blocks/nop.h index d5b92cdd13..f5977e0c20 100644 --- a/gr-blocks/include/gnuradio/blocks/nop.h +++ b/gr-blocks/include/gnuradio/blocks/nop.h @@ -25,35 +25,35 @@ #include <gnuradio/blocks/api.h> #include <gnuradio/block.h> -#include <stddef.h> // size_t +#include <stddef.h> // size_t namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Does nothing. Used for testing only. + * \ingroup misc_blk + */ +class BLOCKS_API nop : virtual public block +{ +public: + // gr::blocks::nop::sptr + typedef boost::shared_ptr<nop> sptr; /*! - * \brief Does nothing. Used for testing only. - * \ingroup misc_blk + * Build a nop block. + * + * \param sizeof_stream_item size of the stream items in bytes. */ - class BLOCKS_API nop : virtual public 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; - - virtual int ctrlport_test() const = 0; - virtual void set_ctrlport_test(int x) = 0; - }; - - } /* namespace blocks */ + static sptr make(size_t sizeof_stream_item); + + virtual int nmsgs_received() const = 0; + + virtual int ctrlport_test() const = 0; + virtual void set_ctrlport_test(int x) = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_NOP_H */ diff --git a/gr-blocks/include/gnuradio/blocks/not_blk.h b/gr-blocks/include/gnuradio/blocks/not_blk.h index 7484e127e5..5f4c7a1926 100644 --- a/gr-blocks/include/gnuradio/blocks/not_blk.h +++ b/gr-blocks/include/gnuradio/blocks/not_blk.h @@ -29,28 +29,27 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief output = ~input - * \ingroup boolean_operators_blk - * - * bitwise boolean not of input streams. - */ -template<class T> - class BLOCKS_API not_blk : virtual public sync_block - { - public: - - typedef boost::shared_ptr< not_blk<T> > sptr; +/*! + * \brief output = ~input + * \ingroup boolean_operators_blk + * + * bitwise boolean not of input streams. + */ +template <class T> +class BLOCKS_API not_blk : virtual public sync_block +{ +public: + typedef boost::shared_ptr<not_blk<T>> sptr; - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; typedef not_blk<std::uint8_t> not_bb; typedef not_blk<std::int16_t> not_ss; typedef not_blk<std::int32_t> not_ii; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* NOT_BLK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/null_sink.h b/gr-blocks/include/gnuradio/blocks/null_sink.h index cbce9b8c02..62b8ab8817 100644 --- a/gr-blocks/include/gnuradio/blocks/null_sink.h +++ b/gr-blocks/include/gnuradio/blocks/null_sink.h @@ -25,31 +25,31 @@ #include <gnuradio/blocks/api.h> #include <gnuradio/sync_block.h> -#include <stddef.h> // size_t +#include <stddef.h> // size_t namespace gr { - namespace blocks { +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 misc_blk + */ +class BLOCKS_API null_sink : virtual public sync_block +{ +public: + // gr::blocks::null_sink::sptr + typedef boost::shared_ptr<null_sink> sptr; /*! - * \brief Bit bucket. Use as a termination point when a sink is - * required and we don't want to do anything real. - * \ingroup misc_blk + * Build a null sink block. + * + * \param sizeof_stream_item size of the stream items in bytes. */ - class BLOCKS_API null_sink : virtual public 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); - }; + static sptr make(size_t sizeof_stream_item); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_NULL_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/null_source.h b/gr-blocks/include/gnuradio/blocks/null_source.h index eccebe831f..40f42db4d8 100644 --- a/gr-blocks/include/gnuradio/blocks/null_source.h +++ b/gr-blocks/include/gnuradio/blocks/null_source.h @@ -27,27 +27,27 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief A source of zeros used mainly for testing. + * \ingroup misc_blk + */ +class BLOCKS_API null_source : virtual public sync_block +{ +public: + // gr::blocks::null_source::sptr + typedef boost::shared_ptr<null_source> sptr; /*! - * \brief A source of zeros used mainly for testing. - * \ingroup misc_blk + * Build a null source block. + * + * \param sizeof_stream_item size of the stream items in bytes. */ - class BLOCKS_API null_source : virtual public 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); - }; + static sptr make(size_t sizeof_stream_item); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_NULL_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/or_blk.h b/gr-blocks/include/gnuradio/blocks/or_blk.h index d84925bd13..91771d9ca2 100644 --- a/gr-blocks/include/gnuradio/blocks/or_blk.h +++ b/gr-blocks/include/gnuradio/blocks/or_blk.h @@ -27,29 +27,28 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief output = input_0 | input_1 | , ... | input_N) - * \ingroup boolean_operators_blk - * - * Bitwise boolean or across all input streams. - */ - template<class T> - class BLOCKS_API or_blk : virtual public sync_block - { - public: - - // gr::blocks::or_blk::sptr - typedef boost::shared_ptr<or_blk<T> > sptr; - - static sptr make(size_t vlen=1); - }; - - typedef or_blk<short> or_ss; - typedef or_blk<int> or_ii; - typedef or_blk<char> or_bb; - } /* namespace blocks */ +/*! + * \brief output = input_0 | input_1 | , ... | input_N) + * \ingroup boolean_operators_blk + * + * Bitwise boolean or across all input streams. + */ +template <class T> +class BLOCKS_API or_blk : virtual public sync_block +{ +public: + // gr::blocks::or_blk::sptr + typedef boost::shared_ptr<or_blk<T>> sptr; + + static sptr make(size_t vlen = 1); +}; + +typedef or_blk<short> or_ss; +typedef or_blk<int> or_ii; +typedef or_blk<char> or_bb; +} /* namespace blocks */ } /* namespace gr */ #endif /* OR_BLK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/pack_k_bits.h b/gr-blocks/include/gnuradio/blocks/pack_k_bits.h index 4197225ad4..a887c009d9 100644 --- a/gr-blocks/include/gnuradio/blocks/pack_k_bits.h +++ b/gr-blocks/include/gnuradio/blocks/pack_k_bits.h @@ -21,65 +21,65 @@ */ #ifndef INCLUDED_GR_BLOCKS_PACK_K_BITS_H -#define INCLUDED_GR_BLOCKS_PACK_K_BITS_H +#define INCLUDED_GR_BLOCKS_PACK_K_BITS_H #include <gnuradio/blocks/api.h> #include <vector> namespace gr { - namespace blocks { - namespace kernel { +namespace blocks { +namespace kernel { - /*! - * \brief Converts a vector of bytes with 1 bit in the LSB to a - * byte with k relevant bits. - * - * Example: - * k = 4 - * in = [0,1,0,1, 0x81,0x00,0x00,0x00] - * out = [0x05, 0x08] - * - * k = 8 - * in = [1,1,1,1, 0,1,0,1, 0,0,0,0, 1,0,0,0] - * out = [0xf5, 0x08] - * \ingroup byte_operators_blk - */ - class BLOCKS_API pack_k_bits - { - public: - /*! - * \brief Make a pack_k_bits object. - * \param k number of bits to be packed. - */ - pack_k_bits(unsigned k); - ~pack_k_bits(); +/*! + * \brief Converts a vector of bytes with 1 bit in the LSB to a + * byte with k relevant bits. + * + * Example: + * k = 4 + * in = [0,1,0,1, 0x81,0x00,0x00,0x00] + * out = [0x05, 0x08] + * + * k = 8 + * in = [1,1,1,1, 0,1,0,1, 0,0,0,0, 1,0,0,0] + * out = [0xf5, 0x08] + * \ingroup byte_operators_blk + */ +class BLOCKS_API pack_k_bits +{ +public: + /*! + * \brief Make a pack_k_bits object. + * \param k number of bits to be packed. + */ + pack_k_bits(unsigned k); + ~pack_k_bits(); - /*! - * \brief Perform the packing. - * - * This block performs no bounds checking. It assumes that the - * input, \p in, has of length k*nbytes and that the output - * vector, \p out, has \p nbytes available for writing. - * - * \param bytes output vector (k-bits per byte) of the unpacked data - * \param bits The input vector of bits to pack - * \param nbytes The number of output bytes - */ - void pack(unsigned char *bytes, const unsigned char *bits, int nbytes) const; + /*! + * \brief Perform the packing. + * + * This block performs no bounds checking. It assumes that the + * input, \p in, has of length k*nbytes and that the output + * vector, \p out, has \p nbytes available for writing. + * + * \param bytes output vector (k-bits per byte) of the unpacked data + * \param bits The input vector of bits to pack + * \param nbytes The number of output bytes + */ + void pack(unsigned char* bytes, const unsigned char* bits, int nbytes) const; - /*! - * Same as pack() but reverses the bits. - */ - void pack_rev(unsigned char *bytes, const unsigned char *bits, int nbytes) const; + /*! + * Same as pack() but reverses the bits. + */ + void pack_rev(unsigned char* bytes, const unsigned char* bits, int nbytes) const; - int k() const; + int k() const; - private: - unsigned d_k; - }; +private: + unsigned d_k; +}; - } /* namespace kernel */ - } /* namespace blocks */ +} /* namespace kernel */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_BLOCKS_PACK_K_BITS_H */ diff --git a/gr-blocks/include/gnuradio/blocks/pack_k_bits_bb.h b/gr-blocks/include/gnuradio/blocks/pack_k_bits_bb.h index d71e73c580..bef2dfc0ef 100644 --- a/gr-blocks/include/gnuradio/blocks/pack_k_bits_bb.h +++ b/gr-blocks/include/gnuradio/blocks/pack_k_bits_bb.h @@ -21,42 +21,42 @@ */ #ifndef INCLUDED_GR_PACK_K_BITS_BB_H -#define INCLUDED_GR_PACK_K_BITS_BB_H +#define INCLUDED_GR_PACK_K_BITS_BB_H #include <gnuradio/blocks/api.h> #include <gnuradio/sync_decimator.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Converts a stream of bytes with 1 bit in the LSB to a + * byte with k relevant bits. + * + * This block takes in K bytes at a time, and uses the least significant + * bit to form a new byte. + * + * Example: + * k = 4 + * in = [0,1,0,1, 0x81,0x00,0x00,0x00] + * out = [0x05, 0x08] + * + * \ingroup byte_operators_blk + */ +class BLOCKS_API pack_k_bits_bb : virtual public sync_decimator +{ +public: + // gr::blocks::pack_k_bits_bb::sptr + typedef boost::shared_ptr<pack_k_bits_bb> sptr; /*! - * \brief Converts a stream of bytes with 1 bit in the LSB to a - * byte with k relevant bits. - * - * This block takes in K bytes at a time, and uses the least significant - * bit to form a new byte. - * - * Example: - * k = 4 - * in = [0,1,0,1, 0x81,0x00,0x00,0x00] - * out = [0x05, 0x08] - * - * \ingroup byte_operators_blk + * \brief Make a pack_k_bits block. + * \param k number of bits to be packed. */ - class BLOCKS_API pack_k_bits_bb : virtual public sync_decimator - { - public: - // gr::blocks::pack_k_bits_bb::sptr - typedef boost::shared_ptr<pack_k_bits_bb> sptr; - - /*! - * \brief Make a pack_k_bits block. - * \param k number of bits to be packed. - */ - static sptr make(unsigned k); - }; + static sptr make(unsigned k); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_PACK_K_BITS_BB_H */ diff --git a/gr-blocks/include/gnuradio/blocks/packed_to_unpacked.h b/gr-blocks/include/gnuradio/blocks/packed_to_unpacked.h index 0a9c0d7c3c..0c384af56a 100644 --- a/gr-blocks/include/gnuradio/blocks/packed_to_unpacked.h +++ b/gr-blocks/include/gnuradio/blocks/packed_to_unpacked.h @@ -30,49 +30,48 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Convert a stream of packed bytes or shorts to stream of unpacked bytes or shorts. - * \ingroup byte_operators_blk - * - * \details - * input: stream of T; output: stream of T - * - * This is the inverse of gr::blocks::unpacked_to_packed_XX. - * - * The bits in the bytes or shorts input stream are grouped into - * chunks of \p bits_per_chunk bits and each resulting chunk is - * written right- justified to the output stream of bytes or - * shorts. All b or 16 bits of the each input bytes or short are - * processed. The right thing is done if bits_per_chunk is not a - * power of two. - * - * The combination of gr::blocks::packed_to_unpacked_XX_ followed by - * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the - * general case of mapping from a stream of bytes or shorts into - * arbitrary float or complex symbols. - * - * \sa gr::blocks::packed_to_unpacked_bb, gr::blocks::unpacked_to_packed_bb, - * \sa gr::blocks::packed_to_unpacked_ss, gr::blocks::unpacked_to_packed_ss, - * \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc. - * \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc. - */ -template<class T> - class BLOCKS_API packed_to_unpacked : virtual public block - { - public: - // gr::blocks::packed_to_unpacked::sptr - typedef boost::shared_ptr< packed_to_unpacked<T> > sptr; +/*! + * \brief Convert a stream of packed bytes or shorts to stream of unpacked bytes or + * shorts. \ingroup byte_operators_blk + * + * \details + * input: stream of T; output: stream of T + * + * This is the inverse of gr::blocks::unpacked_to_packed_XX. + * + * The bits in the bytes or shorts input stream are grouped into + * chunks of \p bits_per_chunk bits and each resulting chunk is + * written right- justified to the output stream of bytes or + * shorts. All b or 16 bits of the each input bytes or short are + * processed. The right thing is done if bits_per_chunk is not a + * power of two. + * + * The combination of gr::blocks::packed_to_unpacked_XX_ followed by + * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the + * general case of mapping from a stream of bytes or shorts into + * arbitrary float or complex symbols. + * + * \sa gr::blocks::packed_to_unpacked_bb, gr::blocks::unpacked_to_packed_bb, + * \sa gr::blocks::packed_to_unpacked_ss, gr::blocks::unpacked_to_packed_ss, + * \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc. + * \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc. + */ +template <class T> +class BLOCKS_API packed_to_unpacked : virtual public block +{ +public: + // gr::blocks::packed_to_unpacked::sptr + typedef boost::shared_ptr<packed_to_unpacked<T>> sptr; - static sptr make(unsigned int bits_per_chunk, - endianness_t endianness); - }; + static sptr make(unsigned int bits_per_chunk, endianness_t endianness); +}; typedef packed_to_unpacked<std::uint8_t> packed_to_unpacked_bb; typedef packed_to_unpacked<std::int16_t> packed_to_unpacked_ss; typedef packed_to_unpacked<std::int32_t> packed_to_unpacked_ii; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* PACKED_TO_UNPACKED_H */ diff --git a/gr-blocks/include/gnuradio/blocks/patterned_interleaver.h b/gr-blocks/include/gnuradio/blocks/patterned_interleaver.h index ad3d1e9c8e..05c3e07414 100644 --- a/gr-blocks/include/gnuradio/blocks/patterned_interleaver.h +++ b/gr-blocks/include/gnuradio/blocks/patterned_interleaver.h @@ -27,28 +27,27 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Interleave items based on the provided vector \p pattern. + * \ingroup stream_operators_blk + */ +class BLOCKS_API patterned_interleaver : virtual public block +{ +public: + typedef boost::shared_ptr<patterned_interleaver> sptr; /*! - * \brief Interleave items based on the provided vector \p pattern. - * \ingroup stream_operators_blk + * Make a patterned interleaver block. + * + * \param itemsize stream itemsize + * \param pattern vector that represents the interleaving pattern */ - class BLOCKS_API patterned_interleaver : virtual public block - { - public: - typedef boost::shared_ptr<patterned_interleaver> sptr; + static sptr make(size_t itemsize, std::vector<int> pattern); +}; - /*! - * Make a patterned interleaver block. - * - * \param itemsize stream itemsize - * \param pattern vector that represents the interleaving pattern - */ - static sptr make(size_t itemsize, std::vector<int> pattern); - }; - - } -} +} // namespace blocks +} // namespace gr #endif /* INCLUDED_BLOCKS_PATTERNED_INTERLEAVER_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/pdu.h b/gr-blocks/include/gnuradio/blocks/pdu.h index f33575fcf9..86515d5d3f 100644 --- a/gr-blocks/include/gnuradio/blocks/pdu.h +++ b/gr-blocks/include/gnuradio/blocks/pdu.h @@ -29,18 +29,18 @@ namespace gr { - namespace blocks { - namespace pdu { - enum vector_type { byte_t, float_t, complex_t }; +namespace blocks { +namespace pdu { +enum vector_type { byte_t, float_t, complex_t }; - BLOCKS_API const pmt::pmt_t pdu_port_id(); - BLOCKS_API size_t itemsize(vector_type type); - BLOCKS_API bool type_matches(vector_type type, pmt::pmt_t v); - BLOCKS_API pmt::pmt_t make_pdu_vector(vector_type type, const uint8_t* buf, size_t items); - BLOCKS_API vector_type type_from_pmt(pmt::pmt_t vector); +BLOCKS_API const pmt::pmt_t pdu_port_id(); +BLOCKS_API size_t itemsize(vector_type type); +BLOCKS_API bool type_matches(vector_type type, pmt::pmt_t v); +BLOCKS_API pmt::pmt_t make_pdu_vector(vector_type type, const uint8_t* buf, size_t items); +BLOCKS_API vector_type type_from_pmt(pmt::pmt_t vector); - } /* namespace pdu */ - } /* namespace blocks */ +} /* namespace pdu */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_PDU_H */ diff --git a/gr-blocks/include/gnuradio/blocks/pdu_filter.h b/gr-blocks/include/gnuradio/blocks/pdu_filter.h index 25dd185934..f98eb2d7fb 100644 --- a/gr-blocks/include/gnuradio/blocks/pdu_filter.h +++ b/gr-blocks/include/gnuradio/blocks/pdu_filter.h @@ -27,29 +27,29 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Propagates only pdus containing k=>v in meta + * \ingroup message_tools_blk + * \ingroup debug_tools_blk + */ +class BLOCKS_API pdu_filter : virtual public block +{ +public: + // gr::blocks::pdu_filter::sptr + typedef boost::shared_ptr<pdu_filter> sptr; /*! - * \brief Propagates only pdus containing k=>v in meta - * \ingroup message_tools_blk - * \ingroup debug_tools_blk + * \brief Construct a PDU filter */ - class BLOCKS_API pdu_filter : virtual public block - { - public: - // gr::blocks::pdu_filter::sptr - typedef boost::shared_ptr<pdu_filter> sptr; - - /*! - * \brief Construct a PDU filter - */ - static sptr make(pmt::pmt_t k, pmt::pmt_t v, bool invert = false); - virtual void set_key(pmt::pmt_t key) = 0; - virtual void set_val(pmt::pmt_t val) = 0; - virtual void set_inversion(bool invert) = 0; - }; + static sptr make(pmt::pmt_t k, pmt::pmt_t v, bool invert = false); + virtual void set_key(pmt::pmt_t key) = 0; + virtual void set_val(pmt::pmt_t val) = 0; + virtual void set_inversion(bool invert) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_PDU_FILTER_H */ diff --git a/gr-blocks/include/gnuradio/blocks/pdu_remove.h b/gr-blocks/include/gnuradio/blocks/pdu_remove.h index f2ab35f7cf..472729e549 100644 --- a/gr-blocks/include/gnuradio/blocks/pdu_remove.h +++ b/gr-blocks/include/gnuradio/blocks/pdu_remove.h @@ -27,27 +27,27 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief remove key k in pdu's meta field and pass on + * \ingroup message_tools_blk + * \ingroup debug_tools_blk + */ +class BLOCKS_API pdu_remove : virtual public block +{ +public: + // gr::blocks::pdu_remove::sptr + typedef boost::shared_ptr<pdu_remove> sptr; /*! - * \brief remove key k in pdu's meta field and pass on - * \ingroup message_tools_blk - * \ingroup debug_tools_blk + * \brief Construct a PDU meta remove block */ - class BLOCKS_API pdu_remove : virtual public block - { - public: - // gr::blocks::pdu_remove::sptr - typedef boost::shared_ptr<pdu_remove> sptr; - - /*! - * \brief Construct a PDU meta remove block - */ - static sptr make(pmt::pmt_t k); - virtual void set_key(pmt::pmt_t key) = 0; - }; + static sptr make(pmt::pmt_t k); + virtual void set_key(pmt::pmt_t key) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_PDU_REMOVE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/pdu_set.h b/gr-blocks/include/gnuradio/blocks/pdu_set.h index ba96492b61..c0874bbad5 100644 --- a/gr-blocks/include/gnuradio/blocks/pdu_set.h +++ b/gr-blocks/include/gnuradio/blocks/pdu_set.h @@ -27,28 +27,28 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Set k=>v in pdu's meta field and pass on + * \ingroup message_tools_blk + * \ingroup debug_tools_blk + */ +class BLOCKS_API pdu_set : virtual public block +{ +public: + // gr::blocks::pdu_set::sptr + typedef boost::shared_ptr<pdu_set> sptr; /*! - * \brief Set k=>v in pdu's meta field and pass on - * \ingroup message_tools_blk - * \ingroup debug_tools_blk + * \brief Construct a PDU meta set block */ - class BLOCKS_API pdu_set : virtual public block - { - public: - // gr::blocks::pdu_set::sptr - typedef boost::shared_ptr<pdu_set> sptr; - - /*! - * \brief Construct a PDU meta set block - */ - static sptr make(pmt::pmt_t k, pmt::pmt_t v); - virtual void set_key(pmt::pmt_t key) = 0; - virtual void set_val(pmt::pmt_t val) = 0; - }; + static sptr make(pmt::pmt_t k, pmt::pmt_t v); + virtual void set_key(pmt::pmt_t key) = 0; + virtual void set_val(pmt::pmt_t val) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_PDU_SET_H */ diff --git a/gr-blocks/include/gnuradio/blocks/pdu_to_tagged_stream.h b/gr-blocks/include/gnuradio/blocks/pdu_to_tagged_stream.h index 479e367e72..fe21df7b15 100644 --- a/gr-blocks/include/gnuradio/blocks/pdu_to_tagged_stream.h +++ b/gr-blocks/include/gnuradio/blocks/pdu_to_tagged_stream.h @@ -28,29 +28,29 @@ #include <gnuradio/tagged_stream_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Turns received PDUs into a tagged stream of items + * \ingroup message_tools_blk + */ +class BLOCKS_API pdu_to_tagged_stream : virtual public tagged_stream_block +{ +public: + // gr::blocks::pdu_to_tagged_stream::sptr + typedef boost::shared_ptr<pdu_to_tagged_stream> sptr; /*! - * \brief Turns received PDUs into a tagged stream of items - * \ingroup message_tools_blk + * \brief Construct a pdu_to_tagged_stream block + * \param type PDU type of pdu::vector_type + * \param lengthtagname The name of the tag that specifies how long the packet is. + * Defaults to 'packet_len'. */ - class BLOCKS_API pdu_to_tagged_stream : virtual public tagged_stream_block - { - public: - // gr::blocks::pdu_to_tagged_stream::sptr - typedef boost::shared_ptr<pdu_to_tagged_stream> sptr; - - /*! - * \brief Construct a pdu_to_tagged_stream block - * \param type PDU type of pdu::vector_type - * \param lengthtagname The name of the tag that specifies how long the packet is. - * Defaults to 'packet_len'. - */ - static sptr make(pdu::vector_type type, - const std::string& lengthtagname="packet_len"); - }; + static sptr make(pdu::vector_type type, + const std::string& lengthtagname = "packet_len"); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_PDU_TO_TAGGED_STREAM_H */ diff --git a/gr-blocks/include/gnuradio/blocks/peak_detector.h b/gr-blocks/include/gnuradio/blocks/peak_detector.h index 4cc7dbd627..8dfe609b51 100644 --- a/gr-blocks/include/gnuradio/blocks/peak_detector.h +++ b/gr-blocks/include/gnuradio/blocks/peak_detector.h @@ -28,94 +28,94 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Detect the peak of a signal + * \ingroup peak_detectors_blk + * + * \details + * If a peak is detected, this block outputs a 1, + * or it outputs 0's. + */ +template <class T> +class BLOCKS_API peak_detector : virtual public sync_block +{ +public: + typedef boost::shared_ptr<peak_detector<T>> sptr; /*! - * \brief Detect the peak of a signal - * \ingroup peak_detectors_blk + * Make a peak detector block. * - * \details - * If a peak is detected, this block outputs a 1, - * or it outputs 0's. + * \param threshold_factor_rise The threshold factor determines + * when a peak has started. An average of the signal is + * calculated and when the value of the signal goes over + * threshold_factor_rise*average, we start looking for a + * peak. + * \param threshold_factor_fall The threshold factor determines + * when a peak has ended. An average of the signal is + * calculated and when the value of the signal goes + * below threshold_factor_fall*average, we stop looking + * for a peak. + * \param look_ahead The look-ahead value is used when the + * threshold is found to look if there another peak + * within this step range. If there is a larger value, + * we set that as the peak and look ahead again. This is + * continued until the highest point is found with This + * look-ahead range. + * \param alpha The gain value of a moving average filter + */ + static sptr make(float threshold_factor_rise = 0.25, + float threshold_factor_fall = 0.40, + int look_ahead = 10, + float alpha = 0.001); + + /*! \brief Set the threshold factor value for the rise time + * \param thr new threshold factor + */ + virtual void set_threshold_factor_rise(float thr) = 0; + + /*! \brief Set the threshold factor value for the fall time + * \param thr new threshold factor + */ + virtual void set_threshold_factor_fall(float thr) = 0; + + /*! \brief Set the look-ahead factor + * \param look new look-ahead factor + */ + virtual void set_look_ahead(int look) = 0; + + /*! \brief Set the running average alpha + * \param alpha new alpha for running average */ - template <class T> - class BLOCKS_API peak_detector : virtual public sync_block - { - public: - typedef boost::shared_ptr< peak_detector<T> > sptr; - - /*! - * Make a peak detector block. - * - * \param threshold_factor_rise The threshold factor determines - * when a peak has started. An average of the signal is - * calculated and when the value of the signal goes over - * threshold_factor_rise*average, we start looking for a - * peak. - * \param threshold_factor_fall The threshold factor determines - * when a peak has ended. An average of the signal is - * calculated and when the value of the signal goes - * below threshold_factor_fall*average, we stop looking - * for a peak. - * \param look_ahead The look-ahead value is used when the - * threshold is found to look if there another peak - * within this step range. If there is a larger value, - * we set that as the peak and look ahead again. This is - * continued until the highest point is found with This - * look-ahead range. - * \param alpha The gain value of a moving average filter - */ - static sptr make(float threshold_factor_rise = 0.25, - float threshold_factor_fall = 0.40, - int look_ahead = 10, - float alpha = 0.001); - - /*! \brief Set the threshold factor value for the rise time - * \param thr new threshold factor - */ - virtual void set_threshold_factor_rise(float thr) = 0; - - /*! \brief Set the threshold factor value for the fall time - * \param thr new threshold factor - */ - virtual void set_threshold_factor_fall(float thr) = 0; - - /*! \brief Set the look-ahead factor - * \param look new look-ahead factor - */ - virtual void set_look_ahead(int look) = 0; - - /*! \brief Set the running average alpha - * \param alpha new alpha for running average - */ - virtual void set_alpha(float alpha) = 0; - - /*! \brief Get the threshold factor value for the rise time - * \return threshold factor - */ - virtual float threshold_factor_rise() = 0; - - /*! \brief Get the threshold factor value for the fall time - * \return threshold factor - */ - virtual float threshold_factor_fall() = 0; - - /*! \brief Get the look-ahead factor value - * \return look-ahead factor - */ - virtual int look_ahead() = 0; - - /*! \brief Get the alpha value of the running average - * \return alpha - */ - virtual float alpha() = 0; - }; - - typedef peak_detector<float> peak_detector_fb; - typedef peak_detector<std::int32_t> peak_detector_ib; - typedef peak_detector<std::int16_t> peak_detector_sb; - - } /* namespace blocks */ + virtual void set_alpha(float alpha) = 0; + + /*! \brief Get the threshold factor value for the rise time + * \return threshold factor + */ + virtual float threshold_factor_rise() = 0; + + /*! \brief Get the threshold factor value for the fall time + * \return threshold factor + */ + virtual float threshold_factor_fall() = 0; + + /*! \brief Get the look-ahead factor value + * \return look-ahead factor + */ + virtual int look_ahead() = 0; + + /*! \brief Get the alpha value of the running average + * \return alpha + */ + virtual float alpha() = 0; +}; + +typedef peak_detector<float> peak_detector_fb; +typedef peak_detector<std::int32_t> peak_detector_ib; +typedef peak_detector<std::int16_t> peak_detector_sb; + +} /* namespace blocks */ } /* namespace gr */ #endif /* PEAK_DETECTOR_H */ diff --git a/gr-blocks/include/gnuradio/blocks/peak_detector2_fb.h b/gr-blocks/include/gnuradio/blocks/peak_detector2_fb.h index 541dd8aa09..f2adee671f 100644 --- a/gr-blocks/include/gnuradio/blocks/peak_detector2_fb.h +++ b/gr-blocks/include/gnuradio/blocks/peak_detector2_fb.h @@ -27,77 +27,77 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Detect the peak of a signal + * \ingroup peak_detectors_blk + * + * \details + * If a peak is detected, this block outputs a 1, or it outputs + * 0's. A separate debug output may be connected, to view the + * internal estimated mean described below. + */ +class BLOCKS_API peak_detector2_fb : virtual public sync_block +{ +public: + // gr::blocks::peak_detector2_fb::sptr + typedef boost::shared_ptr<peak_detector2_fb> sptr; /*! - * \brief Detect the peak of a signal - * \ingroup peak_detectors_blk + * Build a peak detector block with float in, byte out. * - * \details - * If a peak is detected, this block outputs a 1, or it outputs - * 0's. A separate debug output may be connected, to view the - * internal estimated mean described below. + * \param threshold_factor_rise The threshold factor determines + * when a peak is present. An average of the input signal + * is calculated (through a single-pole autoregressive + * filter) and when the value of the input signal goes + * over threshold_factor_rise*average, we assume we are + * in the neighborhood of a peak. The block will then + * find the position of the maximum within a window of + * look_ahead samples starting at the point where the + * threshold was crossed upwards. + * \param look_ahead The look-ahead value is used when the + * threshold is crossed upwards to locate the peak within + * this range. + * \param alpha One minus the pole of a single-pole + * autoregressive filter that evaluates the average of + * the input signal. */ - class BLOCKS_API peak_detector2_fb : virtual public sync_block - { - public: - // gr::blocks::peak_detector2_fb::sptr - typedef boost::shared_ptr<peak_detector2_fb> sptr; + static sptr + make(float threshold_factor_rise = 7, int look_ahead = 1000, float alpha = 0.001); - /*! - * Build a peak detector block with float in, byte out. - * - * \param threshold_factor_rise The threshold factor determines - * when a peak is present. An average of the input signal - * is calculated (through a single-pole autoregressive - * filter) and when the value of the input signal goes - * over threshold_factor_rise*average, we assume we are - * in the neighborhood of a peak. The block will then - * find the position of the maximum within a window of - * look_ahead samples starting at the point where the - * threshold was crossed upwards. - * \param look_ahead The look-ahead value is used when the - * threshold is crossed upwards to locate the peak within - * this range. - * \param alpha One minus the pole of a single-pole - * autoregressive filter that evaluates the average of - * the input signal. - */ - static sptr make(float threshold_factor_rise=7, - int look_ahead=1000, float alpha=0.001); - - /*! \brief Set the threshold factor value for the rise time - * \param thr new threshold factor - */ - virtual void set_threshold_factor_rise(float thr) = 0; + /*! \brief Set the threshold factor value for the rise time + * \param thr new threshold factor + */ + virtual void set_threshold_factor_rise(float thr) = 0; - /*! \brief Set the look-ahead factor - * \param look new look-ahead factor - */ - virtual void set_look_ahead(int look) = 0; + /*! \brief Set the look-ahead factor + * \param look new look-ahead factor + */ + virtual void set_look_ahead(int look) = 0; - /*! \brief Set the running average alpha - * \param alpha new alpha for running average - */ - virtual void set_alpha(float alpha) = 0; + /*! \brief Set the running average alpha + * \param alpha new alpha for running average + */ + virtual void set_alpha(float alpha) = 0; - /*! \brief Get the threshold factor value for the rise time - * \return threshold factor - */ - virtual float threshold_factor_rise() = 0; + /*! \brief Get the threshold factor value for the rise time + * \return threshold factor + */ + virtual float threshold_factor_rise() = 0; - /*! \brief Get the look-ahead factor value - * \return look-ahead factor - */ - virtual int look_ahead() = 0; + /*! \brief Get the look-ahead factor value + * \return look-ahead factor + */ + virtual int look_ahead() = 0; - /*! \brief Get the alpha value of the running average - * \return alpha - */ - virtual float alpha() = 0; - }; + /*! \brief Get the alpha value of the running average + * \return alpha + */ + virtual float alpha() = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_H */ diff --git a/gr-blocks/include/gnuradio/blocks/plateau_detector_fb.h b/gr-blocks/include/gnuradio/blocks/plateau_detector_fb.h index 9a9d7c8a16..efad9231e6 100644 --- a/gr-blocks/include/gnuradio/blocks/plateau_detector_fb.h +++ b/gr-blocks/include/gnuradio/blocks/plateau_detector_fb.h @@ -28,46 +28,45 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Detects a plateau and marks the middle. + * \ingroup peak_detectors_blk + * + * \details + * Detect a plateau of a-priori known height. Input is a stream of floats, + * the output is a stream of bytes. Whenever a plateau is detected, the + * middle of that plateau is marked with a '1' on the output stream (all + * other samples are left at zero). + * + * You can use this in a Schmidl & Cox synchronisation algorithm to interpret + * the output of the normalized correlator. Just pass the length of the cyclic + * prefix (in samples) as the max_len parameter). + * + * Unlike the peak detectors, you must the now the absolute height of the plateau. + * Whenever the amplitude exceeds the given threshold, it starts assuming the + * presence of a plateau. + * + * An implicit hysteresis is provided by the fact that after detecting one plateau, + * it waits at least max_len samples before the next plateau can be detected. + */ +class BLOCKS_API plateau_detector_fb : virtual public block +{ +public: + typedef boost::shared_ptr<plateau_detector_fb> sptr; /*! - * \brief Detects a plateau and marks the middle. - * \ingroup peak_detectors_blk - * - * \details - * Detect a plateau of a-priori known height. Input is a stream of floats, - * the output is a stream of bytes. Whenever a plateau is detected, the - * middle of that plateau is marked with a '1' on the output stream (all - * other samples are left at zero). - * - * You can use this in a Schmidl & Cox synchronisation algorithm to interpret - * the output of the normalized correlator. Just pass the length of the cyclic - * prefix (in samples) as the max_len parameter). - * - * Unlike the peak detectors, you must the now the absolute height of the plateau. - * Whenever the amplitude exceeds the given threshold, it starts assuming the - * presence of a plateau. - * - * An implicit hysteresis is provided by the fact that after detecting one plateau, - * it waits at least max_len samples before the next plateau can be detected. + * \param max_len Maximum length of the plateau + * \param threshold Anything above this value is considered a plateau */ - class BLOCKS_API plateau_detector_fb : virtual public block - { - public: - typedef boost::shared_ptr<plateau_detector_fb> sptr; + static sptr make(int max_len, float threshold = 0.9); - /*! - * \param max_len Maximum length of the plateau - * \param threshold Anything above this value is considered a plateau - */ - static sptr make(int max_len, float threshold=0.9); + virtual void set_threshold(float threshold) = 0; + virtual float threshold() const = 0; +}; - virtual void set_threshold(float threshold) = 0; - virtual float threshold() const = 0; - }; - - } // namespace blocks +} // namespace blocks } // namespace gr #endif /* INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/probe_rate.h b/gr-blocks/include/gnuradio/blocks/probe_rate.h index a941d10279..db235d1224 100644 --- a/gr-blocks/include/gnuradio/blocks/probe_rate.h +++ b/gr-blocks/include/gnuradio/blocks/probe_rate.h @@ -27,35 +27,36 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief throughput measurement + * \ingroup measurement_tools_blk + */ +class BLOCKS_API probe_rate : virtual public sync_block +{ +public: + // gr::blocks::probe_rate::sptr + typedef boost::shared_ptr<probe_rate> sptr; /*! - * \brief throughput measurement - * \ingroup measurement_tools_blk + * \brief Make a throughput measurement block + * \param itemsize size of each stream item + * \param update_rate_ms minimum update time in milliseconds + * \param alpha gain for running average filter */ - class BLOCKS_API probe_rate : virtual public sync_block - { - public: - // gr::blocks::probe_rate::sptr - typedef boost::shared_ptr<probe_rate> sptr; - - /*! - * \brief Make a throughput measurement block - * \param itemsize size of each stream item - * \param update_rate_ms minimum update time in milliseconds - * \param alpha gain for running average filter - */ - static sptr make(size_t itemsize, double update_rate_ms = 500.0, double alpha = 0.0001); + static sptr + make(size_t itemsize, double update_rate_ms = 500.0, double alpha = 0.0001); - virtual void set_alpha(double alpha) = 0; + virtual void set_alpha(double alpha) = 0; - virtual double rate() = 0; + virtual double rate() = 0; - virtual bool start() = 0; - virtual bool stop() = 0; - }; + virtual bool start() = 0; + virtual bool stop() = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_PROBE_RATE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/probe_signal.h b/gr-blocks/include/gnuradio/blocks/probe_signal.h index 39754ed7a0..9a7078cc6a 100644 --- a/gr-blocks/include/gnuradio/blocks/probe_signal.h +++ b/gr-blocks/include/gnuradio/blocks/probe_signal.h @@ -29,30 +29,30 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Sink that allows a sample to be grabbed from Python. - * \ingroup measurement_tools_blk - */ -template<class T> - class BLOCKS_API probe_signal : virtual public sync_block - { - public: - // gr::blocks::probe_signal::sptr - typedef boost::shared_ptr< probe_signal<T> > sptr; +/*! + * \brief Sink that allows a sample to be grabbed from Python. + * \ingroup measurement_tools_blk + */ +template <class T> +class BLOCKS_API probe_signal : virtual public sync_block +{ +public: + // gr::blocks::probe_signal::sptr + typedef boost::shared_ptr<probe_signal<T>> sptr; - static sptr make(); + static sptr make(); - virtual T level() const = 0; - }; + virtual T level() const = 0; +}; typedef probe_signal<std::uint8_t> probe_signal_b; typedef probe_signal<std::int16_t> probe_signal_s; typedef probe_signal<std::int32_t> probe_signal_i; typedef probe_signal<float> probe_signal_f; typedef probe_signal<gr_complex> probe_signal_c; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* PROBE_SIGNAL_H */ diff --git a/gr-blocks/include/gnuradio/blocks/probe_signal_v.h b/gr-blocks/include/gnuradio/blocks/probe_signal_v.h index 2d088cbd5f..f3e43fe2fb 100644 --- a/gr-blocks/include/gnuradio/blocks/probe_signal_v.h +++ b/gr-blocks/include/gnuradio/blocks/probe_signal_v.h @@ -29,31 +29,31 @@ #include <cstdint> namespace gr { - namespace blocks { - - /*! - * \brief Sink that allows a vector of samples to be grabbed from Python. - * \ingroup sink_blk - * \ingroup measurement_tools_blk - */ - template <class T> - class BLOCKS_API probe_signal_v : virtual public sync_block - { - public: - typedef boost::shared_ptr< probe_signal_v<T> > sptr; - - static sptr make(size_t size); - - virtual std::vector<T> level() const = 0; - }; - - typedef probe_signal_v<std::uint8_t> probe_signal_vb; - typedef probe_signal_v<std::int16_t> probe_signal_vs; - typedef probe_signal_v<std::int32_t> probe_signal_vi; - typedef probe_signal_v<float> probe_signal_vf; - typedef probe_signal_v<gr_complex> probe_signal_vc; - - } /* namespace blocks */ +namespace blocks { + +/*! + * \brief Sink that allows a vector of samples to be grabbed from Python. + * \ingroup sink_blk + * \ingroup measurement_tools_blk + */ +template <class T> +class BLOCKS_API probe_signal_v : virtual public sync_block +{ +public: + typedef boost::shared_ptr<probe_signal_v<T>> sptr; + + static sptr make(size_t size); + + virtual std::vector<T> level() const = 0; +}; + +typedef probe_signal_v<std::uint8_t> probe_signal_vb; +typedef probe_signal_v<std::int16_t> probe_signal_vs; +typedef probe_signal_v<std::int32_t> probe_signal_vi; +typedef probe_signal_v<float> probe_signal_vf; +typedef probe_signal_v<gr_complex> probe_signal_vc; + +} /* namespace blocks */ } /* namespace gr */ #endif /* PROBE_SIGNAL_V_H */ diff --git a/gr-blocks/include/gnuradio/blocks/random_pdu.h b/gr-blocks/include/gnuradio/blocks/random_pdu.h index 2f9e1bfd5e..6bbc506fe0 100644 --- a/gr-blocks/include/gnuradio/blocks/random_pdu.h +++ b/gr-blocks/include/gnuradio/blocks/random_pdu.h @@ -27,26 +27,27 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Sends a random PDU at intervals + * \ingroup message_tools_blk + * \ingroup debug_tools_blk + */ +class BLOCKS_API random_pdu : virtual public block +{ +public: + // gr::blocks::random_pdu::sptr + typedef boost::shared_ptr<random_pdu> sptr; /*! - * \brief Sends a random PDU at intervals - * \ingroup message_tools_blk - * \ingroup debug_tools_blk + * \brief Construct a random PDU generator */ - class BLOCKS_API random_pdu : virtual public block - { - public: - // gr::blocks::random_pdu::sptr - typedef boost::shared_ptr<random_pdu> sptr; - - /*! - * \brief Construct a random PDU generator - */ - static sptr make(int mintime, int maxtime, unsigned char byte_mask = 0xFF, int length_modulo = 1); - }; + static sptr + make(int mintime, int maxtime, unsigned char byte_mask = 0xFF, int length_modulo = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_RANDOM_PDU_H */ diff --git a/gr-blocks/include/gnuradio/blocks/regenerate_bb.h b/gr-blocks/include/gnuradio/blocks/regenerate_bb.h index 81949a164e..e4181a9c43 100644 --- a/gr-blocks/include/gnuradio/blocks/regenerate_bb.h +++ b/gr-blocks/include/gnuradio/blocks/regenerate_bb.h @@ -27,55 +27,55 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Detect the peak of a signal and repeat every period samples + * \ingroup stream_operators_blk + * + * \details + * If a peak is detected, this block outputs a 1 repeated every + * period samples until reset by detection of another 1 on the + * input or stopped after max_regen regenerations have occurred. + * + * Note that if max_regen=(-1)/ULONG_MAX then the regeneration + * will run forever. + */ +class BLOCKS_API regenerate_bb : virtual public sync_block +{ +public: + // gr::blocks::regenerate_bb::sptr + typedef boost::shared_ptr<regenerate_bb> sptr; /*! - * \brief Detect the peak of a signal and repeat every period samples - * \ingroup stream_operators_blk - * - * \details - * If a peak is detected, this block outputs a 1 repeated every - * period samples until reset by detection of another 1 on the - * input or stopped after max_regen regenerations have occurred. - * - * Note that if max_regen=(-1)/ULONG_MAX then the regeneration - * will run forever. + * \brief Make a regenerate block + * \param period The number of samples between regenerations + * \param max_regen The maximum number of regenerations to + * perform; if set to ULONG_MAX, it will regenerate + * continuously. */ - class BLOCKS_API regenerate_bb : virtual public sync_block - { - public: - // gr::blocks::regenerate_bb::sptr - typedef boost::shared_ptr<regenerate_bb> sptr; + static sptr make(int period, unsigned int max_regen = 500); - /*! - * \brief Make a regenerate block - * \param period The number of samples between regenerations - * \param max_regen The maximum number of regenerations to - * perform; if set to ULONG_MAX, it will regenerate - * continuously. - */ - static sptr make(int period, unsigned int max_regen=500); - - /*! \brief Reset the maximum regeneration count; this will reset - the current regen. - */ - virtual void set_max_regen(unsigned int regen) = 0; + /*! \brief Reset the maximum regeneration count; this will reset + the current regen. + */ + virtual void set_max_regen(unsigned int regen) = 0; - /*! \brief Reset the period of regenerations; this will reset - the current regen. - */ - virtual void set_period(int period) = 0; + /*! \brief Reset the period of regenerations; this will reset + the current regen. + */ + virtual void set_period(int period) = 0; - /*! \brief return the maximum regeneration count. - */ - virtual unsigned int max_regen() const = 0; + /*! \brief return the maximum regeneration count. + */ + virtual unsigned int max_regen() const = 0; - /*! \brief return the regeneration period. - */ - virtual int period() const = 0; - }; + /*! \brief return the regeneration period. + */ + virtual int period() const = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_REGENERATE_BB_H */ diff --git a/gr-blocks/include/gnuradio/blocks/repack_bits_bb.h b/gr-blocks/include/gnuradio/blocks/repack_bits_bb.h index 7bf53ab09c..8eb694f8e6 100644 --- a/gr-blocks/include/gnuradio/blocks/repack_bits_bb.h +++ b/gr-blocks/include/gnuradio/blocks/repack_bits_bb.h @@ -28,62 +28,66 @@ #include <gnuradio/endianness.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Repack \p k bits from the input stream onto \p l bits of the output stream. + * \ingroup byte_operators_blk + * + * \details + * No bits are lost here; any value for k and l (within [1, 8]) is allowed. + * On every fresh input byte, it starts reading on the LSB, and starts copying + * to the LSB as well. + * + * When supplying a tag name, this block operates on tagged streams. + * In this case, it can happen that the input data or the output data + * becomes unaligned when k * input length is not equal to l * output length. + * In this case, the \p align_output parameter is used to decide which + * data packet to align. + * + * Usually, \p align_output is false for unpacking (k=8, l < 8) and false for + * reversing that. + * + * \section gr_blocks_repack_example Example + * + * Say you're tx'ing 8-PSK and therefore set k=8, l=3 on the transmit side + * before the modulator. Now assume you're transmitting a single byte of data. + * Your incoming tagged stream has length 1, the outgoing has length 3. However, + * the third item is actually only carrying 2 bits of relevant data, the bits + * do not align with the boundaries. So you set \p align_output = false, + * because the output can be unaligned. + * + * Now say you're doing the inverse: packing those three items into full + * bytes. How do you interpret those three bytes? Without this flag, + * you'd have to assume there's 9 relevant bits in there, so you'd end up + * with 2 bytes of output data. But in the packing case, you want the + * \b output to be aligned; all output bits must be useful. By asserting this flag, + * the packing algorithm tries to do this and in this case assumes that + * since we have alignment after 8 bits, the 9th can be discarded. + */ +class BLOCKS_API repack_bits_bb : virtual public tagged_stream_block +{ +public: + typedef boost::shared_ptr<repack_bits_bb> sptr; /*! - * \brief Repack \p k bits from the input stream onto \p l bits of the output stream. - * \ingroup byte_operators_blk - * - * \details - * No bits are lost here; any value for k and l (within [1, 8]) is allowed. - * On every fresh input byte, it starts reading on the LSB, and starts copying - * to the LSB as well. - * - * When supplying a tag name, this block operates on tagged streams. - * In this case, it can happen that the input data or the output data - * becomes unaligned when k * input length is not equal to l * output length. - * In this case, the \p align_output parameter is used to decide which - * data packet to align. - * - * Usually, \p align_output is false for unpacking (k=8, l < 8) and false for - * reversing that. - * - * \section gr_blocks_repack_example Example - * - * Say you're tx'ing 8-PSK and therefore set k=8, l=3 on the transmit side - * before the modulator. Now assume you're transmitting a single byte of data. - * Your incoming tagged stream has length 1, the outgoing has length 3. However, - * the third item is actually only carrying 2 bits of relevant data, the bits - * do not align with the boundaries. So you set \p align_output = false, - * because the output can be unaligned. - * - * Now say you're doing the inverse: packing those three items into full - * bytes. How do you interpret those three bytes? Without this flag, - * you'd have to assume there's 9 relevant bits in there, so you'd end up - * with 2 bytes of output data. But in the packing case, you want the - * \b output to be aligned; all output bits must be useful. By asserting this flag, - * the packing algorithm tries to do this and in this case assumes that - * since we have alignment after 8 bits, the 9th can be discarded. + * \param k Number of relevant bits on the input stream + * \param l Number of relevant bits on the output stream + * \param tsb_tag_key If not empty, this is the key for the length tag. + * \param align_output If tsb_tag_key is given, this controls if the input + * or the output is aligned. + * \param endianness The endianness of the output data stream (LSB or MSB). */ - class BLOCKS_API repack_bits_bb : virtual public tagged_stream_block - { - public: - typedef boost::shared_ptr<repack_bits_bb> sptr; - - /*! - * \param k Number of relevant bits on the input stream - * \param l Number of relevant bits on the output stream - * \param tsb_tag_key If not empty, this is the key for the length tag. - * \param align_output If tsb_tag_key is given, this controls if the input - * or the output is aligned. - * \param endianness The endianness of the output data stream (LSB or MSB). - */ - static sptr make(int k, int l=8, const std::string &tsb_tag_key="", - bool align_output=false, endianness_t endianness=GR_LSB_FIRST); - virtual void set_k_and_l(int k, int l) =0;//callback function for bits per input byte k and bits per output byte l. - }; + static sptr make(int k, + int l = 8, + const std::string& tsb_tag_key = "", + bool align_output = false, + endianness_t endianness = GR_LSB_FIRST); + virtual void set_k_and_l(int k, int l) = 0; // callback function for bits per input + // byte k and bits per output byte l. +}; - } // namespace blocks +} // namespace blocks } // namespace gr #endif /* INCLUDED_BLOCKS_REPACK_BITS_BB_H */ diff --git a/gr-blocks/include/gnuradio/blocks/repeat.h b/gr-blocks/include/gnuradio/blocks/repeat.h index b34bda1ec5..473297bd40 100644 --- a/gr-blocks/include/gnuradio/blocks/repeat.h +++ b/gr-blocks/include/gnuradio/blocks/repeat.h @@ -27,46 +27,47 @@ #include <gnuradio/sync_interpolator.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief repeat each input \p repeat times + * \ingroup stream_operators_blk + * + * Message Ports: + * * interpolation (in): + * Takes a pmt_pair(pmt::mp("interpolation"), pmt_long interp), setting the + * interpolation to interp. + */ +class BLOCKS_API repeat : virtual public sync_interpolator +{ +public: + // gr::blocks::repeat::sptr + typedef boost::shared_ptr<repeat> sptr; /*! - * \brief repeat each input \p repeat times - * \ingroup stream_operators_blk + * Make a repeat block. * - * Message Ports: - * * interpolation (in): - * Takes a pmt_pair(pmt::mp("interpolation"), pmt_long interp), setting the interpolation to interp. + * \param itemsize stream itemsize + * \param repeat number of times to repeat the input */ - class BLOCKS_API repeat : virtual public sync_interpolator - { - public: - // gr::blocks::repeat::sptr - typedef boost::shared_ptr<repeat> sptr; + static sptr make(size_t itemsize, int repeat); - /*! - * Make a repeat block. - * - * \param itemsize stream itemsize - * \param repeat number of times to repeat the input - */ - static sptr make(size_t itemsize, int repeat); - - /*! - * \brief Return current interpolation - */ - virtual int interpolation() const = 0; + /*! + * \brief Return current interpolation + */ + virtual int interpolation() const = 0; - /*! - * \brief sets the interpolation - * - * Call this method in a callback to adjust the interpolation at run time. - * - * \param interp interpolation to be set - */ - virtual void set_interpolation(int interp) = 0; - }; + /*! + * \brief sets the interpolation + * + * Call this method in a callback to adjust the interpolation at run time. + * + * \param interp interpolation to be set + */ + virtual void set_interpolation(int interp) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_REPEAT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/rms_cf.h b/gr-blocks/include/gnuradio/blocks/rms_cf.h index ecb50f33d0..3894f1d116 100644 --- a/gr-blocks/include/gnuradio/blocks/rms_cf.h +++ b/gr-blocks/include/gnuradio/blocks/rms_cf.h @@ -27,28 +27,28 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief RMS average power + * \ingroup math_operators_blk + */ +class BLOCKS_API rms_cf : virtual public sync_block +{ +public: + // gr::blocks::rms_cf::sptr + typedef boost::shared_ptr<rms_cf> sptr; /*! - * \brief RMS average power - * \ingroup math_operators_blk + * \brief Make an RMS calc. block. + * \param alpha gain for running average filter. */ - class BLOCKS_API rms_cf : virtual public sync_block - { - public: - // gr::blocks::rms_cf::sptr - typedef boost::shared_ptr<rms_cf> sptr; - - /*! - * \brief Make an RMS calc. block. - * \param alpha gain for running average filter. - */ - static sptr make(double alpha = 0.0001); - - virtual void set_alpha(double alpha) = 0; - }; - - } /* namespace blocks */ + static sptr make(double alpha = 0.0001); + + virtual void set_alpha(double alpha) = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_RMS_CF_H */ diff --git a/gr-blocks/include/gnuradio/blocks/rms_ff.h b/gr-blocks/include/gnuradio/blocks/rms_ff.h index 2d4acd0e3d..09014ead6c 100644 --- a/gr-blocks/include/gnuradio/blocks/rms_ff.h +++ b/gr-blocks/include/gnuradio/blocks/rms_ff.h @@ -27,28 +27,28 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief RMS average power + * \ingroup math_operators_blk + */ +class BLOCKS_API rms_ff : virtual public sync_block +{ +public: + // gr::blocks::rms_ff::sptr + typedef boost::shared_ptr<rms_ff> sptr; /*! - * \brief RMS average power - * \ingroup math_operators_blk + * \brief Make an RMS calc. block. + * \param alpha gain for running average filter. */ - class BLOCKS_API rms_ff : virtual public sync_block - { - public: - // gr::blocks::rms_ff::sptr - typedef boost::shared_ptr<rms_ff> sptr; - - /*! - * \brief Make an RMS calc. block. - * \param alpha gain for running average filter. - */ - static sptr make(double alpha = 0.0001); - - virtual void set_alpha(double alpha) = 0; - }; - - } /* namespace blocks */ + static sptr make(double alpha = 0.0001); + + virtual void set_alpha(double alpha) = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_RMS_FF_H */ diff --git a/gr-blocks/include/gnuradio/blocks/rotator.h b/gr-blocks/include/gnuradio/blocks/rotator.h index 978297716d..161925cf4f 100644 --- a/gr-blocks/include/gnuradio/blocks/rotator.h +++ b/gr-blocks/include/gnuradio/blocks/rotator.h @@ -29,42 +29,42 @@ #include <cmath> namespace gr { - namespace blocks { +namespace blocks { - class rotator - { - private: - gr_complex d_phase; - gr_complex d_phase_incr; - unsigned int d_counter; +class 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) - { } +public: + rotator() : d_phase(1), d_phase_incr(1), d_counter(0) {} - void set_phase(gr_complex phase) { d_phase = phase / std::abs(phase); } - void set_phase_incr(gr_complex incr) { d_phase_incr = incr / std::abs(incr); } + void set_phase(gr_complex phase) { d_phase = phase / std::abs(phase); } + void set_phase_incr(gr_complex incr) { d_phase_incr = incr / std::abs(incr); } - gr_complex rotate(gr_complex in) - { + 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) + 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 /= std::abs(d_phase); // Normalize to ensure multiplication is rotation + if ((d_counter % 512) == 0) + d_phase /= + std::abs(d_phase); // Normalize to ensure multiplication is rotation return z; - } + } - void rotateN(gr_complex *out, const gr_complex *in, int n) - { + void rotateN(gr_complex* out, const gr_complex* in, int n) + { volk_32fc_s32fc_x2_rotator_32fc(out, in, d_phase_incr, &d_phase, n); - } - }; + } +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* _GR_ROTATOR_H_ */ diff --git a/gr-blocks/include/gnuradio/blocks/rotator_cc.h b/gr-blocks/include/gnuradio/blocks/rotator_cc.h index 0697eeb19b..650ab73991 100644 --- a/gr-blocks/include/gnuradio/blocks/rotator_cc.h +++ b/gr-blocks/include/gnuradio/blocks/rotator_cc.h @@ -27,28 +27,28 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Complex rotator + * \ingroup math_operators_blk + */ +class BLOCKS_API rotator_cc : virtual public sync_block +{ +public: + // gr::blocks::rotator_cc::sptr + typedef boost::shared_ptr<rotator_cc> sptr; /*! - * \brief Complex rotator - * \ingroup math_operators_blk + * \brief Make an complex rotator block + * \param phase_inc rotational velocity */ - class BLOCKS_API rotator_cc : virtual public sync_block - { - public: - // gr::blocks::rotator_cc::sptr - typedef boost::shared_ptr<rotator_cc> sptr; - - /*! - * \brief Make an complex rotator block - * \param phase_inc rotational velocity - */ - static sptr make(double phase_inc = 0.0); - - virtual void set_phase_inc(double phase_inc) = 0; - }; - - } /* namespace blocks */ + static sptr make(double phase_inc = 0.0); + + virtual void set_phase_inc(double phase_inc) = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_ROTATOR_CC_H */ diff --git a/gr-blocks/include/gnuradio/blocks/sample_and_hold.h b/gr-blocks/include/gnuradio/blocks/sample_and_hold.h index a6172a75c5..71230e7199 100644 --- a/gr-blocks/include/gnuradio/blocks/sample_and_hold.h +++ b/gr-blocks/include/gnuradio/blocks/sample_and_hold.h @@ -29,31 +29,31 @@ #include <cstdint> namespace gr { - namespace blocks { - - /*! - * \brief sample and hold circuit - * \ingroup level_controllers_blk - * - * \details - * Samples the data stream (input stream 0) and holds the value if - * the control signal is 1 (intput stream 1). - */ -template<class T> - class BLOCKS_API sample_and_hold : virtual public sync_block - { - public: - // gr::blocks::sample_and_hold::sptr - typedef boost::shared_ptr< sample_and_hold<T> > sptr; - - static sptr make(); - }; +namespace blocks { + +/*! + * \brief sample and hold circuit + * \ingroup level_controllers_blk + * + * \details + * Samples the data stream (input stream 0) and holds the value if + * the control signal is 1 (intput stream 1). + */ +template <class T> +class BLOCKS_API sample_and_hold : virtual public sync_block +{ +public: + // gr::blocks::sample_and_hold::sptr + typedef boost::shared_ptr<sample_and_hold<T>> sptr; + + static sptr make(); +}; typedef sample_and_hold<std::uint8_t> sample_and_hold_bb; typedef sample_and_hold<std::int16_t> sample_and_hold_ss; typedef sample_and_hold<std::int32_t> sample_and_hold_ii; typedef sample_and_hold<float> sample_and_hold_ff; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* SAMPLE_AND_HOLD_H */ diff --git a/gr-blocks/include/gnuradio/blocks/short_to_char.h b/gr-blocks/include/gnuradio/blocks/short_to_char.h index 7e72ee34a3..7cc58d2826 100644 --- a/gr-blocks/include/gnuradio/blocks/short_to_char.h +++ b/gr-blocks/include/gnuradio/blocks/short_to_char.h @@ -27,37 +27,37 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of shorts to a stream of chars. + * + * This block strips off the least significant byte from the + * short value. + * + * [0x00ff, 0x0ff0, 0xff00] => [0x00, 0x0f, 0xff] + * + * \ingroup type_converters_blk + * + * \details + * Converts \p vlen length vectors of input short samples to chars, + * dividing each element by 256. + */ +class BLOCKS_API short_to_char : virtual public sync_block +{ +public: + // gr::blocks::short_to_char_ff::sptr + typedef boost::shared_ptr<short_to_char> sptr; /*! - * \brief Convert stream of shorts to a stream of chars. - * - * This block strips off the least significant byte from the - * short value. - * - * [0x00ff, 0x0ff0, 0xff00] => [0x00, 0x0f, 0xff] + * Build a short to char block. * - * \ingroup type_converters_blk - * - * \details - * Converts \p vlen length vectors of input short samples to chars, - * dividing each element by 256. + * \param vlen vector length of data streams. */ - class BLOCKS_API short_to_char : virtual public sync_block - { - public: - // gr::blocks::short_to_char_ff::sptr - typedef boost::shared_ptr<short_to_char> sptr; - - /*! - * Build a short to char block. - * - * \param vlen vector length of data streams. - */ - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_SHORT_TO_CHAR_H */ diff --git a/gr-blocks/include/gnuradio/blocks/short_to_float.h b/gr-blocks/include/gnuradio/blocks/short_to_float.h index 4a7faa1422..248554daac 100644 --- a/gr-blocks/include/gnuradio/blocks/short_to_float.h +++ b/gr-blocks/include/gnuradio/blocks/short_to_float.h @@ -27,38 +27,38 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of shorts to a stream of floats + * \ingroup type_converters_blk + */ +class BLOCKS_API short_to_float : virtual public sync_block +{ +public: + // gr::blocks::short_to_float_ff::sptr + typedef boost::shared_ptr<short_to_float> sptr; /*! - * \brief Convert stream of shorts to a stream of floats - * \ingroup type_converters_blk + * Build a short to float block. + * + * \param vlen vector length of data streams. + * \param scale a scalar divider to change the output signal scale. */ - class BLOCKS_API short_to_float : virtual public sync_block - { - public: - // gr::blocks::short_to_float_ff::sptr - typedef boost::shared_ptr<short_to_float> sptr; + static sptr make(size_t vlen = 1, float scale = 1.0); - /*! - * Build a short to float block. - * - * \param vlen vector length of data streams. - * \param scale a scalar divider to change the output signal scale. - */ - static sptr make(size_t vlen=1, float scale=1.0); - - /*! - * Get the scalar divider value. - */ - virtual float scale() const = 0; + /*! + * Get the scalar divider value. + */ + virtual float scale() const = 0; - /*! - * Set the scalar divider value. - */ - virtual void set_scale(float scale) = 0; - }; + /*! + * Set the scalar divider value. + */ + virtual void set_scale(float scale) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_SHORT_TO_FLOAT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/skiphead.h b/gr-blocks/include/gnuradio/blocks/skiphead.h index c3b6d632c1..6b1c29a079 100644 --- a/gr-blocks/include/gnuradio/blocks/skiphead.h +++ b/gr-blocks/include/gnuradio/blocks/skiphead.h @@ -25,30 +25,29 @@ #include <gnuradio/blocks/api.h> #include <gnuradio/sync_block.h> -#include <stddef.h> // size_t +#include <stddef.h> // size_t namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief skips the first N items, from then on copies items to the output - * \ingroup misc_blk - * - * \details - * Useful for building test cases and sources which have metadata - * or junk at the start - */ - class BLOCKS_API skiphead : virtual public block - { - public: - // gr::blocks::skiphead::sptr - typedef boost::shared_ptr<skiphead> sptr; +/*! + * \brief skips the first N items, from then on copies items to the output + * \ingroup misc_blk + * + * \details + * Useful for building test cases and sources which have metadata + * or junk at the start + */ +class BLOCKS_API skiphead : virtual public block +{ +public: + // gr::blocks::skiphead::sptr + typedef boost::shared_ptr<skiphead> sptr; - static sptr make(size_t itemsize, - uint64_t nitems_to_skip); - }; + static sptr make(size_t itemsize, uint64_t nitems_to_skip); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_SKIPHEAD_H */ diff --git a/gr-blocks/include/gnuradio/blocks/socket_pdu.h b/gr-blocks/include/gnuradio/blocks/socket_pdu.h index 31468a3f43..f91881621e 100644 --- a/gr-blocks/include/gnuradio/blocks/socket_pdu.h +++ b/gr-blocks/include/gnuradio/blocks/socket_pdu.h @@ -27,30 +27,34 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Creates socket interface and translates traffic to PDUs + * \ingroup networking_tools_blk + */ +class BLOCKS_API socket_pdu : virtual public block +{ +public: + // gr::blocks::socket_pdu::sptr + typedef boost::shared_ptr<socket_pdu> sptr; /*! - * \brief Creates socket interface and translates traffic to PDUs - * \ingroup networking_tools_blk + * \brief Construct a SOCKET PDU interface + * \param type "TCP_SERVER", "TCP_CLIENT", "UDP_SERVER", or "UDP_CLIENT" + * \param addr network address to use + * \param port network port to use + * \param MTU maximum transmission unit + * \param tcp_no_delay TCP No Delay option (set to True to disable Nagle algorithm) */ - class BLOCKS_API socket_pdu : virtual public block - { - public: - // gr::blocks::socket_pdu::sptr - typedef boost::shared_ptr<socket_pdu> sptr; - - /*! - * \brief Construct a SOCKET PDU interface - * \param type "TCP_SERVER", "TCP_CLIENT", "UDP_SERVER", or "UDP_CLIENT" - * \param addr network address to use - * \param port network port to use - * \param MTU maximum transmission unit - * \param tcp_no_delay TCP No Delay option (set to True to disable Nagle algorithm) - */ - static sptr make(std::string type, std::string addr, std::string port, int MTU=10000, bool tcp_no_delay=false); - }; + static sptr make(std::string type, + std::string addr, + std::string port, + int MTU = 10000, + bool tcp_no_delay = false); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_SOCKET_PDU_H */ diff --git a/gr-blocks/include/gnuradio/blocks/stream_mux.h b/gr-blocks/include/gnuradio/blocks/stream_mux.h index 941c186b3f..9dc0386795 100644 --- a/gr-blocks/include/gnuradio/blocks/stream_mux.h +++ b/gr-blocks/include/gnuradio/blocks/stream_mux.h @@ -28,43 +28,42 @@ #include <vector> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Stream muxing block to multiplex many streams into + * one with a specified format. + * \ingroup stream_operators_blk + * + * \details + * Muxes N streams together producing an output stream that + * contains N0 items from the first stream, N1 items from the second, + * etc. and repeats: + * + * [N0, N1, N2, ..., Nm, N0, N1, ...] + */ +class BLOCKS_API stream_mux : virtual public block +{ +public: + // gr::blocks::stream_mux::sptr + typedef boost::shared_ptr<stream_mux> sptr; /*! - * \brief Stream muxing block to multiplex many streams into + * \brief Creates a stream muxing block to multiplex many streams into * one with a specified format. - * \ingroup stream_operators_blk * - * \details - * Muxes N streams together producing an output stream that - * contains N0 items from the first stream, N1 items from the second, - * etc. and repeats: + * \param itemsize the item size of the stream + * \param lengths a vector (list/tuple) specifying the number of + * items from each stream the mux together. + * Warning: this requires that at least as many items + * per stream are available or the system will wait + * indefinitely for the items. * - * [N0, N1, N2, ..., Nm, N0, N1, ...] */ - class BLOCKS_API stream_mux : virtual public block - { - public: - - // gr::blocks::stream_mux::sptr - typedef boost::shared_ptr<stream_mux> sptr; - - /*! - * \brief Creates a stream muxing block to multiplex many streams into - * one with a specified format. - * - * \param itemsize the item size of the stream - * \param lengths a vector (list/tuple) specifying the number of - * items from each stream the mux together. - * Warning: this requires that at least as many items - * per stream are available or the system will wait - * indefinitely for the items. - * - */ - static sptr make(size_t itemsize, const std::vector<int> &lengths); - }; + static sptr make(size_t itemsize, const std::vector<int>& lengths); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_STREAM_MUX_H */ diff --git a/gr-blocks/include/gnuradio/blocks/stream_to_streams.h b/gr-blocks/include/gnuradio/blocks/stream_to_streams.h index cb87a4b013..d849df5d75 100644 --- a/gr-blocks/include/gnuradio/blocks/stream_to_streams.h +++ b/gr-blocks/include/gnuradio/blocks/stream_to_streams.h @@ -27,32 +27,32 @@ #include <gnuradio/sync_decimator.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief convert a stream of items into a N streams of items + * \ingroup stream_operators_blk + * + * \details + * Converts a stream of N items into N streams of 1 item. + * Repeat ad infinitum. + */ +class BLOCKS_API stream_to_streams : virtual public sync_decimator +{ +public: + // gr::blocks::stream_to_streams::sptr + typedef boost::shared_ptr<stream_to_streams> sptr; /*! - * \brief convert a stream of items into a N streams of items - * \ingroup stream_operators_blk + * Make a stream-to-streams block. * - * \details - * Converts a stream of N items into N streams of 1 item. - * Repeat ad infinitum. + * \param itemsize the item size of the stream + * \param nstreams number of streams to split input into */ - class BLOCKS_API stream_to_streams : virtual public sync_decimator - { - public: - // gr::blocks::stream_to_streams::sptr - typedef boost::shared_ptr<stream_to_streams> sptr; - - /*! - * Make a stream-to-streams block. - * - * \param itemsize the item size of the stream - * \param nstreams number of streams to split input into - */ - static sptr make(size_t itemsize, size_t nstreams); - }; + static sptr make(size_t itemsize, size_t nstreams); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_STREAM_TO_STREAMS_H */ diff --git a/gr-blocks/include/gnuradio/blocks/stream_to_tagged_stream.h b/gr-blocks/include/gnuradio/blocks/stream_to_tagged_stream.h index 502412a6bc..b5f689f635 100644 --- a/gr-blocks/include/gnuradio/blocks/stream_to_tagged_stream.h +++ b/gr-blocks/include/gnuradio/blocks/stream_to_tagged_stream.h @@ -27,44 +27,41 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Converts a regular stream into a tagged stream. + * \ingroup blocks + * + * All this block does is add length tags in regular intervals. + * It can be used to connect a regular stream to a gr::tagged_stream_block. + * + * \b Careful: This block is meant to be connected directly to a tagged + * stream block. If there are blocks between this block and a tagged + * stream block, make sure they either don't change the rate, or modify + * the tag value to make sure the length tags actually represent the + * packet length. + */ +class BLOCKS_API stream_to_tagged_stream : virtual public gr::sync_block +{ +public: + typedef boost::shared_ptr<stream_to_tagged_stream> sptr; /*! - * \brief Converts a regular stream into a tagged stream. - * \ingroup blocks - * - * All this block does is add length tags in regular intervals. - * It can be used to connect a regular stream to a gr::tagged_stream_block. - * - * \b Careful: This block is meant to be connected directly to a tagged - * stream block. If there are blocks between this block and a tagged - * stream block, make sure they either don't change the rate, or modify - * the tag value to make sure the length tags actually represent the - * packet length. + * \param itemsize Item size + * \param vlen Vector length of the input items. Note that one vector is one item. + * \param packet_len Number of items per tagged stream packet. One tag is written + * every \p packet_len items. \param len_tag_key Key of the length tag. */ - class BLOCKS_API stream_to_tagged_stream : virtual public gr::sync_block - { - public: - typedef boost::shared_ptr<stream_to_tagged_stream> sptr; - - /*! - * \param itemsize Item size - * \param vlen Vector length of the input items. Note that one vector is one item. - * \param packet_len Number of items per tagged stream packet. One tag is written every \p packet_len items. - * \param len_tag_key Key of the length tag. - */ - static sptr make( - size_t itemsize, - unsigned int vlen, - unsigned packet_len, - const std::string &len_tag_key - ); - virtual void set_packet_len(unsigned packet_len) =0; - virtual void set_packet_len_pmt(unsigned packet_len) =0; - }; + static sptr make(size_t itemsize, + unsigned int vlen, + unsigned packet_len, + const std::string& len_tag_key); + virtual void set_packet_len(unsigned packet_len) = 0; + virtual void set_packet_len_pmt(unsigned packet_len) = 0; +}; - } // namespace blocks +} // namespace blocks } // namespace gr #endif /* INCLUDED_BLOCKS_STREAM_TO_TAGGED_STREAM_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/stream_to_vector.h b/gr-blocks/include/gnuradio/blocks/stream_to_vector.h index ca96bdd7fe..616b2d571e 100644 --- a/gr-blocks/include/gnuradio/blocks/stream_to_vector.h +++ b/gr-blocks/include/gnuradio/blocks/stream_to_vector.h @@ -27,28 +27,28 @@ #include <gnuradio/sync_decimator.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief convert a stream of items into a stream of gnuradio/blocks containing + * nitems_per_block \ingroup stream_operators_blk + */ +class BLOCKS_API stream_to_vector : virtual public sync_decimator +{ +public: + // gr::blocks::stream_to_vector::sptr + typedef boost::shared_ptr<stream_to_vector> sptr; /*! - * \brief convert a stream of items into a stream of gnuradio/blocks containing nitems_per_block - * \ingroup stream_operators_blk + * Make a stream-to-vector block. + * + * \param itemsize the item size of the stream + * \param nitems_per_block number of items to put into each vector (vector size) */ - class BLOCKS_API stream_to_vector : virtual public sync_decimator - { - public: - // gr::blocks::stream_to_vector::sptr - typedef boost::shared_ptr<stream_to_vector> sptr; - - /*! - * Make a stream-to-vector block. - * - * \param itemsize the item size of the stream - * \param nitems_per_block number of items to put into each vector (vector size) - */ - static sptr make(size_t itemsize, size_t nitems_per_block); - }; + static sptr make(size_t itemsize, size_t nitems_per_block); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_STREAM_TO_VECTOR_H */ diff --git a/gr-blocks/include/gnuradio/blocks/streams_to_stream.h b/gr-blocks/include/gnuradio/blocks/streams_to_stream.h index 79c28e6c62..dfda710006 100644 --- a/gr-blocks/include/gnuradio/blocks/streams_to_stream.h +++ b/gr-blocks/include/gnuradio/blocks/streams_to_stream.h @@ -27,32 +27,32 @@ #include <gnuradio/sync_interpolator.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert N streams of 1 item into a 1 stream of N items + * \ingroup stream_operators_blk + * + * \details + * Convert N streams of 1 item into 1 stream of N items. + * Repeat ad infinitum. + */ +class BLOCKS_API streams_to_stream : virtual public sync_interpolator +{ +public: + // gr::blocks::streams_to_stream::sptr + typedef boost::shared_ptr<streams_to_stream> sptr; /*! - * \brief Convert N streams of 1 item into a 1 stream of N items - * \ingroup stream_operators_blk + * Make a streams-to-stream block. * - * \details - * Convert N streams of 1 item into 1 stream of N items. - * Repeat ad infinitum. + * \param itemsize the item size of the stream + * \param nstreams number of streams to combine */ - class BLOCKS_API streams_to_stream : virtual public sync_interpolator - { - public: - // gr::blocks::streams_to_stream::sptr - typedef boost::shared_ptr<streams_to_stream> sptr; - - /*! - * Make a streams-to-stream block. - * - * \param itemsize the item size of the stream - * \param nstreams number of streams to combine - */ - static sptr make(size_t itemsize, size_t nstreams); - }; + static sptr make(size_t itemsize, size_t nstreams); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_STREAMS_TO_STREAM_H */ diff --git a/gr-blocks/include/gnuradio/blocks/streams_to_vector.h b/gr-blocks/include/gnuradio/blocks/streams_to_vector.h index a99eeedb00..4e5cc2f4c7 100644 --- a/gr-blocks/include/gnuradio/blocks/streams_to_vector.h +++ b/gr-blocks/include/gnuradio/blocks/streams_to_vector.h @@ -27,28 +27,28 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief convert N streams of items to 1 stream of vector length N + * \ingroup stream_operators_blk + */ +class BLOCKS_API streams_to_vector : virtual public sync_block +{ +public: + // gr::blocks::streams_to_vector::sptr + typedef boost::shared_ptr<streams_to_vector> sptr; /*! - * \brief convert N streams of items to 1 stream of vector length N - * \ingroup stream_operators_blk + * Make a stream-to-vector block. + * + * \param itemsize the item size of the stream + * \param nstreams number of streams to combine into a vector (vector size) */ - class BLOCKS_API streams_to_vector : virtual public sync_block - { - public: - // gr::blocks::streams_to_vector::sptr - typedef boost::shared_ptr<streams_to_vector> sptr; - - /*! - * Make a stream-to-vector block. - * - * \param itemsize the item size of the stream - * \param nstreams number of streams to combine into a vector (vector size) - */ - static sptr make(size_t itemsize, size_t nstreams); - }; + static sptr make(size_t itemsize, size_t nstreams); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_STREAMS_TO_VECTOR_H */ diff --git a/gr-blocks/include/gnuradio/blocks/stretch_ff.h b/gr-blocks/include/gnuradio/blocks/stretch_ff.h index d464ab34a1..24537317ff 100644 --- a/gr-blocks/include/gnuradio/blocks/stretch_ff.h +++ b/gr-blocks/include/gnuradio/blocks/stretch_ff.h @@ -27,34 +27,34 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief adjust y-range of an input vector by mapping to range + * (max-of-input, stipulated-min). Primarily for spectral + * signature matching by normalizing spectrum dynamic ranges. + * \ingroup stream_operators_blk + */ +class BLOCKS_API stretch_ff : virtual public sync_block +{ +public: + // gr::blocks::stretch_ff::sptr + typedef boost::shared_ptr<stretch_ff> sptr; /*! - * \brief adjust y-range of an input vector by mapping to range - * (max-of-input, stipulated-min). Primarily for spectral - * signature matching by normalizing spectrum dynamic ranges. - * \ingroup stream_operators_blk + * \brief Make a stretch block. + * + * \param lo Set low value for range. + * \param vlen vector length of input stream. */ - class BLOCKS_API stretch_ff : virtual public sync_block - { - public: - // gr::blocks::stretch_ff::sptr - typedef boost::shared_ptr<stretch_ff> sptr; - - /*! - * \brief Make a stretch block. - * - * \param lo Set low value for range. - * \param vlen vector length of input stream. - */ - static sptr make(float lo, size_t vlen=1); - - virtual float lo() const = 0; - virtual void set_lo(float lo) = 0; - virtual size_t vlen() const = 0; - }; - - } /* namespace blocks */ + static sptr make(float lo, size_t vlen = 1); + + virtual float lo() const = 0; + virtual void set_lo(float lo) = 0; + virtual size_t vlen() const = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_STRETCH_FF_H */ diff --git a/gr-blocks/include/gnuradio/blocks/sub.h b/gr-blocks/include/gnuradio/blocks/sub.h index 942cd727d2..39dc747181 100644 --- a/gr-blocks/include/gnuradio/blocks/sub.h +++ b/gr-blocks/include/gnuradio/blocks/sub.h @@ -29,31 +29,30 @@ #include <cstdint> namespace gr { - namespace blocks { - - /*! - * \brief output = input_0 - input_1 - ...) - * \ingroup math_operators_blk - * - * \details - * Subtract across all input streams. - */ -template<class T> - class BLOCKS_API sub : virtual public sync_block - { - public: - - // gr::blocks::sub::sptr - typedef boost::shared_ptr< sub<T> > sptr; - - static sptr make(size_t vlen=1); - }; +namespace blocks { + +/*! + * \brief output = input_0 - input_1 - ...) + * \ingroup math_operators_blk + * + * \details + * Subtract across all input streams. + */ +template <class T> +class BLOCKS_API sub : virtual public sync_block +{ +public: + // gr::blocks::sub::sptr + typedef boost::shared_ptr<sub<T>> sptr; + + static sptr make(size_t vlen = 1); +}; typedef sub<std::int16_t> sub_ss; typedef sub<std::int32_t> sub_ii; typedef sub<gr_complex> sub_cc; typedef sub<float> sub_ff; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* SUB_H */ diff --git a/gr-blocks/include/gnuradio/blocks/tag_debug.h b/gr-blocks/include/gnuradio/blocks/tag_debug.h index 3d7725c7d5..08f4ed983d 100644 --- a/gr-blocks/include/gnuradio/blocks/tag_debug.h +++ b/gr-blocks/include/gnuradio/blocks/tag_debug.h @@ -27,79 +27,79 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Bit bucket that prints out any tag received. + * \ingroup measurement_tools_blk + * \ingroup stream_tag_tools_blk + * \ingroup debug_tools_blk + * + * \details + * This block collects all tags sent to it on all input ports and + * displays them to stdout in a formatted way. The \p name + * parameter is used to identify which debug sink generated the + * tag, so when connecting a block to this debug sink, an + * appropriate name is something that identifies the input block. + * + * This block otherwise acts as a NULL sink in that items from the + * input stream are ignored. It is designed to be able to attach + * to any block and watch all tags streaming out of that block for + * debugging purposes. + * + * Specifying a key will allow this block to filter out all other + * tags and only display tags that match the given key. This can + * help clean up the output and allow you to focus in on a + * particular tag of interest. + * + * The tags from the last call to this work function are stored + * and can be retrieved using the function 'current_tags'. + */ +class BLOCKS_API tag_debug : virtual public sync_block +{ +public: + // gr::blocks::tag_debug::sptr + typedef boost::shared_ptr<tag_debug> sptr; /*! - * \brief Bit bucket that prints out any tag received. - * \ingroup measurement_tools_blk - * \ingroup stream_tag_tools_blk - * \ingroup debug_tools_blk - * - * \details - * This block collects all tags sent to it on all input ports and - * displays them to stdout in a formatted way. The \p name - * parameter is used to identify which debug sink generated the - * tag, so when connecting a block to this debug sink, an - * appropriate name is something that identifies the input block. - * - * This block otherwise acts as a NULL sink in that items from the - * input stream are ignored. It is designed to be able to attach - * to any block and watch all tags streaming out of that block for - * debugging purposes. + * Build a tag debug block * - * Specifying a key will allow this block to filter out all other - * tags and only display tags that match the given key. This can - * help clean up the output and allow you to focus in on a - * particular tag of interest. - * - * The tags from the last call to this work function are stored - * and can be retrieved using the function 'current_tags'. + * \param sizeof_stream_item size of the items in the incoming stream. + * \param name name to identify which debug sink generated the info. + * \param key_filter Specify a tag's key value to use as a filter. */ - class BLOCKS_API tag_debug : virtual public sync_block - { - public: - // gr::blocks::tag_debug::sptr - typedef boost::shared_ptr<tag_debug> sptr; - - /*! - * Build a tag debug block - * - * \param sizeof_stream_item size of the items in the incoming stream. - * \param name name to identify which debug sink generated the info. - * \param key_filter Specify a tag's key value to use as a filter. - */ - static sptr make(size_t sizeof_stream_item, - const std::string &name, - const std::string &key_filter=""); + static sptr make(size_t sizeof_stream_item, + const std::string& name, + const std::string& key_filter = ""); - /*! - * \brief Returns a vector of tag_t items as of the last call to - * work. - */ - virtual std::vector<tag_t> current_tags() = 0; + /*! + * \brief Returns a vector of tag_t items as of the last call to + * work. + */ + virtual std::vector<tag_t> current_tags() = 0; - /*! - * \brief Return the total number of tags in the tag queue. - */ - virtual int num_tags() = 0; + /*! + * \brief Return the total number of tags in the tag queue. + */ + virtual int num_tags() = 0; - /*! - * \brief Set the display of tags to stdout on/off. - */ - virtual void set_display(bool d) = 0; + /*! + * \brief Set the display of tags to stdout on/off. + */ + virtual void set_display(bool d) = 0; - /*! - * \brief Set a new key to filter with. - */ - virtual void set_key_filter(const std::string &key_filter) = 0; + /*! + * \brief Set a new key to filter with. + */ + virtual void set_key_filter(const std::string& key_filter) = 0; - /*! - * \brief Get the current filter key. - */ - virtual std::string key_filter() const = 0; - }; + /*! + * \brief Get the current filter key. + */ + virtual std::string key_filter() const = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_TAG_DEBUG_H */ diff --git a/gr-blocks/include/gnuradio/blocks/tag_gate.h b/gr-blocks/include/gnuradio/blocks/tag_gate.h index 644b5cf75a..e8d61e8d78 100644 --- a/gr-blocks/include/gnuradio/blocks/tag_gate.h +++ b/gr-blocks/include/gnuradio/blocks/tag_gate.h @@ -27,45 +27,44 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Control tag propagation. - * \ingroup blocks - * - * Use this block to stop tags from propagating. - */ - class BLOCKS_API tag_gate : virtual public gr::sync_block - { - public: - typedef boost::shared_ptr<tag_gate> sptr; +/*! + * \brief Control tag propagation. + * \ingroup blocks + * + * Use this block to stop tags from propagating. + */ +class BLOCKS_API tag_gate : virtual public gr::sync_block +{ +public: + typedef boost::shared_ptr<tag_gate> sptr; - virtual void set_propagation(bool propagate_tags) = 0; + virtual void set_propagation(bool propagate_tags) = 0; - /*! - * \param item_size Item size - * \param propagate_tags Set this to true to allow tags to pass through this block. - */ - static sptr make(size_t item_size, bool propagate_tags=false); + /*! + * \param item_size Item size + * \param propagate_tags Set this to true to allow tags to pass through this block. + */ + static sptr make(size_t item_size, bool propagate_tags = false); - /*! - * \brief Only gate stream tags with one specific key instead of all keys - * - * \details - * If set to "", all tags will be affected by the gate. - * If set to "foo", all tags with key different from "foo" will pass - * through. - */ - virtual void set_single_key(const std::string &single_key)=0; + /*! + * \brief Only gate stream tags with one specific key instead of all keys + * + * \details + * If set to "", all tags will be affected by the gate. + * If set to "foo", all tags with key different from "foo" will pass + * through. + */ + virtual void set_single_key(const std::string& single_key) = 0; - /*! - * \brief Get the current single key. - */ - virtual std::string single_key() const = 0; - }; + /*! + * \brief Get the current single key. + */ + virtual std::string single_key() const = 0; +}; - } // namespace blocks +} // namespace blocks } // namespace gr #endif /* INCLUDED_BLOCKS_TAG_GATE_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/tag_share.h b/gr-blocks/include/gnuradio/blocks/tag_share.h index 476076c6f5..7ff867b7fa 100644 --- a/gr-blocks/include/gnuradio/blocks/tag_share.h +++ b/gr-blocks/include/gnuradio/blocks/tag_share.h @@ -27,41 +27,41 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Adds tags from Input 1 onto Input 0's stream. + * \ingroup blocks + * + * \details + * This block utilizes the GNU Radio runtime's tag propagation policy + * to transfer or share Input 1's tags to Input 0's stream. This is + * useful when a signal is detected via a correlate_access_code_bb or + * a threshold crossing from a complex_to_mag_squared block. The tag from + * that detection is on the alternate stream, either bytes or floats. + * Often there is further signal processing that should be done on the + * complex stream. This block allows the detection tags to be added to + * the complex stream to trigger downstream processing without the need of + * redundant trigger inputs on all subsequent blocks. + */ +class BLOCKS_API tag_share : virtual public gr::sync_block +{ +public: + typedef boost::shared_ptr<tag_share> sptr; /*! - * \brief Adds tags from Input 1 onto Input 0's stream. - * \ingroup blocks - * - * \details - * This block utilizes the GNU Radio runtime's tag propagation policy - * to transfer or share Input 1's tags to Input 0's stream. This is - * useful when a signal is detected via a correlate_access_code_bb or - * a threshold crossing from a complex_to_mag_squared block. The tag from - * that detection is on the alternate stream, either bytes or floats. - * Often there is further signal processing that should be done on the - * complex stream. This block allows the detection tags to be added to - * the complex stream to trigger downstream processing without the need of - * redundant trigger inputs on all subsequent blocks. + * \param sizeof_io_item The size of the Input 0/Output 0 stream type. Input 0 + * stream items will be directly copied to Output 0. + * \param sizeof_share_item The size of the Input 1 (tag share) stream type. This + * stream type does not have to match the input/output stream type. Tags from + * Input 1's items will be combined with Input 0's item tags and outputted on + * Output 0. + * \param vlen The vector size of the input and output stream items */ - class BLOCKS_API tag_share : virtual public gr::sync_block - { - public: - typedef boost::shared_ptr<tag_share> sptr; - - /*! - * \param sizeof_io_item The size of the Input 0/Output 0 stream type. Input 0 - * stream items will be directly copied to Output 0. - * \param sizeof_share_item The size of the Input 1 (tag share) stream type. This - * stream type does not have to match the input/output stream type. Tags from - * Input 1's items will be combined with Input 0's item tags and outputted on - * Output 0. - * \param vlen The vector size of the input and output stream items - */ - static sptr make(size_t sizeof_io_item, size_t sizeof_share_item, size_t vlen = 1); - }; + static sptr make(size_t sizeof_io_item, size_t sizeof_share_item, size_t vlen = 1); +}; - } // namespace blocks +} // namespace blocks } // namespace gr #endif /* INCLUDED_BLOCKS_TAG_SHARE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/tagged_file_sink.h b/gr-blocks/include/gnuradio/blocks/tagged_file_sink.h index 61c2ad8e60..ea1cfe3ff9 100644 --- a/gr-blocks/include/gnuradio/blocks/tagged_file_sink.h +++ b/gr-blocks/include/gnuradio/blocks/tagged_file_sink.h @@ -27,41 +27,41 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief A file sink that uses tags to save files. + * \ingroup file_operators_blk + * \ingroup stream_tag_tools_blk + * + * \details + * The sink uses a tag with the key 'burst' to trigger the saving + * of the burst data to a new file. If the value of this tag is + * True, it will open a new file and start writing all incoming + * data to it. If the tag is False, it will close the file (if + * already opened). The file names are based on the time when the + * burst tag was seen. If there is an 'rx_time' tag (standard with + * UHD sources), that is used as the time. If no 'rx_time' tag is + * found, the new time is calculated based off the sample rate of + * the block. + */ +class BLOCKS_API tagged_file_sink : virtual public sync_block +{ +public: + // gr::blocks::tagged_file_sink::sptr + typedef boost::shared_ptr<tagged_file_sink> sptr; /*! - * \brief A file sink that uses tags to save files. - * \ingroup file_operators_blk - * \ingroup stream_tag_tools_blk + * \brief Build a tagged_file_sink block. * - * \details - * The sink uses a tag with the key 'burst' to trigger the saving - * of the burst data to a new file. If the value of this tag is - * True, it will open a new file and start writing all incoming - * data to it. If the tag is False, it will close the file (if - * already opened). The file names are based on the time when the - * burst tag was seen. If there is an 'rx_time' tag (standard with - * UHD sources), that is used as the time. If no 'rx_time' tag is - * found, the new time is calculated based off the sample rate of - * the block. + * \param itemsize The item size of the input data stream. + * \param samp_rate The sample rate used to determine the time + * difference between bursts */ - class BLOCKS_API tagged_file_sink : virtual public sync_block - { - public: - // gr::blocks::tagged_file_sink::sptr - typedef boost::shared_ptr<tagged_file_sink> sptr; - - /*! - * \brief Build a tagged_file_sink block. - * - * \param itemsize The item size of the input data stream. - * \param samp_rate The sample rate used to determine the time - * difference between bursts - */ - static sptr make(size_t itemsize, double samp_rate); - }; + static sptr make(size_t itemsize, double samp_rate); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_TAGGED_FILE_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/tagged_stream_align.h b/gr-blocks/include/gnuradio/blocks/tagged_stream_align.h index ae01198113..72548429fa 100644 --- a/gr-blocks/include/gnuradio/blocks/tagged_stream_align.h +++ b/gr-blocks/include/gnuradio/blocks/tagged_stream_align.h @@ -26,30 +26,30 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Align a stream to a tagged stream item + * \ingroup stream_operators_blk + * + * \details + * Takes an unaligned stream of tagged stream items and aligns to the first item + */ +class BLOCKS_API tagged_stream_align : virtual public block +{ +public: + typedef boost::shared_ptr<tagged_stream_align> sptr; /*! - * \brief Align a stream to a tagged stream item - * \ingroup stream_operators_blk + * Make a tagged stream align * - * \details - * Takes an unaligned stream of tagged stream items and aligns to the first item + * \param itemsize The size (in bytes) of the item datatype. + * \param lengthtagname Name of the TSB's length tag key. */ - class BLOCKS_API tagged_stream_align : virtual public block - { - public: - typedef boost::shared_ptr<tagged_stream_align> sptr; - - /*! - * Make a tagged stream align - * - * \param itemsize The size (in bytes) of the item datatype. - * \param lengthtagname Name of the TSB's length tag key. - */ - static sptr make(size_t itemsize, const std::string &lengthtagname); - }; + static sptr make(size_t itemsize, const std::string& lengthtagname); +}; - } // namespace blocks +} // namespace blocks } // namespace gr #endif /* INCLUDED_TAGGED_STREAM_ALIGN_H */ diff --git a/gr-blocks/include/gnuradio/blocks/tagged_stream_multiply_length.h b/gr-blocks/include/gnuradio/blocks/tagged_stream_multiply_length.h index 234b42c041..bdbe73a6f3 100644 --- a/gr-blocks/include/gnuradio/blocks/tagged_stream_multiply_length.h +++ b/gr-blocks/include/gnuradio/blocks/tagged_stream_multiply_length.h @@ -26,35 +26,34 @@ #include <gnuradio/tagged_stream_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Allows scaling of a tagged stream length tag + * \ingroup stream_operators_blk + * + * \details + * Searches for a specific tagged stream length tag and multiplies + * that length by a constant - for constant rate change blocks + * in a tagged stream + */ +class BLOCKS_API tagged_stream_multiply_length : virtual public block +{ +public: + typedef boost::shared_ptr<tagged_stream_multiply_length> sptr; + virtual void set_scalar(double scalar) = 0; /*! - * \brief Allows scaling of a tagged stream length tag - * \ingroup stream_operators_blk + * Make a tagged stream multiply_length block. * - * \details - * Searches for a specific tagged stream length tag and multiplies - * that length by a constant - for constant rate change blocks - * in a tagged stream + * \param itemsize Items size (number of bytes per item) + * \param lengthtagname Length tag key + * \param scalar value to scale length tag values by */ - class BLOCKS_API tagged_stream_multiply_length : virtual public block - { - public: - typedef boost::shared_ptr<tagged_stream_multiply_length> sptr; - virtual void set_scalar(double scalar) = 0; + static sptr make(size_t itemsize, const std::string& lengthtagname, double scalar); +}; - /*! - * Make a tagged stream multiply_length block. - * - * \param itemsize Items size (number of bytes per item) - * \param lengthtagname Length tag key - * \param scalar value to scale length tag values by - */ - static sptr make(size_t itemsize, const std::string &lengthtagname, double scalar); - }; - - } // namespace blocks +} // namespace blocks } // namespace gr #endif /* INCLUDED_TAGGED_STREAM_MULTIPLY_LENGTH_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/tagged_stream_mux.h b/gr-blocks/include/gnuradio/blocks/tagged_stream_mux.h index b7f5685ae1..711964fe7b 100644 --- a/gr-blocks/include/gnuradio/blocks/tagged_stream_mux.h +++ b/gr-blocks/include/gnuradio/blocks/tagged_stream_mux.h @@ -26,44 +26,45 @@ #include <gnuradio/tagged_stream_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Combines tagged streams. + * \ingroup stream_operators_blk + * + * \details + * Takes N streams as input. Each stream is tagged with packet lengths. + * Packets are output sequentially from each input stream. + * + * The output signal has a new length tag, which is the sum of all + * individual length tags. The old length tags are discarded. + * + * All other tags are propagated as expected, i.e. they stay associated + * with the same input item. + * There are cases when this behaviour is undesirable. One special case + * is when a tag at the first element (the head item) of one input port + * must stay on the head item of the output port. To achieve this, + * set \p tag_preserve_head_pos to the port that will receive these special + * tags. + */ +class BLOCKS_API tagged_stream_mux : virtual public tagged_stream_block +{ +public: + typedef boost::shared_ptr<tagged_stream_mux> sptr; /*! - * \brief Combines tagged streams. - * \ingroup stream_operators_blk + * Make a tagged stream mux block. * - * \details - * Takes N streams as input. Each stream is tagged with packet lengths. - * Packets are output sequentially from each input stream. - * - * The output signal has a new length tag, which is the sum of all - * individual length tags. The old length tags are discarded. - * - * All other tags are propagated as expected, i.e. they stay associated - * with the same input item. - * There are cases when this behaviour is undesirable. One special case - * is when a tag at the first element (the head item) of one input port - * must stay on the head item of the output port. To achieve this, - * set \p tag_preserve_head_pos to the port that will receive these special - * tags. + * \param itemsize Items size (number of bytes per item) + * \param lengthtagname Length tag key + * \param tag_preserve_head_pos Preserves the head position of tags on this input port */ - class BLOCKS_API tagged_stream_mux : virtual public tagged_stream_block - { - public: - typedef boost::shared_ptr<tagged_stream_mux> sptr; + static sptr make(size_t itemsize, + const std::string& lengthtagname, + unsigned int tag_preserve_head_pos = 0); +}; - /*! - * Make a tagged stream mux block. - * - * \param itemsize Items size (number of bytes per item) - * \param lengthtagname Length tag key - * \param tag_preserve_head_pos Preserves the head position of tags on this input port - */ - static sptr make(size_t itemsize, const std::string &lengthtagname, unsigned int tag_preserve_head_pos=0); - }; - - } // namespace blocks +} // namespace blocks } // namespace gr #endif /* INCLUDED_TAGGED_STREAM_MUX_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/tagged_stream_to_pdu.h b/gr-blocks/include/gnuradio/blocks/tagged_stream_to_pdu.h index af3279217e..4116d5b364 100644 --- a/gr-blocks/include/gnuradio/blocks/tagged_stream_to_pdu.h +++ b/gr-blocks/include/gnuradio/blocks/tagged_stream_to_pdu.h @@ -28,34 +28,34 @@ #include <gnuradio/tagged_stream_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Turns received stream data and tags into PDUs and sends + * them through a message port. + * \ingroup message_tools_blk + * + * The sent message is a PMT-pair (created by pmt::cons()). The + * first element is a dictionary containing all the tags. The + * second is a vector containing the actual data. + */ +class BLOCKS_API tagged_stream_to_pdu : virtual public tagged_stream_block +{ +public: + // gr::blocks::tagged_stream_to_pdu::sptr + typedef boost::shared_ptr<tagged_stream_to_pdu> sptr; /*! - * \brief Turns received stream data and tags into PDUs and sends - * them through a message port. - * \ingroup message_tools_blk - * - * The sent message is a PMT-pair (created by pmt::cons()). The - * first element is a dictionary containing all the tags. The - * second is a vector containing the actual data. + * \brief Construct a tagged_stream_to_pdu block + * \param type PDU type of pdu::vector_type + * \param lengthtagname The name of the tag that specifies + * how long the packet is. */ - class BLOCKS_API tagged_stream_to_pdu : virtual public tagged_stream_block - { - public: - // gr::blocks::tagged_stream_to_pdu::sptr - typedef boost::shared_ptr<tagged_stream_to_pdu> sptr; - - /*! - * \brief Construct a tagged_stream_to_pdu block - * \param type PDU type of pdu::vector_type - * \param lengthtagname The name of the tag that specifies - * how long the packet is. - */ - static sptr make(pdu::vector_type type, - const std::string& lengthtagname="packet_len"); - }; + static sptr make(pdu::vector_type type, + const std::string& lengthtagname = "packet_len"); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_TAGGED_STREAM_TO_PDU_H */ diff --git a/gr-blocks/include/gnuradio/blocks/tags_strobe.h b/gr-blocks/include/gnuradio/blocks/tags_strobe.h index eb04f01415..4429f2ec35 100644 --- a/gr-blocks/include/gnuradio/blocks/tags_strobe.h +++ b/gr-blocks/include/gnuradio/blocks/tags_strobe.h @@ -27,73 +27,74 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Send tags at defined interval + * \ingroup debug_blk + * + * \details + * Sends a tag with key 'strobe' and a user-defined value (as a + * PMT) every \p nsamps number of samples. Useful for + * testing/debugging the tags system. + * + * Because tags are sent with a data stream, this is a source + * block that acts identical to a null_source block. + */ +class BLOCKS_API tags_strobe : virtual public sync_block +{ +public: + // gr::blocks::tags_strobe::sptr + typedef boost::shared_ptr<tags_strobe> sptr; /*! - * \brief Send tags at defined interval - * \ingroup debug_blk - * - * \details - * Sends a tag with key 'strobe' and a user-defined value (as a - * PMT) every \p nsamps number of samples. Useful for - * testing/debugging the tags system. + * Make a tags stobe block to send tags with value \p value + * every \p nsamps number of samples. * - * Because tags are sent with a data stream, this is a source - * block that acts identical to a null_source block. + * \param sizeof_stream_item size of the stream items in bytes. + * \param value The value of the tags to send, as a PMT. + * \param nsamps the number of samples between each tag. + * \param key The tag key to sent */ - class BLOCKS_API tags_strobe : virtual public sync_block - { - public: - // gr::blocks::tags_strobe::sptr - typedef boost::shared_ptr<tags_strobe> sptr; + static sptr make(size_t sizeof_stream_item, + pmt::pmt_t value, + uint64_t nsamps, + pmt::pmt_t key = pmt::intern("strobe")); - /*! - * Make a tags stobe block to send tags with value \p value - * every \p nsamps number of samples. - * - * \param sizeof_stream_item size of the stream items in bytes. - * \param value The value of the tags to send, as a PMT. - * \param nsamps the number of samples between each tag. - * \param key The tag key to sent - */ - static sptr make(size_t sizeof_stream_item, - pmt::pmt_t value, uint64_t nsamps, pmt::pmt_t key = pmt::intern("strobe")); - - /*! - * Reset the value of the tags being sent. - * \param value The value of the tags to send as a PMT. - */ - virtual void set_value(pmt::pmt_t value) = 0; - - /*! - * Change the tag key we are sending - */ - virtual void set_key(pmt::pmt_t key) = 0; + /*! + * Reset the value of the tags being sent. + * \param value The value of the tags to send as a PMT. + */ + virtual void set_value(pmt::pmt_t value) = 0; - /*! - * Get the value of the tags being sent. - */ - virtual pmt::pmt_t value() const = 0; + /*! + * Change the tag key we are sending + */ + virtual void set_key(pmt::pmt_t key) = 0; - /*! - * Get the key of the tags being sent. - */ - virtual pmt::pmt_t key() const = 0; + /*! + * Get the value of the tags being sent. + */ + virtual pmt::pmt_t value() const = 0; - /*! - * Reset the sending interval. - * \param nsamps the number of samples between each tag - */ - virtual void set_nsamps(uint64_t nsamps) = 0; + /*! + * Get the key of the tags being sent. + */ + virtual pmt::pmt_t key() const = 0; - /*! - * Get the number of samples between the tag strobe. - */ - virtual uint64_t nsamps() const = 0; + /*! + * Reset the sending interval. + * \param nsamps the number of samples between each tag + */ + virtual void set_nsamps(uint64_t nsamps) = 0; - }; + /*! + * Get the number of samples between the tag strobe. + */ + virtual uint64_t nsamps() const = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_TAGS_STROBE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/tcp_server_sink.h b/gr-blocks/include/gnuradio/blocks/tcp_server_sink.h index 8720577824..534e9970ca 100644 --- a/gr-blocks/include/gnuradio/blocks/tcp_server_sink.h +++ b/gr-blocks/include/gnuradio/blocks/tcp_server_sink.h @@ -27,40 +27,39 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Send stream through a TCP socket. + * \ingroup networking_tools_blk + * + * \details + * Listen for incoming TCP connection(s). Duplicate data for each + * opened connection. Optionally can wait until first client connects + * before streaming starts. + */ +class BLOCKS_API tcp_server_sink : virtual public gr::sync_block +{ +public: + // gr::blocks::tcp_server_sink::sptr + typedef boost::shared_ptr<tcp_server_sink> sptr; /*! - * \brief Send stream through a TCP socket. - * \ingroup networking_tools_blk + * \brief TCP Server Sink Constructor * - * \details - * Listen for incoming TCP connection(s). Duplicate data for each - * opened connection. Optionally can wait until first client connects - * before streaming starts. + * \param itemsize The size (in bytes) of the item datatype + * \param host The name or IP address of interface to bind to. + * \param port Port where to listen. + * \param noblock If false, wait until first client connects before + * streaming starts. In non blocking mode + * (noblock=true), drop data onto floor if no client + * is connected. */ - class BLOCKS_API tcp_server_sink : virtual public gr::sync_block - { - public: - // gr::blocks::tcp_server_sink::sptr - typedef boost::shared_ptr<tcp_server_sink> sptr; - - /*! - * \brief TCP Server Sink Constructor - * - * \param itemsize The size (in bytes) of the item datatype - * \param host The name or IP address of interface to bind to. - * \param port Port where to listen. - * \param noblock If false, wait until first client connects before - * streaming starts. In non blocking mode - * (noblock=true), drop data onto floor if no client - * is connected. - */ - static sptr make(size_t itemsize, - const std::string &host, int port, - bool noblock = false); - }; + static sptr + make(size_t itemsize, const std::string& host, int port, bool noblock = false); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_TCP_SERVER_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/test_tag_variable_rate_ff.h b/gr-blocks/include/gnuradio/blocks/test_tag_variable_rate_ff.h index 7894ad525c..593c47c18c 100644 --- a/gr-blocks/include/gnuradio/blocks/test_tag_variable_rate_ff.h +++ b/gr-blocks/include/gnuradio/blocks/test_tag_variable_rate_ff.h @@ -27,53 +27,52 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Used for testing tag propagation. + * \ingroup measurement_tools_blk + * \ingroup stream_tag_tools_blk + * \ingroup debug_tools_blk + * + * This block resamples the stream by a factor that starts at 0.5 + * but varies around by some random walk. The relative rate of the + * block is initialized to 0.5 and the random number generator is + * seeded based on the time. For each input, if the random number + * is >= 0.5, the relative rate is increased by \p update_step; + * otherwise, it is decreased by \p update_step. + * + * The rate of the change of the resampling factor is set by the + * flag \p update_once. If this is set to true, then the rate is + * only updated once per work function. If it is set to false + * (default), then the rate is changed with every input sample. + * + * The block's ctor sets the propagation policy to TPP_DONT to + * stop tags from automatically propagating. Instead, we handle + * the tag propagation ourselves from within the work + * function. Because the relative_rate changes so fast, the tag + * placement cannot be based on a single factor after the call to + * work and must be handled when the samples are and based on the + * current resampling rate. + */ +class BLOCKS_API test_tag_variable_rate_ff : virtual public block +{ +public: + // gr::blocks::test_tag_variable_rate_ff::sptr + typedef boost::shared_ptr<test_tag_variable_rate_ff> sptr; /*! - * \brief Used for testing tag propagation. - * \ingroup measurement_tools_blk - * \ingroup stream_tag_tools_blk - * \ingroup debug_tools_blk - * - * This block resamples the stream by a factor that starts at 0.5 - * but varies around by some random walk. The relative rate of the - * block is initialized to 0.5 and the random number generator is - * seeded based on the time. For each input, if the random number - * is >= 0.5, the relative rate is increased by \p update_step; - * otherwise, it is decreased by \p update_step. + * Build a test_tag_variable_rate_ff block. * - * The rate of the change of the resampling factor is set by the - * flag \p update_once. If this is set to true, then the rate is - * only updated once per work function. If it is set to false - * (default), then the rate is changed with every input sample. - * - * The block's ctor sets the propagation policy to TPP_DONT to - * stop tags from automatically propagating. Instead, we handle - * the tag propagation ourselves from within the work - * function. Because the relative_rate changes so fast, the tag - * placement cannot be based on a single factor after the call to - * work and must be handled when the samples are and based on the - * current resampling rate. + * \param update_once Update the resampling rate once per call + * to work (default=false). + * \param update_step How much to adjust the resampling rate by + * when the update occurs (default=0.001). */ - class BLOCKS_API test_tag_variable_rate_ff : virtual public block - { - public: - // gr::blocks::test_tag_variable_rate_ff::sptr - typedef boost::shared_ptr<test_tag_variable_rate_ff> sptr; - - /*! - * Build a test_tag_variable_rate_ff block. - * - * \param update_once Update the resampling rate once per call - * to work (default=false). - * \param update_step How much to adjust the resampling rate by - * when the update occurs (default=0.001). - */ - static sptr make(bool update_once=false, - double update_step=0.001); - }; + static sptr make(bool update_once = false, double update_step = 0.001); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_TEST_TAG_VARIABLE_RATE_FF_H */ diff --git a/gr-blocks/include/gnuradio/blocks/threshold_ff.h b/gr-blocks/include/gnuradio/blocks/threshold_ff.h index b872af0986..1fb9b2516f 100644 --- a/gr-blocks/include/gnuradio/blocks/threshold_ff.h +++ b/gr-blocks/include/gnuradio/blocks/threshold_ff.h @@ -27,41 +27,41 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Output a 1 or zero based on a threshold value. - * \ingroup level_controllers_blk - * - * \details - * Test the incoming signal against a threshold. If the signal - * excedes the \p hi value, it will output a 1 until the signal - * falls below the \p lo value. - */ - class BLOCKS_API threshold_ff : virtual public sync_block - { - public: - // gr::blocks::threshold_ff::sptr - typedef boost::shared_ptr<threshold_ff> sptr; +/*! + * \brief Output a 1 or zero based on a threshold value. + * \ingroup level_controllers_blk + * + * \details + * Test the incoming signal against a threshold. If the signal + * excedes the \p hi value, it will output a 1 until the signal + * falls below the \p lo value. + */ +class BLOCKS_API threshold_ff : virtual public sync_block +{ +public: + // gr::blocks::threshold_ff::sptr + typedef boost::shared_ptr<threshold_ff> sptr; - /* \brief Create a threadshold block. - * \param lo Threshold input signal needs to drop below to - * change state to 0. - * \param hi Threshold input signal needs to rise above to - * change state to 1. - * \param initial_state Initial state of the block (0 or 1). - */ - static sptr make(float lo, float hi, float initial_state=0); + /* \brief Create a threadshold block. + * \param lo Threshold input signal needs to drop below to + * change state to 0. + * \param hi Threshold input signal needs to rise above to + * change state to 1. + * \param initial_state Initial state of the block (0 or 1). + */ + static sptr make(float lo, float hi, float initial_state = 0); - virtual float lo () const = 0; - virtual void set_lo (float lo) = 0; - virtual float hi () const = 0; - virtual void set_hi (float hi) = 0; - virtual float last_state () const = 0; - virtual void set_last_state (float last_state) = 0; - }; + virtual float lo() const = 0; + virtual void set_lo(float lo) = 0; + virtual float hi() const = 0; + virtual void set_hi(float hi) = 0; + virtual float last_state() const = 0; + virtual void set_last_state(float last_state) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_THRESHOLD_FF_H */ diff --git a/gr-blocks/include/gnuradio/blocks/throttle.h b/gr-blocks/include/gnuradio/blocks/throttle.h index fa38eae09c..a93b14c192 100644 --- a/gr-blocks/include/gnuradio/blocks/throttle.h +++ b/gr-blocks/include/gnuradio/blocks/throttle.h @@ -27,37 +27,37 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { - - /*! - * \brief throttle flow of samples such that the average rate does - * not exceed samples_per_sec. - * \ingroup misc_blk - * - * \details - * input: one stream of itemsize; output: one stream of itemsize - * - * N.B. this should only be used in GUI apps where there is no - * other rate limiting block. It is not intended nor effective at - * precisely controlling the rate of samples. That should be - * controlled by a source or sink tied to sample clock. E.g., a - * USRP or audio card. - */ - class BLOCKS_API throttle : virtual public sync_block - { - public: - typedef boost::shared_ptr<throttle> sptr; - - static sptr make(size_t itemsize, double samples_per_sec, bool ignore_tags=true); - - //! Sets the sample rate in samples per second. - virtual void set_sample_rate(double rate) = 0; - - //! Get the sample rate in samples per second. - virtual double sample_rate() const = 0; - }; - - } /* namespace blocks */ +namespace blocks { + +/*! + * \brief throttle flow of samples such that the average rate does + * not exceed samples_per_sec. + * \ingroup misc_blk + * + * \details + * input: one stream of itemsize; output: one stream of itemsize + * + * N.B. this should only be used in GUI apps where there is no + * other rate limiting block. It is not intended nor effective at + * precisely controlling the rate of samples. That should be + * controlled by a source or sink tied to sample clock. E.g., a + * USRP or audio card. + */ +class BLOCKS_API throttle : virtual public sync_block +{ +public: + typedef boost::shared_ptr<throttle> sptr; + + static sptr make(size_t itemsize, double samples_per_sec, bool ignore_tags = true); + + //! Sets the sample rate in samples per second. + virtual void set_sample_rate(double rate) = 0; + + //! Get the sample rate in samples per second. + virtual double sample_rate() const = 0; +}; + +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_THROTTLE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/transcendental.h b/gr-blocks/include/gnuradio/blocks/transcendental.h index cc7f6897d9..c93ad0d88a 100644 --- a/gr-blocks/include/gnuradio/blocks/transcendental.h +++ b/gr-blocks/include/gnuradio/blocks/transcendental.h @@ -28,31 +28,30 @@ #include <string> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief A block that performs various transcendental math operations. - * \ingroup math_operators_blk - * - * \details - * Possible function names can be found in the cmath library. IO - * may be either complex or real, double or single precision. - * - * Possible type strings: float, double, complex_float, complex_double - * - * output[i] = trans_fcn(input[i]) - */ - class BLOCKS_API transcendental : virtual public sync_block - { - public: - // gr::blocks::transcendental::sptr - typedef boost::shared_ptr<transcendental> sptr; +/*! + * \brief A block that performs various transcendental math operations. + * \ingroup math_operators_blk + * + * \details + * Possible function names can be found in the cmath library. IO + * may be either complex or real, double or single precision. + * + * Possible type strings: float, double, complex_float, complex_double + * + * output[i] = trans_fcn(input[i]) + */ +class BLOCKS_API transcendental : virtual public sync_block +{ +public: + // gr::blocks::transcendental::sptr + typedef boost::shared_ptr<transcendental> sptr; - static sptr make(const std::string &name, - const std::string &type="float"); - }; + static sptr make(const std::string& name, const std::string& type = "float"); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_TRANSCENDENTAL_H */ diff --git a/gr-blocks/include/gnuradio/blocks/tsb_vector_sink.h b/gr-blocks/include/gnuradio/blocks/tsb_vector_sink.h index 4e11e7761f..94b32b8f61 100644 --- a/gr-blocks/include/gnuradio/blocks/tsb_vector_sink.h +++ b/gr-blocks/include/gnuradio/blocks/tsb_vector_sink.h @@ -29,42 +29,40 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief A vector sink for tagged streams. - * - * Unlike a gr::blocks::vector_sink_f, this only works with tagged streams. - * - * \ingroup blocks - */ -template<class T> - class BLOCKS_API tsb_vector_sink : virtual public gr::tagged_stream_block - { - public: - typedef boost::shared_ptr< tsb_vector_sink<T> > sptr; +/*! + * \brief A vector sink for tagged streams. + * + * Unlike a gr::blocks::vector_sink_f, this only works with tagged streams. + * + * \ingroup blocks + */ +template <class T> +class BLOCKS_API tsb_vector_sink : virtual public gr::tagged_stream_block +{ +public: + typedef boost::shared_ptr<tsb_vector_sink<T>> sptr; - virtual void reset() = 0; - virtual std::vector<std::vector<T> > data() const = 0; - /*! Doesn't include the TSB tags. - */ - virtual std::vector<tag_t> tags() const = 0; + virtual void reset() = 0; + virtual std::vector<std::vector<T>> data() const = 0; + /*! Doesn't include the TSB tags. + */ + virtual std::vector<tag_t> tags() const = 0; - /*! - * \param vlen Vector length - * \param tsb_key Tagged Stream Key - */ - static sptr make(unsigned int vlen=1, - const std::string &tsb_key="ts_last"); - }; - typedef tsb_vector_sink<std::uint8_t> tsb_vector_sink_b; - typedef tsb_vector_sink<std::uint32_t> tsb_vector_sink_i; - typedef tsb_vector_sink<std::uint16_t> tsb_vector_sink_s; - typedef tsb_vector_sink<float> tsb_vector_sink_f; - typedef tsb_vector_sink<gr_complex> tsb_vector_sink_c; + /*! + * \param vlen Vector length + * \param tsb_key Tagged Stream Key + */ + static sptr make(unsigned int vlen = 1, const std::string& tsb_key = "ts_last"); +}; +typedef tsb_vector_sink<std::uint8_t> tsb_vector_sink_b; +typedef tsb_vector_sink<std::uint32_t> tsb_vector_sink_i; +typedef tsb_vector_sink<std::uint16_t> tsb_vector_sink_s; +typedef tsb_vector_sink<float> tsb_vector_sink_f; +typedef tsb_vector_sink<gr_complex> tsb_vector_sink_c; - } // namespace blocks +} // namespace blocks } // namespace gr #endif /* TSB_VECTOR_SINK_H */ - diff --git a/gr-blocks/include/gnuradio/blocks/tuntap_pdu.h b/gr-blocks/include/gnuradio/blocks/tuntap_pdu.h index a34bab0d83..cda9b586c0 100644 --- a/gr-blocks/include/gnuradio/blocks/tuntap_pdu.h +++ b/gr-blocks/include/gnuradio/blocks/tuntap_pdu.h @@ -27,28 +27,28 @@ #include <gnuradio/block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Creates TUNTAP interface and translates traffic to PDUs + * \ingroup networking_tools_blk + */ +class BLOCKS_API tuntap_pdu : virtual public block +{ +public: + // gr::blocks::tuntap_pdu::sptr + typedef boost::shared_ptr<tuntap_pdu> sptr; /*! - * \brief Creates TUNTAP interface and translates traffic to PDUs - * \ingroup networking_tools_blk + * \brief Construct a TUNTAP PDU interface + * \param dev Device name to create + * \param MTU Maximum Transmission Unit size + * \param istunflag Flag to indicate TUN or Tap */ - class BLOCKS_API tuntap_pdu : virtual public block - { - public: - // gr::blocks::tuntap_pdu::sptr - typedef boost::shared_ptr<tuntap_pdu> sptr; - - /*! - * \brief Construct a TUNTAP PDU interface - * \param dev Device name to create - * \param MTU Maximum Transmission Unit size - * \param istunflag Flag to indicate TUN or Tap - */ - static sptr make(std::string dev, int MTU=10000, bool istunflag=false); - }; + static sptr make(std::string dev, int MTU = 10000, bool istunflag = false); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_TUNTAP_PDU_H */ diff --git a/gr-blocks/include/gnuradio/blocks/uchar_to_float.h b/gr-blocks/include/gnuradio/blocks/uchar_to_float.h index 2e22afe4da..99227b2291 100644 --- a/gr-blocks/include/gnuradio/blocks/uchar_to_float.h +++ b/gr-blocks/include/gnuradio/blocks/uchar_to_float.h @@ -27,25 +27,25 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert stream of unsigned chars to a stream of floats + * \ingroup type_converters_blk + */ +class BLOCKS_API uchar_to_float : virtual public sync_block +{ +public: + // gr::blocks::uchar_to_float_ff::sptr + typedef boost::shared_ptr<uchar_to_float> sptr; /*! - * \brief Convert stream of unsigned chars to a stream of floats - * \ingroup type_converters_blk + * Build a uchar to float block. */ - class BLOCKS_API uchar_to_float : virtual public sync_block - { - public: - // gr::blocks::uchar_to_float_ff::sptr - typedef boost::shared_ptr<uchar_to_float> sptr; - - /*! - * Build a uchar to float block. - */ - static sptr make(); - }; + static sptr make(); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_UCHAR_TO_FLOAT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/udp_sink.h b/gr-blocks/include/gnuradio/blocks/udp_sink.h index 76e2a2184b..c6278079f3 100644 --- a/gr-blocks/include/gnuradio/blocks/udp_sink.h +++ b/gr-blocks/include/gnuradio/blocks/udp_sink.h @@ -27,55 +27,57 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Write stream to an UDP socket. + * \ingroup networking_tools_blk + */ +class BLOCKS_API udp_sink : virtual public sync_block +{ +public: + // gr::blocks::udp_sink::sptr + typedef boost::shared_ptr<udp_sink> sptr; /*! - * \brief Write stream to an UDP socket. - * \ingroup networking_tools_blk + * \brief UDP Sink Constructor + * + * \param itemsize The size (in bytes) of the item datatype + * \param host The name or IP address of the receiving host; use + * NULL or None for no connection + * \param port Destination port to connect to on receiving host + * \param payload_size UDP payload size by default set to + * 1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header)) + * \param eof Send zero-length packet on disconnect */ - class BLOCKS_API udp_sink : virtual public sync_block - { - public: - // gr::blocks::udp_sink::sptr - typedef boost::shared_ptr<udp_sink> sptr; + static sptr make(size_t itemsize, + const std::string& host, + int port, + int payload_size = 1472, + bool eof = true); - /*! - * \brief UDP Sink Constructor - * - * \param itemsize The size (in bytes) of the item datatype - * \param host The name or IP address of the receiving host; use - * NULL or None for no connection - * \param port Destination port to connect to on receiving host - * \param payload_size UDP payload size by default set to - * 1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header)) - * \param eof Send zero-length packet on disconnect - */ - static sptr make(size_t itemsize, - const std::string &host, int port, - int payload_size=1472, bool eof=true); + /*! \brief return the PAYLOAD_SIZE of the socket */ + virtual int payload_size() = 0; - /*! \brief return the PAYLOAD_SIZE of the socket */ - virtual int payload_size() = 0; - - /*! \brief Change the connection to a new destination - * - * \param host The name or IP address of the receiving host; use - * NULL or None to break the connection without closing - * \param port Destination port to connect to on receiving host - * - * Calls disconnect() to terminate any current connection first. - */ - virtual void connect(const std::string &host, int port) = 0; + /*! \brief Change the connection to a new destination + * + * \param host The name or IP address of the receiving host; use + * NULL or None to break the connection without closing + * \param port Destination port to connect to on receiving host + * + * Calls disconnect() to terminate any current connection first. + */ + virtual void connect(const std::string& host, int port) = 0; - /*! \brief Send zero-length packet (if eof is requested) then stop sending - * - * Zero-byte packets can be interpreted as EOF by gr_udp_source. - * Note that disconnect occurs automatically when the sink is - * destroyed, but not when its top_block stops.*/ - virtual void disconnect() = 0; - }; + /*! \brief Send zero-length packet (if eof is requested) then stop sending + * + * Zero-byte packets can be interpreted as EOF by gr_udp_source. + * Note that disconnect occurs automatically when the sink is + * destroyed, but not when its top_block stops.*/ + virtual void disconnect() = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_UDP_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/udp_source.h b/gr-blocks/include/gnuradio/blocks/udp_source.h index d1b4062b79..3581dfddff 100644 --- a/gr-blocks/include/gnuradio/blocks/udp_source.h +++ b/gr-blocks/include/gnuradio/blocks/udp_source.h @@ -27,58 +27,59 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Read stream from an UDP socket. + * \ingroup networking_tools_blk + */ +class BLOCKS_API udp_source : virtual public sync_block +{ +public: + // gr::blocks::udp_source::sptr + typedef boost::shared_ptr<udp_source> sptr; /*! - * \brief Read stream from an UDP socket. - * \ingroup networking_tools_blk + * \brief UDP Source Constructor + * + * \param itemsize The size (in bytes) of the item datatype + * \param host The name or IP address of the transmitting host; can be + * NULL, None, or "0.0.0.0" to allow reading from any + * interface on the host + * \param port The port number on which to receive data; use 0 to + * have the system assign an unused port number + * \param payload_size UDP payload size by default set to 1472 = + * (1500 MTU - (8 byte UDP header) - (20 byte IP header)) + * \param eof Interpret zero-length packet as EOF (default: true) */ - class BLOCKS_API udp_source : virtual public sync_block - { - public: - // gr::blocks::udp_source::sptr - typedef boost::shared_ptr<udp_source> sptr; - - /*! - * \brief UDP Source Constructor - * - * \param itemsize The size (in bytes) of the item datatype - * \param host The name or IP address of the transmitting host; can be - * NULL, None, or "0.0.0.0" to allow reading from any - * interface on the host - * \param port The port number on which to receive data; use 0 to - * have the system assign an unused port number - * \param payload_size UDP payload size by default set to 1472 = - * (1500 MTU - (8 byte UDP header) - (20 byte IP header)) - * \param eof Interpret zero-length packet as EOF (default: true) - */ - static sptr make(size_t itemsize, - const std::string &host, int port, - int payload_size=1472, - bool eof=true); + static sptr make(size_t itemsize, + const std::string& host, + int port, + int payload_size = 1472, + bool eof = true); - /*! \brief Change the connection to a new destination - * - * \param host The name or IP address of the receiving host; use - * NULL or None to break the connection without closing - * \param port Destination port to connect to on receiving host - * - * Calls disconnect() to terminate any current connection first. - */ - virtual void connect(const std::string &host, int port) = 0; + /*! \brief Change the connection to a new destination + * + * \param host The name or IP address of the receiving host; use + * NULL or None to break the connection without closing + * \param port Destination port to connect to on receiving host + * + * Calls disconnect() to terminate any current connection first. + */ + virtual void connect(const std::string& host, int port) = 0; - /*! \brief Cut the connection if we have one set up. - */ - virtual void disconnect() = 0; + /*! \brief Cut the connection if we have one set up. + */ + virtual void disconnect() = 0; - /*! \brief return the PAYLOAD_SIZE of the socket */ - virtual int payload_size() = 0; + /*! \brief return the PAYLOAD_SIZE of the socket */ + virtual int payload_size() = 0; - /*! \brief return the port number of the socket */ - virtual int get_port() = 0; - }; + /*! \brief return the port number of the socket */ + virtual int get_port() = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_UDP_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/unpack_k_bits.h b/gr-blocks/include/gnuradio/blocks/unpack_k_bits.h index 8d46e57edd..4c5342de7f 100644 --- a/gr-blocks/include/gnuradio/blocks/unpack_k_bits.h +++ b/gr-blocks/include/gnuradio/blocks/unpack_k_bits.h @@ -21,66 +21,66 @@ */ #ifndef INCLUDED_GR_BLOCKS_UNPACK_K_BITS_H -#define INCLUDED_GR_BLOCKS_UNPACK_K_BITS_H +#define INCLUDED_GR_BLOCKS_UNPACK_K_BITS_H #include <gnuradio/blocks/api.h> #include <vector> namespace gr { - namespace blocks { - namespace kernel { +namespace blocks { +namespace kernel { - /*! - * \brief Converts a byte with k relevant bits to k output bytes with 1 bit in the LSB. - * - * This is the algorithm kernel for the gr::blocks::unpack_k_bits_bb block. - * - * Example: - * k = 4 - * in = [0xf5, 0x08] - * out = [0,1,0,1, 1,0,0,0] - * - * k = 8 - * in = [0xf5, 0x08] - * out = [1,1,1,1, 0,1,0,1, 0,0,0,0, 1,0,0,0] - * \ingroup byte_operators_blk - */ - class BLOCKS_API unpack_k_bits - { - public: - /*! - * \brief Make an unpack_k_bits object. - * \param k number of bits to unpack. - */ - unpack_k_bits(unsigned k); - ~unpack_k_bits(); +/*! + * \brief Converts a byte with k relevant bits to k output bytes with 1 bit in the LSB. + * + * This is the algorithm kernel for the gr::blocks::unpack_k_bits_bb block. + * + * Example: + * k = 4 + * in = [0xf5, 0x08] + * out = [0,1,0,1, 1,0,0,0] + * + * k = 8 + * in = [0xf5, 0x08] + * out = [1,1,1,1, 0,1,0,1, 0,0,0,0, 1,0,0,0] + * \ingroup byte_operators_blk + */ +class BLOCKS_API unpack_k_bits +{ +public: + /*! + * \brief Make an unpack_k_bits object. + * \param k number of bits to unpack. + */ + unpack_k_bits(unsigned k); + ~unpack_k_bits(); - /*! - * \brief Perform the unpacking. - * - * This function performs no bounds checking. It assumes that the - * input, \p in, has of length \p nbytes and that the output - * vector, \p out, has k*nbytes available for writing. - * - * \param bits output vector (1-bit per byte) of the unpacked data - * \param bytes The input vector of bytes to unpack - * \param nbytes The number of input bytes - */ - void unpack(unsigned char *bits, const unsigned char *bytes, int nbytes) const; + /*! + * \brief Perform the unpacking. + * + * This function performs no bounds checking. It assumes that the + * input, \p in, has of length \p nbytes and that the output + * vector, \p out, has k*nbytes available for writing. + * + * \param bits output vector (1-bit per byte) of the unpacked data + * \param bytes The input vector of bytes to unpack + * \param nbytes The number of input bytes + */ + void unpack(unsigned char* bits, const unsigned char* bytes, int nbytes) const; - /*! - * Unpacks in reverse order from unpack(). - */ - void unpack_rev(unsigned char *bits, const unsigned char *bytes, int nbytes) const; + /*! + * Unpacks in reverse order from unpack(). + */ + void unpack_rev(unsigned char* bits, const unsigned char* bytes, int nbytes) const; - int k() const; + int k() const; - private: - unsigned d_k; - }; +private: + unsigned d_k; +}; - } /* namespace kernel */ - } /* namespace blocks */ +} /* namespace kernel */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_BLOCKS_UNPACK_K_BITS_BB_H */ diff --git a/gr-blocks/include/gnuradio/blocks/unpack_k_bits_bb.h b/gr-blocks/include/gnuradio/blocks/unpack_k_bits_bb.h index 2ed57e08bd..7aaa7eec2a 100644 --- a/gr-blocks/include/gnuradio/blocks/unpack_k_bits_bb.h +++ b/gr-blocks/include/gnuradio/blocks/unpack_k_bits_bb.h @@ -21,40 +21,40 @@ */ #ifndef INCLUDED_GR_UNPACK_K_BITS_BB_H -#define INCLUDED_GR_UNPACK_K_BITS_BB_H +#define INCLUDED_GR_UNPACK_K_BITS_BB_H #include <gnuradio/blocks/api.h> #include <gnuradio/sync_interpolator.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Converts a byte with k relevant bits to k output bytes with 1 bit in the LSB. + * + * This block picks the K least significant bits from a byte, and expands + * them into K bytes of 0 or 1. + * + * Example: + * k = 4 + * in = [0xf5, 0x08] + * out = [0,1,0,1, 1,0,0,0] + * \ingroup byte_operators_blk + */ +class BLOCKS_API unpack_k_bits_bb : virtual public sync_interpolator +{ +public: + // gr::blocks::unpack_k_bits_bb::sptr + typedef boost::shared_ptr<unpack_k_bits_bb> sptr; /*! - * \brief Converts a byte with k relevant bits to k output bytes with 1 bit in the LSB. - * - * This block picks the K least significant bits from a byte, and expands - * them into K bytes of 0 or 1. - * - * Example: - * k = 4 - * in = [0xf5, 0x08] - * out = [0,1,0,1, 1,0,0,0] - * \ingroup byte_operators_blk + * \brief Make an unpack_k_bits block. + * \param k number of bits to unpack. */ - class BLOCKS_API unpack_k_bits_bb : virtual public sync_interpolator - { - public: - // gr::blocks::unpack_k_bits_bb::sptr - typedef boost::shared_ptr<unpack_k_bits_bb> sptr; - - /*! - * \brief Make an unpack_k_bits block. - * \param k number of bits to unpack. - */ - static sptr make(unsigned k); - }; + static sptr make(unsigned k); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_UNPACK_K_BITS_BB_H */ diff --git a/gr-blocks/include/gnuradio/blocks/unpacked_to_packed.h b/gr-blocks/include/gnuradio/blocks/unpacked_to_packed.h index d23ff6cc12..9317e1add5 100644 --- a/gr-blocks/include/gnuradio/blocks/unpacked_to_packed.h +++ b/gr-blocks/include/gnuradio/blocks/unpacked_to_packed.h @@ -30,48 +30,47 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Convert a stream of unpacked bytes or shorts into a stream of packed bytes or shorts. - * \ingroup byte_operators_blk - * - * \details - * input: stream of T; output: stream of T - * - * This is the inverse of gr::blocks::packed_to_unpacked_XX. - * - * The low \p bits_per_chunk bits are extracted from each input - * byte or short. These bits are then packed densely into the - * output bytes or shorts, such that all 8 or 16 bits of the - * output bytes or shorts are filled with valid input bits. The - * right thing is done if bits_per_chunk is not a power of two. - * - * The combination of gr::blocks::packed_to_unpacked_XX followed by - * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the - * general case of mapping from a stream of bytes or shorts into - * arbitrary float or complex symbols. - * - * \sa gr::blocks::packed_to_unpacked_bb, gr::blocks::unpacked_to_packed_bb, - * \sa gr::blocks::packed_to_unpacked_ss, gr::blocks::unpacked_to_packed_ss, - * \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc. - * \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc. - */ -template<class T> - class BLOCKS_API unpacked_to_packed : virtual public block - { - public: - // gr::blocks::unpacked_to_packed::sptr - typedef boost::shared_ptr< unpacked_to_packed<T> > sptr; +/*! + * \brief Convert a stream of unpacked bytes or shorts into a stream of packed bytes or + * shorts. \ingroup byte_operators_blk + * + * \details + * input: stream of T; output: stream of T + * + * This is the inverse of gr::blocks::packed_to_unpacked_XX. + * + * The low \p bits_per_chunk bits are extracted from each input + * byte or short. These bits are then packed densely into the + * output bytes or shorts, such that all 8 or 16 bits of the + * output bytes or shorts are filled with valid input bits. The + * right thing is done if bits_per_chunk is not a power of two. + * + * The combination of gr::blocks::packed_to_unpacked_XX followed by + * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the + * general case of mapping from a stream of bytes or shorts into + * arbitrary float or complex symbols. + * + * \sa gr::blocks::packed_to_unpacked_bb, gr::blocks::unpacked_to_packed_bb, + * \sa gr::blocks::packed_to_unpacked_ss, gr::blocks::unpacked_to_packed_ss, + * \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc. + * \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc. + */ +template <class T> +class BLOCKS_API unpacked_to_packed : virtual public block +{ +public: + // gr::blocks::unpacked_to_packed::sptr + typedef boost::shared_ptr<unpacked_to_packed<T>> sptr; - static sptr make(unsigned int bits_per_chunk, - endianness_t endianness); - }; + static sptr make(unsigned int bits_per_chunk, endianness_t endianness); +}; typedef unpacked_to_packed<std::uint8_t> unpacked_to_packed_bb; typedef unpacked_to_packed<std::int16_t> unpacked_to_packed_ss; typedef unpacked_to_packed<std::int32_t> unpacked_to_packed_ii; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* UNPACKED_TO_PACKED_H */ diff --git a/gr-blocks/include/gnuradio/blocks/vco_c.h b/gr-blocks/include/gnuradio/blocks/vco_c.h index ab9723af5b..b897196238 100644 --- a/gr-blocks/include/gnuradio/blocks/vco_c.h +++ b/gr-blocks/include/gnuradio/blocks/vco_c.h @@ -27,33 +27,33 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief VCO - Voltage controlled oscillator + * \ingroup modulators_blk + * \ingroup waveform_generators_blk + * + * \details + * input: float stream of control voltages; output: complex oscillator output + */ +class BLOCKS_API vco_c : virtual public sync_block +{ +public: + // gr::blocks::vco_c::sptr + typedef boost::shared_ptr<vco_c> sptr; /*! * \brief VCO - Voltage controlled oscillator - * \ingroup modulators_blk - * \ingroup waveform_generators_blk * - * \details - * input: float stream of control voltages; output: complex oscillator output + * \param sampling_rate sampling rate (Hz) + * \param sensitivity units are radians/sec/volt + * \param amplitude output amplitude */ - class BLOCKS_API vco_c : virtual public sync_block - { - public: - // gr::blocks::vco_c::sptr - typedef boost::shared_ptr<vco_c> sptr; - - /*! - * \brief VCO - Voltage controlled oscillator - * - * \param sampling_rate sampling rate (Hz) - * \param sensitivity units are radians/sec/volt - * \param amplitude output amplitude - */ - static sptr make(double sampling_rate, double sensitivity, double amplitude); - }; + static sptr make(double sampling_rate, double sensitivity, double amplitude); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_VCO_C_H */ diff --git a/gr-blocks/include/gnuradio/blocks/vco_f.h b/gr-blocks/include/gnuradio/blocks/vco_f.h index 51d40af81b..48e7dd5e8b 100644 --- a/gr-blocks/include/gnuradio/blocks/vco_f.h +++ b/gr-blocks/include/gnuradio/blocks/vco_f.h @@ -27,33 +27,33 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief VCO - Voltage controlled oscillator + * \ingroup modulators_blk + * \ingroup waveform_generators_blk + * + * \details + * input: float stream of control voltages; output: float oscillator output + */ +class BLOCKS_API vco_f : virtual public sync_block +{ +public: + // gr::blocks::vco_f::sptr + typedef boost::shared_ptr<vco_f> sptr; /*! * \brief VCO - Voltage controlled oscillator - * \ingroup modulators_blk - * \ingroup waveform_generators_blk * - * \details - * input: float stream of control voltages; output: float oscillator output + * \param sampling_rate sampling rate (Hz) + * \param sensitivity units are radians/sec/volt + * \param amplitude output amplitude */ - class BLOCKS_API vco_f : virtual public sync_block - { - public: - // gr::blocks::vco_f::sptr - typedef boost::shared_ptr<vco_f> sptr; - - /*! - * \brief VCO - Voltage controlled oscillator - * - * \param sampling_rate sampling rate (Hz) - * \param sensitivity units are radians/sec/volt - * \param amplitude output amplitude - */ - static sptr make(double sampling_rate, double sensitivity, double amplitude); - }; + static sptr make(double sampling_rate, double sensitivity, double amplitude); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_VCO_F_H */ diff --git a/gr-blocks/include/gnuradio/blocks/vector_insert.h b/gr-blocks/include/gnuradio/blocks/vector_insert.h index cce50ed445..ee24adca36 100644 --- a/gr-blocks/include/gnuradio/blocks/vector_insert.h +++ b/gr-blocks/include/gnuradio/blocks/vector_insert.h @@ -29,39 +29,38 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief source of T's that gets its data from a vector + * \ingroup stream_operators_blk + */ +template <class T> +class BLOCKS_API vector_insert : virtual public block +{ +public: + // gr::blocks::vector_insert::sptr + typedef boost::shared_ptr<vector_insert<T>> sptr; /*! - * \brief source of T's that gets its data from a vector - * \ingroup stream_operators_blk + * Make vector insert block. + * + * \param data vector of data to insert + * \param periodicity number of samples between when to send \p data + * \param offset initial item offset of first insert */ -template<class T> - class BLOCKS_API vector_insert : virtual public block - { - public: - // gr::blocks::vector_insert::sptr - typedef boost::shared_ptr< vector_insert<T> > sptr; - - /*! - * Make vector insert block. - * - * \param data vector of data to insert - * \param periodicity number of samples between when to send \p data - * \param offset initial item offset of first insert - */ - static sptr make(const std::vector<T> &data, - int periodicity, int offset=0); + static sptr make(const std::vector<T>& data, int periodicity, int offset = 0); - virtual void rewind() = 0; - virtual void set_data(const std::vector<T> &data) = 0; - }; + virtual void rewind() = 0; + virtual void set_data(const std::vector<T>& data) = 0; +}; typedef vector_insert<std::uint8_t> vector_insert_b; typedef vector_insert<std::int16_t> vector_insert_s; typedef vector_insert<std::int32_t> vector_insert_i; typedef vector_insert<float> vector_insert_f; typedef vector_insert<gr_complex> vector_insert_c; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* VECTOR_INSERT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/vector_map.h b/gr-blocks/include/gnuradio/blocks/vector_map.h index bd0e74c9f3..bdf39f1355 100644 --- a/gr-blocks/include/gnuradio/blocks/vector_map.h +++ b/gr-blocks/include/gnuradio/blocks/vector_map.h @@ -28,45 +28,46 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Maps elements from a set of input vectors to a set of output vectors. + * \ingroup stream_operators_blk + * + * \details + * 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 sync_block +{ +public: + // gr::blocks::vector_map::sptr + typedef boost::shared_ptr<vector_map> sptr; /*! - * \brief Maps elements from a set of input vectors to a set of output vectors. - * \ingroup stream_operators_blk - * - * \details - * If in[i] is the input vector in the i'th stream then the output - * vector in the j'th stream is: + * Build a vector map block. * - * 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). + * \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 */ - class BLOCKS_API vector_map : virtual public 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); + 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; - }; + virtual void set_mapping(std::vector<std::vector<std::vector<size_t>>> mapping) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_VECTOR_MAP_H */ diff --git a/gr-blocks/include/gnuradio/blocks/vector_sink.h b/gr-blocks/include/gnuradio/blocks/vector_sink.h index 581e0be970..c180bd5e53 100644 --- a/gr-blocks/include/gnuradio/blocks/vector_sink.h +++ b/gr-blocks/include/gnuradio/blocks/vector_sink.h @@ -29,42 +29,42 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief T sink that writes to a vector + * \ingroup debug_tools_blk + */ +template <class T> +class BLOCKS_API vector_sink : virtual public sync_block +{ +public: + // gr::blocks::vector_sink::sptr + typedef boost::shared_ptr<vector_sink<T>> sptr; /*! - * \brief T sink that writes to a vector - * \ingroup debug_tools_blk + * \brief Make a new instance of the vector source, and return a shared pointer to it. + * \param vlen length of vector items + * \param reserve_items reserve space in the internal storage for this many items; + * the internal storage will still grow to accommodate more item + * if necessary, but setting this to a realistic value can avoid + * memory allocations during runtime, especially if you know a + * priori how many items you're going to store. */ -template<class T> - class BLOCKS_API vector_sink : virtual public sync_block - { - public: - // gr::blocks::vector_sink::sptr - typedef boost::shared_ptr< vector_sink<T> > sptr; - - /*! - * \brief Make a new instance of the vector source, and return a shared pointer to it. - * \param vlen length of vector items - * \param reserve_items reserve space in the internal storage for this many items; - * the internal storage will still grow to accommodate more item - * if necessary, but setting this to a realistic value can avoid - * memory allocations during runtime, especially if you know a - * priori how many items you're going to store. - */ - static sptr make(const unsigned int vlen = 1, const int reserve_items = 1024); + static sptr make(const unsigned int vlen = 1, const int reserve_items = 1024); - //! Clear the data and tags containers. - virtual void reset() = 0; - virtual std::vector<T> data() const = 0; - virtual std::vector<tag_t> tags() const = 0; - }; + //! Clear the data and tags containers. + virtual void reset() = 0; + virtual std::vector<T> data() const = 0; + virtual std::vector<tag_t> tags() const = 0; +}; typedef vector_sink<std::uint8_t> vector_sink_b; typedef vector_sink<std::int16_t> vector_sink_s; typedef vector_sink<std::int32_t> vector_sink_i; typedef vector_sink<float> vector_sink_f; typedef vector_sink<gr_complex> vector_sink_c; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* VECTOR_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/vector_source.h b/gr-blocks/include/gnuradio/blocks/vector_source.h index ae25d85b62..b7aff6e49a 100644 --- a/gr-blocks/include/gnuradio/blocks/vector_source.h +++ b/gr-blocks/include/gnuradio/blocks/vector_source.h @@ -29,63 +29,64 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Source that streams T items based on the input \p data vector. - * \ingroup misc_blk - * - * \details - * This block produces a stream of samples based on an input - * vector. In C++, this is a std::vector<T>, and in Python, - * this is either a list or tuple. The data can repeat infinitely - * until the flowgraph is terminated by some other event or, the - * default, run the data once and stop. - * - * The vector source can also produce stream tags with the - * data. Pass in a vector of gr::tag_t objects and they will be - * emitted based on the specified offset of the tag. - * - * GNU Radio provides a utility Python module in gr.tag_utils to - * convert between tags and Python objects: - * gr.tag_utils.python_to_tag. - * - * We can create tags as Python lists (or tuples) using the list - * structure [int offset, pmt key, pmt value, pmt srcid]. It is - * important to define the list/tuple with the values in the - * correct order and with the correct data type. A python - * dictionary can also be used using the keys: "offset", "key", - * "value", and "srcid" with the same data types as for the lists. - * - * When given a list of tags, the vector source will emit the tags - * repeatedly by updating the offset relative to the vector stream - * length. That is, if the vector has 500 items and a tag has an - * offset of 0, that tag will be placed on item 0, 500, 1000, - * 1500, etc. - */ -template<class T> - class BLOCKS_API vector_source : virtual public sync_block - { - public: - // gr::blocks::vector_source::sptr - typedef boost::shared_ptr< vector_source<T> > sptr; +/*! + * \brief Source that streams T items based on the input \p data vector. + * \ingroup misc_blk + * + * \details + * This block produces a stream of samples based on an input + * vector. In C++, this is a std::vector<T>, and in Python, + * this is either a list or tuple. The data can repeat infinitely + * until the flowgraph is terminated by some other event or, the + * default, run the data once and stop. + * + * The vector source can also produce stream tags with the + * data. Pass in a vector of gr::tag_t objects and they will be + * emitted based on the specified offset of the tag. + * + * GNU Radio provides a utility Python module in gr.tag_utils to + * convert between tags and Python objects: + * gr.tag_utils.python_to_tag. + * + * We can create tags as Python lists (or tuples) using the list + * structure [int offset, pmt key, pmt value, pmt srcid]. It is + * important to define the list/tuple with the values in the + * correct order and with the correct data type. A python + * dictionary can also be used using the keys: "offset", "key", + * "value", and "srcid" with the same data types as for the lists. + * + * When given a list of tags, the vector source will emit the tags + * repeatedly by updating the offset relative to the vector stream + * length. That is, if the vector has 500 items and a tag has an + * offset of 0, that tag will be placed on item 0, 500, 1000, + * 1500, etc. + */ +template <class T> +class BLOCKS_API vector_source : virtual public sync_block +{ +public: + // gr::blocks::vector_source::sptr + typedef boost::shared_ptr<vector_source<T>> sptr; - static sptr make(const std::vector<T> &data, - bool repeat=false, unsigned int vlen=1, - const std::vector<tag_t> &tags=std::vector<tag_t>()); + static sptr make(const std::vector<T>& data, + bool repeat = false, + unsigned int vlen = 1, + const std::vector<tag_t>& tags = std::vector<tag_t>()); - virtual void rewind() = 0; - virtual void set_data(const std::vector<T> &data, - const std::vector<tag_t> &tags=std::vector<tag_t>()) = 0; - virtual void set_repeat(bool repeat) = 0; - }; + virtual void rewind() = 0; + virtual void set_data(const std::vector<T>& data, + const std::vector<tag_t>& tags = std::vector<tag_t>()) = 0; + virtual void set_repeat(bool repeat) = 0; +}; typedef vector_source<std::uint8_t> vector_source_b; typedef vector_source<std::int16_t> vector_source_s; typedef vector_source<std::int32_t> vector_source_i; typedef vector_source<float> vector_source_f; typedef vector_source<gr_complex> vector_source_c; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* VECTOR_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/vector_to_stream.h b/gr-blocks/include/gnuradio/blocks/vector_to_stream.h index f1b919d218..67b40f4f4f 100644 --- a/gr-blocks/include/gnuradio/blocks/vector_to_stream.h +++ b/gr-blocks/include/gnuradio/blocks/vector_to_stream.h @@ -27,28 +27,28 @@ #include <gnuradio/sync_interpolator.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief convert a stream of gnuradio/blocks of nitems_per_block items into a stream of + * items \ingroup stream_operators_blk + */ +class BLOCKS_API vector_to_stream : virtual public sync_interpolator +{ +public: + // gr::blocks::vector_to_stream::sptr + typedef boost::shared_ptr<vector_to_stream> sptr; /*! - * \brief convert a stream of gnuradio/blocks of nitems_per_block items into a stream of items - * \ingroup stream_operators_blk + * Make vector-to-stream block + * + * \param itemsize the item size of the stream + * \param nitems_per_block number of items per vector (vector size) */ - class BLOCKS_API vector_to_stream : virtual public sync_interpolator - { - public: - // gr::blocks::vector_to_stream::sptr - typedef boost::shared_ptr<vector_to_stream> sptr; - - /*! - * Make vector-to-stream block - * - * \param itemsize the item size of the stream - * \param nitems_per_block number of items per vector (vector size) - */ - static sptr make(size_t itemsize, size_t nitems_per_block); - }; + static sptr make(size_t itemsize, size_t nitems_per_block); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_VECTOR_TO_STREAM_H */ diff --git a/gr-blocks/include/gnuradio/blocks/vector_to_streams.h b/gr-blocks/include/gnuradio/blocks/vector_to_streams.h index 42ec114498..406f735c4f 100644 --- a/gr-blocks/include/gnuradio/blocks/vector_to_streams.h +++ b/gr-blocks/include/gnuradio/blocks/vector_to_streams.h @@ -27,29 +27,29 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { + +/*! + * \brief Convert 1 stream of vectors of length N to N streams of items + * \ingroup stream_operators_blk + */ +class BLOCKS_API vector_to_streams : virtual public sync_block +{ +public: + // gr::blocks::vector_to_streams::sptr + typedef boost::shared_ptr<vector_to_streams> sptr; /*! - * \brief Convert 1 stream of vectors of length N to N streams of items - * \ingroup stream_operators_blk + * Make vector-to-streams block + * + * \param itemsize the item size of the stream + * \param nstreams number of items per vector (vector size and + * number of streams produced) */ - class BLOCKS_API vector_to_streams : virtual public sync_block - { - public: - // gr::blocks::vector_to_streams::sptr - typedef boost::shared_ptr<vector_to_streams> sptr; - - /*! - * Make vector-to-streams block - * - * \param itemsize the item size of the stream - * \param nstreams number of items per vector (vector size and - * number of streams produced) - */ - static sptr make(size_t itemsize, size_t nstreams); - }; + static sptr make(size_t itemsize, size_t nstreams); +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_BLOCKS_VECTOR_TO_STREAMS_H */ diff --git a/gr-blocks/include/gnuradio/blocks/wavfile.h b/gr-blocks/include/gnuradio/blocks/wavfile.h index 2c03319c4a..caf06532c3 100644 --- a/gr-blocks/include/gnuradio/blocks/wavfile.h +++ b/gr-blocks/include/gnuradio/blocks/wavfile.h @@ -30,76 +30,73 @@ #include <cstdio> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Read signal information from a given WAV file. - * - * \param[in] fp File pointer to an opened, empty file. - * \param[out] sample_rate Stores the sample rate [S/s] - * \param[out] nchans Number of channels - * \param[out] bytes_per_sample Bytes per sample, can either be 1 or 2 (corresponding o - * 8 or 16 bit samples, respectively) - * \param[out] first_sample_pos Number of the first byte containing a sample. Use this - * with fseek() to jump from the end of the file to the - * first sample when in repeat mode. - * \param[out] samples_per_chan Number of samples per channel - * \return True on a successful read, false if the file could not be read or is - * not a valid WAV file. - */ - BLOCKS_API bool wavheader_parse(FILE *fp, - unsigned int &sample_rate, - int &nchans, - int &bytes_per_sample, - int &first_sample_pos, - unsigned int &samples_per_chan); +/*! + * \brief Read signal information from a given WAV file. + * + * \param[in] fp File pointer to an opened, empty file. + * \param[out] sample_rate Stores the sample rate [S/s] + * \param[out] nchans Number of channels + * \param[out] bytes_per_sample Bytes per sample, can either be 1 or 2 (corresponding o + * 8 or 16 bit samples, respectively) + * \param[out] first_sample_pos Number of the first byte containing a sample. Use this + * with fseek() to jump from the end of the file to the + * first sample when in repeat mode. + * \param[out] samples_per_chan Number of samples per channel + * \return True on a successful read, false if the file could not be read or is + * not a valid WAV file. + */ +BLOCKS_API bool wavheader_parse(FILE* fp, + unsigned int& sample_rate, + int& nchans, + int& bytes_per_sample, + int& first_sample_pos, + unsigned int& samples_per_chan); - /*! - * \brief Read one sample from an open WAV file at the current position. - * - * \details - * Takes care of endianness. - */ - BLOCKS_API short int wav_read_sample(FILE *fp, int bytes_per_sample); +/*! + * \brief Read one sample from an open WAV file at the current position. + * + * \details + * Takes care of endianness. + */ +BLOCKS_API short int wav_read_sample(FILE* fp, int bytes_per_sample); - /*! - * \brief Write a valid RIFF file header - * - * Note: Some header values are kept blank because they're usually - * not known a-priori (file and chunk lengths). Use - * gri_wavheader_complete() to fill these in. - */ - BLOCKS_API bool wavheader_write(FILE *fp, - unsigned int sample_rate, - int nchans, - int bytes_per_sample); +/*! + * \brief Write a valid RIFF file header + * + * Note: Some header values are kept blank because they're usually + * not known a-priori (file and chunk lengths). Use + * gri_wavheader_complete() to fill these in. + */ +BLOCKS_API bool +wavheader_write(FILE* fp, unsigned int sample_rate, int nchans, int bytes_per_sample); - /*! - * \brief Write one sample to an open WAV file at the current position. - * - * \details - * Takes care of endianness. - */ - BLOCKS_API void wav_write_sample(FILE *fp, short int sample, int bytes_per_sample); +/*! + * \brief Write one sample to an open WAV file at the current position. + * + * \details + * Takes care of endianness. + */ +BLOCKS_API void wav_write_sample(FILE* fp, short int sample, int bytes_per_sample); - /*! - * \brief Complete a WAV header - * - * \details - * Note: The stream position is changed during this function. If - * anything needs to be written to the WAV file after calling this - * function (which shouldn't happen), you need to fseek() to the - * end of the file (or wherever). - * - * \param[in] fp File pointer to an open WAV file with a blank header - * \param[in] byte_count Length of all samples written to the file in bytes. - */ - BLOCKS_API bool wavheader_complete(FILE *fp, unsigned int byte_count); +/*! + * \brief Complete a WAV header + * + * \details + * Note: The stream position is changed during this function. If + * anything needs to be written to the WAV file after calling this + * function (which shouldn't happen), you need to fseek() to the + * end of the file (or wherever). + * + * \param[in] fp File pointer to an open WAV file with a blank header + * \param[in] byte_count Length of all samples written to the file in bytes. + */ +BLOCKS_API bool wavheader_complete(FILE* fp, unsigned int byte_count); - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* _GR_WAVFILE_H_ */ - diff --git a/gr-blocks/include/gnuradio/blocks/wavfile_sink.h b/gr-blocks/include/gnuradio/blocks/wavfile_sink.h index d841a8b303..c9d9501ebf 100644 --- a/gr-blocks/include/gnuradio/blocks/wavfile_sink.h +++ b/gr-blocks/include/gnuradio/blocks/wavfile_sink.h @@ -27,61 +27,61 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Write stream to a Microsoft PCM (.wav) file. - * \ingroup audio_blk - * - * \details - * Values must be floats within [-1;1]. - * Check gr_make_wavfile_sink() for extra info. - */ - class BLOCKS_API wavfile_sink : virtual public sync_block - { - public: - // gr::blocks::wavfile_sink::sptr - typedef boost::shared_ptr<wavfile_sink> sptr; +/*! + * \brief Write stream to a Microsoft PCM (.wav) file. + * \ingroup audio_blk + * + * \details + * Values must be floats within [-1;1]. + * Check gr_make_wavfile_sink() for extra info. + */ +class BLOCKS_API wavfile_sink : virtual public sync_block +{ +public: + // gr::blocks::wavfile_sink::sptr + typedef boost::shared_ptr<wavfile_sink> sptr; - /* - * \param filename The .wav file to be opened - * \param n_channels Number of channels (2 = stereo or I/Q output) - * \param sample_rate Sample rate [S/s] - * \param bits_per_sample 16 or 8 bit, default is 16 - */ - static sptr make(const char *filename, - int n_channels, - unsigned int sample_rate, - int bits_per_sample = 16); + /* + * \param filename The .wav file to be opened + * \param n_channels Number of channels (2 = stereo or I/Q output) + * \param sample_rate Sample rate [S/s] + * \param bits_per_sample 16 or 8 bit, default is 16 + */ + static sptr make(const char* filename, + int n_channels, + unsigned int sample_rate, + int bits_per_sample = 16); - /*! - * \brief Opens a new file and writes a WAV header. Thread-safe. - */ - virtual bool open(const char* filename) = 0; + /*! + * \brief Opens a new file and writes a WAV header. Thread-safe. + */ + virtual bool open(const char* filename) = 0; - /*! - * \brief Closes the currently active file and completes the WAV - * header. Thread-safe. - */ - virtual void close() = 0; + /*! + * \brief Closes the currently active file and completes the WAV + * header. Thread-safe. + */ + virtual void close() = 0; - /*! - * \brief Set the sample rate. This will not affect the WAV file - * currently opened. Any following open() calls will use this new - * sample rate. - */ - virtual void set_sample_rate(unsigned int sample_rate) = 0; + /*! + * \brief Set the sample rate. This will not affect the WAV file + * currently opened. Any following open() calls will use this new + * sample rate. + */ + virtual void set_sample_rate(unsigned int sample_rate) = 0; - /*! - * \brief Set bits per sample. This will not affect the WAV file - * currently opened (see set_sample_rate()). If the value is - * neither 8 nor 16, the call is ignored and the current value - * is kept. - */ - virtual void set_bits_per_sample(int bits_per_sample) = 0; - }; + /*! + * \brief Set bits per sample. This will not affect the WAV file + * currently opened (see set_sample_rate()). If the value is + * neither 8 nor 16, the call is ignored and the current value + * is kept. + */ + virtual void set_bits_per_sample(int bits_per_sample) = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_WAVFILE_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/wavfile_source.h b/gr-blocks/include/gnuradio/blocks/wavfile_source.h index bb46d4ba0c..62d2c20854 100644 --- a/gr-blocks/include/gnuradio/blocks/wavfile_source.h +++ b/gr-blocks/include/gnuradio/blocks/wavfile_source.h @@ -27,44 +27,44 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief Read stream from a Microsoft PCM (.wav) file, output floats - * \ingroup audio_blk - * - * \details - * Unless otherwise called, values are within [-1;1]. - * Check gr_make_wavfile_source() for extra info. - */ - class BLOCKS_API wavfile_source : virtual public sync_block - { - public: - // gr::blocks::wavfile_source::sptr - typedef boost::shared_ptr<wavfile_source> sptr; +/*! + * \brief Read stream from a Microsoft PCM (.wav) file, output floats + * \ingroup audio_blk + * + * \details + * Unless otherwise called, values are within [-1;1]. + * Check gr_make_wavfile_source() for extra info. + */ +class BLOCKS_API wavfile_source : virtual public sync_block +{ +public: + // gr::blocks::wavfile_source::sptr + typedef boost::shared_ptr<wavfile_source> sptr; - static sptr make(const char *filename, bool repeat = false); + static sptr make(const char* filename, bool repeat = false); - /*! - * \brief Read the sample rate as specified in the wav file header - */ - virtual unsigned int sample_rate() const = 0; + /*! + * \brief Read the sample rate as specified in the wav file header + */ + virtual unsigned int sample_rate() const = 0; - /*! - * \brief Return the number of bits per sample as specified in - * the wav file header. Only 8 or 16 bit are supported here. - */ - virtual int bits_per_sample() const = 0; + /*! + * \brief Return the number of bits per sample as specified in + * the wav file header. Only 8 or 16 bit are supported here. + */ + virtual int bits_per_sample() const = 0; - /*! - * \brief Return the number of channels in the wav file as - * specified in the wav file header. This is also the max number - * of outputs you can have. - */ - virtual int channels() const = 0; - }; + /*! + * \brief Return the number of channels in the wav file as + * specified in the wav file header. This is also the max number + * of outputs you can have. + */ + virtual int channels() const = 0; +}; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_GR_WAVFILE_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/xor_blk.h b/gr-blocks/include/gnuradio/blocks/xor_blk.h index 3113a0703c..da937614ed 100644 --- a/gr-blocks/include/gnuradio/blocks/xor_blk.h +++ b/gr-blocks/include/gnuradio/blocks/xor_blk.h @@ -29,29 +29,28 @@ #include <cstdint> namespace gr { - namespace blocks { +namespace blocks { - /*! - * \brief output = input_0 ^ input_1 ^ , ... ^ input_N) - * \ingroup boolean_operators_blk - * - * Bitwise boolean xor across all input streams. - */ -template<class T> - class BLOCKS_API xor_blk : virtual public sync_block - { - public: - - // gr::blocks::xor::sptr - typedef boost::shared_ptr< xor_blk<T> > sptr; +/*! + * \brief output = input_0 ^ input_1 ^ , ... ^ input_N) + * \ingroup boolean_operators_blk + * + * Bitwise boolean xor across all input streams. + */ +template <class T> +class BLOCKS_API xor_blk : virtual public sync_block +{ +public: + // gr::blocks::xor::sptr + typedef boost::shared_ptr<xor_blk<T>> sptr; - static sptr make(size_t vlen=1); - }; + static sptr make(size_t vlen = 1); +}; typedef xor_blk<std::uint8_t> xor_bb; typedef xor_blk<std::int16_t> xor_ss; typedef xor_blk<std::int32_t> xor_ii; - } /* namespace blocks */ +} /* namespace blocks */ } /* namespace gr */ #endif /* XOR_BLK_H */ |