diff options
author | Johnathan Corgan | 2012-04-01 16:18:40 -0700 |
---|---|---|
committer | Johnathan Corgan | 2012-04-01 16:18:40 -0700 |
commit | 269691c7d45675382bafbdf8a56f0682f1927fd9 (patch) | |
tree | 960bee8b4e0ee2434cdf7be21cb0946e0bdcf8d2 /gr-wavelet | |
parent | f9b73b1710f19529b99f8f69c8e3a06839ad68bc (diff) | |
download | gnuradio-269691c7d45675382bafbdf8a56f0682f1927fd9.tar.gz gnuradio-269691c7d45675382bafbdf8a56f0682f1927fd9.tar.bz2 gnuradio-269691c7d45675382bafbdf8a56f0682f1927fd9.zip |
wavelet: converted blocks to private implementation pattern
Diffstat (limited to 'gr-wavelet')
-rw-r--r-- | gr-wavelet/include/wavelet/wavelet_squash_ff.h | 33 | ||||
-rw-r--r-- | gr-wavelet/include/wavelet/wavelet_wavelet_ff.h | 29 | ||||
-rw-r--r-- | gr-wavelet/include/wavelet/wavelet_wvps_ff.h | 17 | ||||
-rw-r--r-- | gr-wavelet/lib/CMakeLists.txt | 7 | ||||
-rw-r--r-- | gr-wavelet/lib/wavelet_squash_ff_impl.cc (renamed from gr-wavelet/lib/wavelet_squash_ff.cc) | 16 | ||||
-rw-r--r-- | gr-wavelet/lib/wavelet_squash_ff_impl.h | 58 | ||||
-rw-r--r-- | gr-wavelet/lib/wavelet_wavelet_ff_impl.cc (renamed from gr-wavelet/lib/wavelet_wavelet_ff.cc) | 14 | ||||
-rw-r--r-- | gr-wavelet/lib/wavelet_wavelet_ff_impl.h | 55 | ||||
-rw-r--r-- | gr-wavelet/lib/wavelet_wvps_ff_impl.cc (renamed from gr-wavelet/lib/wavelet_wvps_ff.cc) | 12 | ||||
-rw-r--r-- | gr-wavelet/lib/wavelet_wvps_ff_impl.h | 44 |
10 files changed, 191 insertions, 94 deletions
diff --git a/gr-wavelet/include/wavelet/wavelet_squash_ff.h b/gr-wavelet/include/wavelet/wavelet_squash_ff.h index 99ecf93ca..c79f513c6 100644 --- a/gr-wavelet/include/wavelet/wavelet_squash_ff.h +++ b/gr-wavelet/include/wavelet/wavelet_squash_ff.h @@ -20,49 +20,26 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_WAVELET_SQUASH_FF_H_ -# define INCLUDED_WAVELET_SQUASH_FF_H_ +#ifndef INCLUDED_WAVELET_SQUASH_FF_H +#define INCLUDED_WAVELET_SQUASH_FF_H #include <wavelet_api.h> #include <gr_sync_block.h> -#include <gsl/gsl_errno.h> -#include <gsl/gsl_interp.h> -#include <gsl/gsl_spline.h> + /*! * \brief implements cheap resampling of spectrum directly from * spectral points, using gsl interpolation * \ingroup misc */ - class wavelet_squash_ff; typedef boost::shared_ptr<wavelet_squash_ff> wavelet_squash_ff_sptr; WAVELET_API wavelet_squash_ff_sptr wavelet_make_squash_ff(const std::vector<float> &igrid, const std::vector<float> &ogrid); -class WAVELET_API wavelet_squash_ff : public gr_sync_block +class WAVELET_API wavelet_squash_ff : virtual public gr_sync_block { - friend WAVELET_API wavelet_squash_ff_sptr wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - - size_t d_inum; - size_t d_onum; - double *d_igrid; - double *d_iwork; - double *d_ogrid; - - gsl_interp_accel *d_accel; - gsl_spline *d_spline; - - wavelet_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - - public: - ~wavelet_squash_ff(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); + // No public API methods visible }; #endif diff --git a/gr-wavelet/include/wavelet/wavelet_wavelet_ff.h b/gr-wavelet/include/wavelet/wavelet_wavelet_ff.h index 9b1f3fe0e..ef920f163 100644 --- a/gr-wavelet/include/wavelet/wavelet_wavelet_ff.h +++ b/gr-wavelet/include/wavelet/wavelet_wavelet_ff.h @@ -23,12 +23,8 @@ #define INCLUDED_WAVELET_WAVELET_FF_H #include <wavelet_api.h> -#include <iostream> #include <gr_sync_block.h> -#include <gsl/gsl_errno.h> -#include <gsl/gsl_wavelet.h> - class wavelet_wavelet_ff; typedef boost::shared_ptr<wavelet_wavelet_ff> wavelet_wavelet_ff_sptr; @@ -42,30 +38,9 @@ wavelet_make_wavelet_ff(int size = 1024, * \ingroup wavelet_blk */ -class WAVELET_API wavelet_wavelet_ff : public gr_sync_block +class WAVELET_API wavelet_wavelet_ff : virtual public gr_sync_block { - int d_size; - int d_order; - bool d_forward; - gsl_wavelet *d_wavelet; - gsl_wavelet_workspace *d_workspace; - double *d_temp; - - friend WAVELET_API wavelet_wavelet_ff_sptr - wavelet_make_wavelet_ff(int size, - int order, - bool forward); - - wavelet_wavelet_ff(int size, - int order, - bool forward); - -public: - ~wavelet_wavelet_ff(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); + // No public API methods visible }; #endif /* INCLUDED_WAVELET_WAVELET_FF_H */ diff --git a/gr-wavelet/include/wavelet/wavelet_wvps_ff.h b/gr-wavelet/include/wavelet/wavelet_wvps_ff.h index ec6ed0c34..061f42323 100644 --- a/gr-wavelet/include/wavelet/wavelet_wvps_ff.h +++ b/gr-wavelet/include/wavelet/wavelet_wvps_ff.h @@ -36,22 +36,9 @@ wavelet_make_wvps_ff(int ilen); * \brief computes the Wavelet Power Spectrum from a set of wavelet coefficients * \ingroup wavelet_blk */ -class WAVELET_API wavelet_wvps_ff : public gr_sync_block +class WAVELET_API wavelet_wvps_ff : virtual public gr_sync_block { - friend WAVELET_API wavelet_wvps_ff_sptr - wavelet_make_wvps_ff(int ilen); - - int d_ilen; - int d_olen; - - protected: - wavelet_wvps_ff(int ilen); - - public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - + // No public API methods visible }; #endif /* INCLUDED_WAVELET_WVPS_FF_H */ diff --git a/gr-wavelet/lib/CMakeLists.txt b/gr-wavelet/lib/CMakeLists.txt index 51a5d3989..dd5e1500d 100644 --- a/gr-wavelet/lib/CMakeLists.txt +++ b/gr-wavelet/lib/CMakeLists.txt @@ -23,6 +23,7 @@ include_directories( ${GNURADIO_CORE_INCLUDE_DIRS} ${GR_WAVELET_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) @@ -36,9 +37,9 @@ link_directories(${Boost_LIBRARY_DIRS}) # Setup library ######################################################################## list(APPEND gr_wavelet_sources - wavelet_squash_ff.cc - wavelet_wavelet_ff.cc - wavelet_wvps_ff.cc + wavelet_squash_ff_impl.cc + wavelet_wavelet_ff_impl.cc + wavelet_wvps_ff_impl.cc ) list(APPEND wavelet_libs diff --git a/gr-wavelet/lib/wavelet_squash_ff.cc b/gr-wavelet/lib/wavelet_squash_ff_impl.cc index 9316d34fe..23f1a5e2f 100644 --- a/gr-wavelet/lib/wavelet_squash_ff.cc +++ b/gr-wavelet/lib/wavelet_squash_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include <stdexcept> -#include <wavelet_squash_ff.h> +#include <wavelet_squash_ff_impl.h> #include <gr_io_signature.h> // expect input vector of igrid.size y-values, @@ -35,11 +35,11 @@ wavelet_squash_ff_sptr wavelet_make_squash_ff(const std::vector<float> &igrid, const std::vector<float> &ogrid) { - return gnuradio::get_initial_sptr(new wavelet_squash_ff(igrid, ogrid)); + return gnuradio::get_initial_sptr(new wavelet_squash_ff_impl(igrid, ogrid)); } -wavelet_squash_ff::wavelet_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid) +wavelet_squash_ff_impl::wavelet_squash_ff_impl(const std::vector<float> &igrid, + const std::vector<float> &ogrid) : gr_sync_block("squash_ff", gr_make_io_signature(1, 1, sizeof(float) * igrid.size()), gr_make_io_signature(1, 1, sizeof(float) * ogrid.size())) @@ -58,7 +58,7 @@ wavelet_squash_ff::wavelet_squash_ff(const std::vector<float> &igrid, d_spline = gsl_spline_alloc(gsl_interp_cspline, d_inum); // FIXME check w/ Frank } -wavelet_squash_ff::~wavelet_squash_ff() +wavelet_squash_ff_impl::~wavelet_squash_ff_impl() { free((char *) d_igrid); free((char *) d_iwork); @@ -68,9 +68,9 @@ wavelet_squash_ff::~wavelet_squash_ff() } int -wavelet_squash_ff::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +wavelet_squash_ff_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { const float *in = (const float *) input_items[0]; float *out = (float *) output_items[0]; diff --git a/gr-wavelet/lib/wavelet_squash_ff_impl.h b/gr-wavelet/lib/wavelet_squash_ff_impl.h new file mode 100644 index 000000000..806f13e40 --- /dev/null +++ b/gr-wavelet/lib/wavelet_squash_ff_impl.h @@ -0,0 +1,58 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_WAVELET_SQUASH_FF_IMPL_H +#define INCLUDED_WAVELET_SQUASH_FF_IMPL_H + +#include <wavelet_api.h> +#include <wavelet_squash_ff.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_interp.h> +#include <gsl/gsl_spline.h> + +class WAVELET_API wavelet_squash_ff_impl : public wavelet_squash_ff +{ + size_t d_inum; + size_t d_onum; + double *d_igrid; + double *d_iwork; + double *d_ogrid; + + gsl_interp_accel *d_accel; + gsl_spline *d_spline; + + wavelet_squash_ff_impl(const std::vector<float> &igrid, + const std::vector<float> &ogrid); + + friend WAVELET_API wavelet_squash_ff_sptr + wavelet_make_squash_ff(const std::vector<float> &igrid, + const std::vector<float> &ogrid); + + public: + ~wavelet_squash_ff_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_WAVELET_WAVELET_FF_IMPL_H */ diff --git a/gr-wavelet/lib/wavelet_wavelet_ff.cc b/gr-wavelet/lib/wavelet_wavelet_ff_impl.cc index 3f4354f31..719f4b53f 100644 --- a/gr-wavelet/lib/wavelet_wavelet_ff.cc +++ b/gr-wavelet/lib/wavelet_wavelet_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include <stdexcept> -#include <wavelet_wavelet_ff.h> +#include <wavelet_wavelet_ff_impl.h> #include <gr_io_signature.h> #include <stdio.h> @@ -38,10 +38,10 @@ wavelet_make_wavelet_ff(int size, int order, bool forward) { - return gnuradio::get_initial_sptr(new wavelet_wavelet_ff(size, order, forward)); + return gnuradio::get_initial_sptr(new wavelet_wavelet_ff_impl(size, order, forward)); } -wavelet_wavelet_ff::wavelet_wavelet_ff(int size, int order, bool forward) +wavelet_wavelet_ff_impl::wavelet_wavelet_ff_impl(int size, int order, bool forward) : gr_sync_block("wavelet_ff", gr_make_io_signature(1, 1, size * sizeof(float)), gr_make_io_signature(1, 1, size * sizeof(float))), @@ -60,7 +60,7 @@ wavelet_wavelet_ff::wavelet_wavelet_ff(int size, int order, bool forward) throw std::runtime_error("can't allocate wavelet double conversion temp"); } -wavelet_wavelet_ff::~wavelet_wavelet_ff() +wavelet_wavelet_ff_impl::~wavelet_wavelet_ff_impl() { gsl_wavelet_free(d_wavelet); gsl_wavelet_workspace_free(d_workspace); @@ -68,9 +68,9 @@ wavelet_wavelet_ff::~wavelet_wavelet_ff() } int -wavelet_wavelet_ff::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +wavelet_wavelet_ff_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { const float *in = (const float *) input_items[0]; float *out = (float *) output_items[0]; diff --git a/gr-wavelet/lib/wavelet_wavelet_ff_impl.h b/gr-wavelet/lib/wavelet_wavelet_ff_impl.h new file mode 100644 index 000000000..8ad3ef0bf --- /dev/null +++ b/gr-wavelet/lib/wavelet_wavelet_ff_impl.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ +#ifndef INCLUDED_WAVELET_WAVELET_FF_IMPL_H +#define INCLUDED_WAVELET_WAVELET_FF_IMPL_H + +#include <wavelet_wavelet_ff.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_wavelet.h> + +class WAVELET_API wavelet_wavelet_ff_impl : public wavelet_wavelet_ff +{ + int d_size; + int d_order; + bool d_forward; + gsl_wavelet *d_wavelet; + gsl_wavelet_workspace *d_workspace; + double *d_temp; + + friend WAVELET_API wavelet_wavelet_ff_sptr + wavelet_make_wavelet_ff(int size, + int order, + bool forward); + + wavelet_wavelet_ff_impl(int size, + int order, + bool forward); + +public: + ~wavelet_wavelet_ff_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_WAVELET_WAVELET_FF_IMPL_H */ diff --git a/gr-wavelet/lib/wavelet_wvps_ff.cc b/gr-wavelet/lib/wavelet_wvps_ff_impl.cc index 5edc43496..f2507adc8 100644 --- a/gr-wavelet/lib/wavelet_wvps_ff.cc +++ b/gr-wavelet/lib/wavelet_wvps_ff_impl.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <wavelet_wvps_ff.h> +#include <wavelet_wvps_ff_impl.h> #include <gr_io_signature.h> #include <string.h> @@ -39,10 +39,10 @@ ceil_log2(int k) wavelet_wvps_ff_sptr wavelet_make_wvps_ff(int ilen) { - return gnuradio::get_initial_sptr(new wavelet_wvps_ff(ilen)); + return gnuradio::get_initial_sptr(new wavelet_wvps_ff_impl(ilen)); } -wavelet_wvps_ff::wavelet_wvps_ff(int ilen) +wavelet_wvps_ff_impl::wavelet_wvps_ff_impl(int ilen) : gr_sync_block("wvps_ff", gr_make_io_signature(1, 1, sizeof(float) * ilen), gr_make_io_signature(1, 1, sizeof(float) * ceil_log2(ilen))), @@ -53,9 +53,9 @@ wavelet_wvps_ff::wavelet_wvps_ff(int ilen) // input vector assumed to be output from gsl wavelet computation int -wavelet_wvps_ff::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +wavelet_wvps_ff_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { const float *in = (const float *) input_items[0]; float *out = (float *) output_items[0]; diff --git a/gr-wavelet/lib/wavelet_wvps_ff_impl.h b/gr-wavelet/lib/wavelet_wvps_ff_impl.h new file mode 100644 index 000000000..30877e3fd --- /dev/null +++ b/gr-wavelet/lib/wavelet_wvps_ff_impl.h @@ -0,0 +1,44 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_WAVELET_WVPS_FF_IMPL_H +#define INCLUDED_WAVELET_WVPS_FF_IMPL_H + +#include <wavelet_wvps_ff.h> + +class WAVELET_API wavelet_wvps_ff_impl : public wavelet_wvps_ff +{ + int d_ilen; + int d_olen; + + friend WAVELET_API wavelet_wvps_ff_sptr + wavelet_make_wvps_ff(int ilen); + + wavelet_wvps_ff_impl(int ilen); + + public: + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_WAVELET_WVPS_FF_IMPL_H */ |