diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gnuradio/gr_block.h | 141 | ||||
-rw-r--r-- | include/gnuradio/gr_hier_block2.h | 49 | ||||
-rw-r--r-- | include/gnuradio/gr_io_signature.h | 85 | ||||
-rw-r--r-- | include/gnuradio/gr_sync_block.h | 55 | ||||
-rw-r--r-- | include/gnuradio/gr_sync_decimator.h | 36 | ||||
-rw-r--r-- | include/gnuradio/gr_sync_interpolator.h | 36 | ||||
-rw-r--r-- | include/gnuradio/gr_tags.h | 46 | ||||
-rw-r--r-- | include/gnuradio/gr_top_block.h | 48 | ||||
-rw-r--r-- | include/gnuradio/gr_types.h | 45 | ||||
-rw-r--r-- | include/gnuradio/gr_vmcircbuf.h | 10 | ||||
-rw-r--r-- | include/gnuradio/gras.hpp | 39 | ||||
-rw-r--r-- | include/gras/block.hpp (renamed from include/gnuradio/block.hpp) | 16 | ||||
-rw-r--r-- | include/gras/element.hpp (renamed from include/gnuradio/element.hpp) | 22 | ||||
-rw-r--r-- | include/gras/gras.hpp | 69 | ||||
-rw-r--r-- | include/gras/hier_block.hpp (renamed from include/gnuradio/hier_block.hpp) | 12 | ||||
-rw-r--r-- | include/gras/io_signature.hpp (renamed from include/gnuradio/io_signature.hpp) | 10 | ||||
-rw-r--r-- | include/gras/sbuffer.hpp (renamed from include/gnuradio/sbuffer.hpp) | 14 | ||||
-rw-r--r-- | include/gras/sbuffer.ipp (renamed from include/gnuradio/sbuffer.ipp) | 10 | ||||
-rw-r--r-- | include/gras/tags.hpp (renamed from include/gnuradio/tags.hpp) | 12 | ||||
-rw-r--r-- | include/gras/thread_pool.hpp (renamed from include/gnuradio/thread_pool.hpp) | 12 | ||||
-rw-r--r-- | include/gras/top_block.hpp (renamed from include/gnuradio/top_block.hpp) | 12 |
21 files changed, 129 insertions, 650 deletions
diff --git a/include/gnuradio/gr_block.h b/include/gnuradio/gr_block.h deleted file mode 100644 index 8e0c40e..0000000 --- a/include/gnuradio/gr_block.h +++ /dev/null @@ -1,141 +0,0 @@ -// -// Copyright 2012 Josh Blum -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -#ifndef INCLUDED_GNURADIO_GR_BLOCK_H -#define INCLUDED_GNURADIO_GR_BLOCK_H - -#include <gnuradio/block.hpp> -#include <gnuradio/gr_io_signature.h> -#include <gnuradio/gr_types.h> -#include <gnuradio/gr_tags.h> -#include <string> - -typedef std::vector<int> gr_vector_int; -typedef std::vector<void *> gr_vector_void_star; -typedef std::vector<const void *> gr_vector_const_void_star; - -namespace gnuradio -{ -//! dummy entry, just here for legacy purposes -template <typename T> -boost::shared_ptr<T> get_initial_sptr(T *p) -{ - return boost::shared_ptr<T>(p); -} -} - -struct GRAS_API gr_block : gnuradio::Block -{ - - gr_block(void); - - gr_block( - const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature - ); - - template <typename T> void set_msg_handler(T msg_handler){/*LOL*/} - - //! implements work -> calls general work - int work( - const InputItems &input_items, - const OutputItems &output_items - ); - - //! Overload me! I am the forecast - virtual void forecast(int, std::vector<int> &); - - /*! - * \brief compute output items from input items - * - * \param noutput_items number of output items to write on each output stream - * \param ninput_items number of input items available on each input stream - * \param input_items vector of pointers to the input items, one entry per input stream - * \param output_items vector of pointers to the output items, one entry per output stream - * - * \returns number of items actually written to each output stream, or -1 on EOF. - * It is OK to return a value less than noutput_items. -1 <= return value <= noutput_items - * - * general_work must call consume or consume_each to indicate how many items - * were consumed on each input stream. - */ - virtual int general_work( - int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ); - - void add_item_tag( - const size_t which_output, const gr_tag_t &tag - ); - - void add_item_tag( - const size_t which_output, - uint64_t abs_offset, - const pmt::pmt_t &key, - const pmt::pmt_t &value, - const pmt::pmt_t &srcid=pmt::PMT_F - ); - - void get_tags_in_range( - std::vector<gr_tag_t> &tags, - const size_t which_input, - uint64_t abs_start, - uint64_t abs_end, - const pmt::pmt_t &key = pmt::pmt_t() - ); - - unsigned history(void) const; - - void set_history(unsigned history); - - void set_alignment(const size_t alignment); - - bool is_unaligned(void); - - size_t fixed_rate_noutput_to_ninput(const size_t noutput_items); - - size_t interpolation(void) const; - - void set_interpolation(const size_t); - - size_t decimation(void) const; - - void set_decimation(const size_t); - - int max_noutput_items(void) const; - - void set_max_noutput_items(int); - - void unset_max_noutput_items(void); - - bool is_set_max_noutput_items(void) const; - - ///////////// TODO ////////////////////// - void set_max_output_buffer(long){} - void set_max_output_buffer(int, long){} - long max_output_buffer(size_t){return 0;} - void set_min_output_buffer(long){} - void set_min_output_buffer(int, long){} - long min_output_buffer(size_t){return 0;} - -}; - -typedef boost::shared_ptr<gr_block> gr_block_sptr; - -#endif /*INCLUDED_GNURADIO_GR_BLOCK_H*/ diff --git a/include/gnuradio/gr_hier_block2.h b/include/gnuradio/gr_hier_block2.h deleted file mode 100644 index 956cb1d..0000000 --- a/include/gnuradio/gr_hier_block2.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// Copyright 2012 Josh Blum -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -#ifndef INCLUDED_GNURADIO_GR_HIER_BLOCK2_H -#define INCLUDED_GNURADIO_GR_HIER_BLOCK2_H - -#include <gnuradio/hier_block.hpp> -#include <gnuradio/gr_io_signature.h> - -struct GRAS_API gr_hier_block2 : gnuradio::HierBlock -{ - - gr_hier_block2(void); - - gr_hier_block2( - const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature - ); - - const gr_hier_block2 &self(void) const - { - return *this; - } - -}; - -typedef boost::shared_ptr<gr_hier_block2> gr_hier_block2_sptr; - -GRAS_API gr_hier_block2_sptr gr_make_hier_block2( - const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature -); - -#endif /*INCLUDED_GNURADIO_GR_HIER_BLOCK2_H*/ diff --git a/include/gnuradio/gr_io_signature.h b/include/gnuradio/gr_io_signature.h deleted file mode 100644 index 0b32efb..0000000 --- a/include/gnuradio/gr_io_signature.h +++ /dev/null @@ -1,85 +0,0 @@ -// -// Copyright 2012 Josh Blum -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -#ifndef INCLUDED_GNURADIO_GR_IO_SIGNATURE_H -#define INCLUDED_GNURADIO_GR_IO_SIGNATURE_H - -#include <gnuradio/io_signature.hpp> -#include <vector> - -typedef gnuradio::IOSignature gr_io_signature; -typedef gr_io_signature gr_io_signature_sptr; - -inline gr_io_signature_sptr gr_make_io_signature( - int min_streams, - int max_streams, - int sizeof_stream_item -){ - gnuradio::IOSignature io_sig(min_streams, max_streams); - - if (io_sig.max_streams() != gr_io_signature::IO_INFINITE) - { - io_sig.resize(io_sig.max_streams(), sizeof_stream_item); - } - else - { - io_sig.resize(1, sizeof_stream_item); - } - - return io_sig; -} - -inline gr_io_signature_sptr gr_make_io_signature2( - int min_streams, - int max_streams, - int sizeof_stream_item1, - int sizeof_stream_item2 -){ - gnuradio::IOSignature io_sig(min_streams, max_streams); - io_sig.push_back(sizeof_stream_item1); - io_sig.push_back(sizeof_stream_item2); - return io_sig; -} - -inline gr_io_signature_sptr gr_make_io_signature3( - int min_streams, - int max_streams, - int sizeof_stream_item1, - int sizeof_stream_item2, - int sizeof_stream_item3 -){ - gnuradio::IOSignature io_sig(min_streams, max_streams); - io_sig.push_back(sizeof_stream_item1); - io_sig.push_back(sizeof_stream_item2); - io_sig.push_back(sizeof_stream_item3); - return io_sig; -} - -template <typename T> -inline gr_io_signature_sptr gr_make_io_signaturev( - int min_streams, - int max_streams, - const std::vector<T> &sizeof_stream_items -){ - gnuradio::IOSignature io_sig(min_streams, max_streams); - for (unsigned i = 0; i < sizeof_stream_items.size(); i++) - { - io_sig.push_back(sizeof_stream_items[i]); - } - return io_sig; -} - -#endif /*INCLUDED_GNURADIO_GR_IO_SIGNATURE_H*/ diff --git a/include/gnuradio/gr_sync_block.h b/include/gnuradio/gr_sync_block.h deleted file mode 100644 index cb81e67..0000000 --- a/include/gnuradio/gr_sync_block.h +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright 2012 Josh Blum -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -#ifndef INCLUDED_GNURADIO_GR_SYNC_BLOCK_H -#define INCLUDED_GNURADIO_GR_SYNC_BLOCK_H - -#include <gnuradio/gr_block.h> - -struct GRAS_API gr_sync_block : public gr_block -{ - gr_sync_block(void); - - gr_sync_block( - const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature - ); - - //! implements work -> calls work - inline int general_work( - int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ - return this->work(noutput_items, input_items, output_items); - } - - /*! - * \brief just like gr_block::general_work, only this arranges to call consume_each for you - * - * The user must override work to define the signal processing code - */ - virtual int work( - int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ); - -}; - -#endif /*INCLUDED_GNURADIO_GR_SYNC_BLOCK_H*/ diff --git a/include/gnuradio/gr_sync_decimator.h b/include/gnuradio/gr_sync_decimator.h deleted file mode 100644 index 43f94be..0000000 --- a/include/gnuradio/gr_sync_decimator.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// Copyright 2012 Josh Blum -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -#ifndef INCLUDED_GNURADIO_GR_SYNC_DECIMATOR_H -#define INCLUDED_GNURADIO_GR_SYNC_DECIMATOR_H - -#include <gnuradio/gr_sync_block.h> - -struct GRAS_API gr_sync_decimator : gr_sync_block -{ - - gr_sync_decimator(void); - - gr_sync_decimator( - const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - const size_t decim_rate - ); - -}; - -#endif /*INCLUDED_GNURADIO_GR_SYNC_DECIMATOR_H*/ diff --git a/include/gnuradio/gr_sync_interpolator.h b/include/gnuradio/gr_sync_interpolator.h deleted file mode 100644 index b165ce8..0000000 --- a/include/gnuradio/gr_sync_interpolator.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// Copyright 2012 Josh Blum -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -#ifndef INCLUDED_GNURADIO_GR_SYNC_INTERPOLATOR_H -#define INCLUDED_GNURADIO_GR_SYNC_INTERPOLATOR_H - -#include <gnuradio/gr_sync_block.h> - -struct GRAS_API gr_sync_interpolator : gr_sync_block -{ - - gr_sync_interpolator(void); - - gr_sync_interpolator( - const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - const size_t interp_rate - ); - -}; - -#endif /*INCLUDED_GNURADIO_GR_SYNC_INTERPOLATOR_H*/ diff --git a/include/gnuradio/gr_tags.h b/include/gnuradio/gr_tags.h deleted file mode 100644 index ca45170..0000000 --- a/include/gnuradio/gr_tags.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// Copyright 2012 Josh Blum -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -#ifndef INCLUDED_GR_TAGS_H -#define INCLUDED_GR_TAGS_H - -#include <gnuradio/gras.hpp> -#include <gruel/pmt.h> - -struct GRAS_API gr_tag_t -{ - - //! the item \p tag occurred at (as a uint64_t) - uint64_t offset; - - //! the key of \p tag (as a PMT symbol) - pmt::pmt_t key; - - //! the value of \p tag (as a PMT) - pmt::pmt_t value; - - //! the source ID of \p tag (as a PMT) - pmt::pmt_t srcid; - - //! Comparison function to test which tag, \p x or \p y, came first in time - static inline bool offset_compare( - const gr_tag_t &x, const gr_tag_t &y - ){ - return x.offset < y.offset; - } -}; - -#endif /*INCLUDED_GR_TAGS_H*/ diff --git a/include/gnuradio/gr_top_block.h b/include/gnuradio/gr_top_block.h deleted file mode 100644 index b50b35b..0000000 --- a/include/gnuradio/gr_top_block.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// Copyright 2012 Josh Blum -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -#ifndef INCLUDED_GNURADIO_GR_TOP_BLOCK_H -#define INCLUDED_GNURADIO_GR_TOP_BLOCK_H - -#include <gnuradio/top_block.hpp> -#include <gnuradio/gr_hier_block2.h> - -struct GRAS_API gr_top_block : gnuradio::TopBlock -{ - - gr_top_block(void); - - gr_top_block(const std::string &name); - - void start(void); - - void start(const size_t max_items); - - void run(void); - - void run(const size_t max_items); - - int max_noutput_items(void) const; - - void set_max_noutput_items(int max_items); - -}; - -typedef boost::shared_ptr<gr_top_block> gr_top_block_sptr; - -GRAS_API gr_top_block_sptr gr_make_top_block(const std::string &name); - -#endif /*INCLUDED_GNURADIO_GR_TOP_BLOCK_H*/ diff --git a/include/gnuradio/gr_types.h b/include/gnuradio/gr_types.h deleted file mode 100644 index 872cadc..0000000 --- a/include/gnuradio/gr_types.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// Copyright 2012 Josh Blum -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -#ifndef INCLUDED_GRNURADIO_TYPES_H -#define INCLUDED_GRNURADIO_TYPES_H - -// this section is to satisfy swig includes for gnuradio.i -// since gnuradio.i includes gr_types.h, we only have to edit this file -#include <gnuradio/io_signature.hpp> -#include <gnuradio/element.hpp> -#include <gnuradio/block.hpp> -#include <gnuradio/top_block.hpp> -#include <gnuradio/hier_block.hpp> - -// and gnuradio apparently needs its own typedefs for stdint... -#ifdef __cplusplus - -#include <boost/cstdint.hpp> -typedef boost::int16_t gr_int16; -typedef boost::int32_t gr_int32; -typedef boost::int64_t gr_int64; -typedef boost::uint16_t gr_uint16; -typedef boost::uint32_t gr_uint32; -typedef boost::uint64_t gr_uint64; - -#include <complex> -typedef std::complex<float> gr_complex; -typedef std::complex<double> gr_complexd; - -#endif - -#endif /* INCLUDED_GRNURADIO_TYPES_H */ diff --git a/include/gnuradio/gr_vmcircbuf.h b/include/gnuradio/gr_vmcircbuf.h deleted file mode 100644 index 7c58fcc..0000000 --- a/include/gnuradio/gr_vmcircbuf.h +++ /dev/null @@ -1,10 +0,0 @@ - -//totally bogus so I dont have to change gnuradio-core/src/tests/CMakeLists.txt - -struct gr_vmcircbuf_sysconfig -{ - static bool test_all_factories(int) - { - return true; - } -}; diff --git a/include/gnuradio/gras.hpp b/include/gnuradio/gras.hpp deleted file mode 100644 index 1712ed4..0000000 --- a/include/gnuradio/gras.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// -// Copyright 2012 Josh Blum -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -#ifndef INCLUDED_GNURADIO_GRAS_HPP -#define INCLUDED_GNURADIO_GRAS_HPP - -#include <ciso646> - -//this is part of core for now, treat it as such -#include <gr_core_api.h> -#define GRAS_API GR_CORE_API - -#define GRAS_MAX_ALIGNMENT 32 - -//define cross platform attribute macros -#if defined(GRAS_DEBUG) - #define GRAS_FORCE_INLINE inline -#elif defined(BOOST_MSVC) - #define GRAS_FORCE_INLINE __forceinline -#elif defined(__GNUG__) && __GNUG__ >= 4 - #define GRAS_FORCE_INLINE inline __attribute__((always_inline)) -#else - #define GRAS_FORCE_INLINE inline -#endif - -#endif /*INCLUDED_GNURADIO_GRAS_HPP*/ diff --git a/include/gnuradio/block.hpp b/include/gras/block.hpp index bcce34a..983d54a 100644 --- a/include/gnuradio/block.hpp +++ b/include/gras/block.hpp @@ -14,17 +14,17 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#ifndef INCLUDED_GNURADIO_BLOCK_HPP -#define INCLUDED_GNURADIO_BLOCK_HPP +#ifndef INCLUDED_GRAS_BLOCK_HPP +#define INCLUDED_GRAS_BLOCK_HPP -#include <gnuradio/element.hpp> -#include <gnuradio/sbuffer.hpp> -#include <gnuradio/tags.hpp> +#include <gras/element.hpp> +#include <gras/sbuffer.hpp> +#include <gras/tags.hpp> #include <vector> #include <string> #include <boost/range.hpp> //iterator range -namespace gnuradio +namespace gras { //! Configuration parameters for an input port @@ -315,6 +315,6 @@ struct GRAS_API Block : Element }; -} //namespace gnuradio +} //namespace gras -#endif /*INCLUDED_GNURADIO_BLOCK_HPP*/ +#endif /*INCLUDED_GRAS_BLOCK_HPP*/ diff --git a/include/gnuradio/element.hpp b/include/gras/element.hpp index abf0e34..3142510 100644 --- a/include/gnuradio/element.hpp +++ b/include/gras/element.hpp @@ -14,15 +14,15 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#ifndef INCLUDED_GNURADIO_ELEMENT_HPP -#define INCLUDED_GNURADIO_ELEMENT_HPP +#ifndef INCLUDED_GRAS_ELEMENT_HPP +#define INCLUDED_GRAS_ELEMENT_HPP -#include <gnuradio/gras.hpp> -#include <gnuradio/io_signature.hpp> +#include <gras/gras.hpp> +#include <gras/io_signature.hpp> #include <boost/shared_ptr.hpp> #include <boost/enable_shared_from_this.hpp> -namespace gnuradio +namespace gras { class ElementImpl; @@ -61,16 +61,16 @@ struct GRAS_API Element : boost::shared_ptr<ElementImpl>, boost::enable_shared_f //! get a canonical name for this element std::string to_string(void) const; - void set_output_signature(const gnuradio::IOSignature &sig); + void set_output_signature(const gras::IOSignature &sig); - void set_input_signature(const gnuradio::IOSignature &sig); + void set_input_signature(const gras::IOSignature &sig); - const gnuradio::IOSignature &input_signature(void) const; + const gras::IOSignature &input_signature(void) const; - const gnuradio::IOSignature &output_signature(void) const; + const gras::IOSignature &output_signature(void) const; }; -} //namespace gnuradio +} //namespace gras -#endif /*INCLUDED_GNURADIO_ELEMENT_HPP*/ +#endif /*INCLUDED_GRAS_ELEMENT_HPP*/ diff --git a/include/gras/gras.hpp b/include/gras/gras.hpp new file mode 100644 index 0000000..bbeffba --- /dev/null +++ b/include/gras/gras.hpp @@ -0,0 +1,69 @@ +// +// Copyright 2012 Josh Blum +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#ifndef INCLUDED_GRAS_GRAS_HPP +#define INCLUDED_GRAS_GRAS_HPP + +#include <ciso646> + +// http://gcc.gnu.org/wiki/Visibility +// Generic helper definitions for shared library support +#if defined _WIN32 || defined __CYGWIN__ + #define GRAS_HELPER_DLL_IMPORT __declspec(dllimport) + #define GRAS_HELPER_DLL_EXPORT __declspec(dllexport) + #define GRAS_HELPER_DLL_LOCAL +#else + #if __GNUC__ >= 4 + #define GRAS_HELPER_DLL_IMPORT __attribute__ ((visibility ("default"))) + #define GRAS_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) + #define GRAS_HELPER_DLL_LOCAL __attribute__ ((visibility ("hidden"))) + #else + #define GRAS_HELPER_DLL_IMPORT + #define GRAS_HELPER_DLL_EXPORT + #define GRAS_HELPER_DLL_LOCAL + #endif +#endif + +// Now we use the generic helper definitions above to define GRAS_API and GRAS_LOCAL. +// GRAS_API is used for the public API symbols. It either DLL imports or DLL exports (or does nothing for static build) +// GRAS_LOCAL is used for non-api symbols. + +#ifdef GRAS_DLL // defined if GRAS is compiled as a DLL + #ifdef GRAS_DLL_EXPORTS // defined if we are building the GRAS DLL (instead of using it) + #define GRAS_API GRAS_HELPER_DLL_EXPORT + #else + #define GRAS_API GRAS_HELPER_DLL_IMPORT + #endif // GRAS_DLL_EXPORTS + #define GRAS_LOCAL GRAS_HELPER_DLL_LOCAL +#else // GRAS_DLL is not defined: this means GRAS is a static lib. + #define GRAS_API + #define GRAS_LOCAL +#endif // GRAS_DLL + +#define GRAS_MAX_ALIGNMENT 32 + +//define cross platform attribute macros +#if defined(GRAS_DEBUG) + #define GRAS_FORCE_INLINE inline +#elif defined(BOOST_MSVC) + #define GRAS_FORCE_INLINE __forceinline +#elif defined(__GNUG__) && __GNUG__ >= 4 + #define GRAS_FORCE_INLINE inline __attribute__((always_inline)) +#else + #define GRAS_FORCE_INLINE inline +#endif + +#endif /*INCLUDED_GRAS_GRAS_HPP*/ diff --git a/include/gnuradio/hier_block.hpp b/include/gras/hier_block.hpp index c981b03..0574f14 100644 --- a/include/gnuradio/hier_block.hpp +++ b/include/gras/hier_block.hpp @@ -14,12 +14,12 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#ifndef INCLUDED_GNURADIO_HIER_BLOCK_HPP -#define INCLUDED_GNURADIO_HIER_BLOCK_HPP +#ifndef INCLUDED_GRAS_HIER_BLOCK_HPP +#define INCLUDED_GRAS_HIER_BLOCK_HPP -#include <gnuradio/element.hpp> +#include <gras/element.hpp> -namespace gnuradio +namespace gras { struct GRAS_API HierBlock : Element @@ -70,6 +70,6 @@ struct GRAS_API HierBlock : Element }; -} //namespace gnuradio +} //namespace gras -#endif /*INCLUDED_GNURADIO_HIER_BLOCK_HPP*/ +#endif /*INCLUDED_GRAS_HIER_BLOCK_HPP*/ diff --git a/include/gnuradio/io_signature.hpp b/include/gras/io_signature.hpp index b6b11a5..bb0df5f 100644 --- a/include/gnuradio/io_signature.hpp +++ b/include/gras/io_signature.hpp @@ -14,13 +14,13 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#ifndef INCLUDED_GNURADIO_IO_SIGNATURE_HPP -#define INCLUDED_GNURADIO_IO_SIGNATURE_HPP +#ifndef INCLUDED_GRAS_IO_SIGNATURE_HPP +#define INCLUDED_GRAS_IO_SIGNATURE_HPP #include <vector> #include <stdexcept> -namespace gnuradio +namespace gras { /*! @@ -108,6 +108,6 @@ struct IOSignature : std::vector<int> int _max_streams; }; -} //namespace gnuradio +} //namespace gras -#endif /*INCLUDED_GNURADIO_IO_SIGNATURE_HPP*/ +#endif /*INCLUDED_GRAS_IO_SIGNATURE_HPP*/ diff --git a/include/gnuradio/sbuffer.hpp b/include/gras/sbuffer.hpp index 6398991..7997e09 100644 --- a/include/gnuradio/sbuffer.hpp +++ b/include/gras/sbuffer.hpp @@ -14,16 +14,16 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#ifndef INCLUDED_GNURADIO_SBUFFER_HPP -#define INCLUDED_GNURADIO_SBUFFER_HPP +#ifndef INCLUDED_GRAS_SBUFFER_HPP +#define INCLUDED_GRAS_SBUFFER_HPP -#include <gnuradio/gras.hpp> +#include <gras/gras.hpp> #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> #include <boost/intrusive_ptr.hpp> #include <boost/function.hpp> -namespace gnuradio +namespace gras { struct SBufferImpl; @@ -135,8 +135,8 @@ struct GRAS_API SBuffer : boost::intrusive_ptr<SBufferImpl> size_t use_count(void) const; }; -} //namespace gnuradio +} //namespace gras -#include <gnuradio/sbuffer.ipp> +#include <gras/sbuffer.ipp> -#endif /*INCLUDED_GNURADIO_SBUFFER_HPP*/ +#endif /*INCLUDED_GRAS_SBUFFER_HPP*/ diff --git a/include/gnuradio/sbuffer.ipp b/include/gras/sbuffer.ipp index 11a16a0..c090123 100644 --- a/include/gnuradio/sbuffer.ipp +++ b/include/gras/sbuffer.ipp @@ -14,12 +14,12 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#ifndef INCLUDED_GNURADIO_SBUFFER_IPP -#define INCLUDED_GNURADIO_SBUFFER_IPP +#ifndef INCLUDED_GRAS_SBUFFER_IPP +#define INCLUDED_GRAS_SBUFFER_IPP #include <boost/detail/atomic_count.hpp> -namespace gnuradio +namespace gras { struct SBufferImpl @@ -93,6 +93,6 @@ GRAS_FORCE_INLINE size_t SBuffer::use_count(void) const return (*this)->count; } -} //namespace gnuradio +} //namespace gras -#endif /*INCLUDED_GNURADIO_SBUFFER_IPP*/ +#endif /*INCLUDED_GRAS_SBUFFER_IPP*/ diff --git a/include/gnuradio/tags.hpp b/include/gras/tags.hpp index bc83709..9faa667 100644 --- a/include/gnuradio/tags.hpp +++ b/include/gras/tags.hpp @@ -14,15 +14,15 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#ifndef INCLUDED_GNURADIO_TAGS_HPP -#define INCLUDED_GNURADIO_TAGS_HPP +#ifndef INCLUDED_GRAS_TAGS_HPP +#define INCLUDED_GRAS_TAGS_HPP -#include <gnuradio/gras.hpp> +#include <gras/gras.hpp> #include <boost/operators.hpp> #include <PMC/PMC.hpp> #include <boost/cstdint.hpp> -namespace gnuradio +namespace gras { struct GRAS_API Tag : boost::less_than_comparable<Tag> @@ -48,6 +48,6 @@ struct GRAS_API Tag : boost::less_than_comparable<Tag> GRAS_API bool operator<(const Tag &lhs, const Tag &rhs); -} //namespace gnuradio +} //namespace gras -#endif /*INCLUDED_GNURADIO_TAGS_HPP*/ +#endif /*INCLUDED_GRAS_TAGS_HPP*/ diff --git a/include/gnuradio/thread_pool.hpp b/include/gras/thread_pool.hpp index d34c161..bfda931 100644 --- a/include/gnuradio/thread_pool.hpp +++ b/include/gras/thread_pool.hpp @@ -14,10 +14,10 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#ifndef INCLUDED_GNURADIO_THREAD_POOL_HPP -#define INCLUDED_GNURADIO_THREAD_POOL_HPP +#ifndef INCLUDED_GRAS_THREAD_POOL_HPP +#define INCLUDED_GRAS_THREAD_POOL_HPP -#include <gnuradio/gras.hpp> +#include <gras/gras.hpp> #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> #include <string> @@ -29,7 +29,7 @@ namespace Theron class Framework; } -namespace gnuradio +namespace gras { struct GRAS_API ThreadPoolConfig @@ -87,6 +87,6 @@ struct GRAS_API ThreadPool : boost::shared_ptr<Theron::Framework> void set_active(void); }; -} //namespace gnuradio +} //namespace gras -#endif /*INCLUDED_GNURADIO_THREAD_POOL_HPP*/ +#endif /*INCLUDED_GRAS_THREAD_POOL_HPP*/ diff --git a/include/gnuradio/top_block.hpp b/include/gras/top_block.hpp index ad9f02a..8bf366f 100644 --- a/include/gnuradio/top_block.hpp +++ b/include/gras/top_block.hpp @@ -14,12 +14,12 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#ifndef INCLUDED_GNURADIO_TOP_BLOCK_HPP -#define INCLUDED_GNURADIO_TOP_BLOCK_HPP +#ifndef INCLUDED_GRAS_TOP_BLOCK_HPP +#define INCLUDED_GRAS_TOP_BLOCK_HPP -#include <gnuradio/hier_block.hpp> +#include <gras/hier_block.hpp> -namespace gnuradio +namespace gras { struct GRAS_API GlobalBlockConfig @@ -93,6 +93,6 @@ struct GRAS_API TopBlock : HierBlock }; -} //namespace gnuradio +} //namespace gras -#endif /*INCLUDED_GNURADIO_TOP_BLOCK_HPP*/ +#endif /*INCLUDED_GRAS_TOP_BLOCK_HPP*/ |