From 77f79c8e2c45d816a2ecb869b2869825b3293640 Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Sun, 28 Oct 2012 22:39:39 -0700
Subject: work on stand-alone library build
---
.gitmodules | 3 -
CMakeLists.txt | 58 ++++++
gnuradio | 1 -
include/gnuradio/block.hpp | 320 --------------------------------
include/gnuradio/element.hpp | 76 --------
include/gnuradio/gr_block.h | 141 --------------
include/gnuradio/gr_hier_block2.h | 49 -----
include/gnuradio/gr_io_signature.h | 85 ---------
include/gnuradio/gr_sync_block.h | 55 ------
include/gnuradio/gr_sync_decimator.h | 36 ----
include/gnuradio/gr_sync_interpolator.h | 36 ----
include/gnuradio/gr_tags.h | 46 -----
include/gnuradio/gr_top_block.h | 48 -----
include/gnuradio/gr_types.h | 45 -----
include/gnuradio/gr_vmcircbuf.h | 10 -
include/gnuradio/gras.hpp | 39 ----
include/gnuradio/hier_block.hpp | 75 --------
include/gnuradio/io_signature.hpp | 113 -----------
include/gnuradio/sbuffer.hpp | 142 --------------
include/gnuradio/sbuffer.ipp | 98 ----------
include/gnuradio/tags.hpp | 53 ------
include/gnuradio/thread_pool.hpp | 92 ---------
include/gnuradio/top_block.hpp | 98 ----------
include/gras/block.hpp | 320 ++++++++++++++++++++++++++++++++
include/gras/element.hpp | 76 ++++++++
include/gras/gras.hpp | 69 +++++++
include/gras/hier_block.hpp | 75 ++++++++
include/gras/io_signature.hpp | 113 +++++++++++
include/gras/sbuffer.hpp | 142 ++++++++++++++
include/gras/sbuffer.ipp | 98 ++++++++++
include/gras/tags.hpp | 53 ++++++
include/gras/thread_pool.hpp | 92 +++++++++
include/gras/top_block.hpp | 98 ++++++++++
lib/CMakeLists.txt | 156 +++-------------
lib/block.cpp | 6 +-
lib/block_actor.cpp | 4 +-
lib/block_allocator.cpp | 2 +-
lib/block_handlers.cpp | 2 +-
lib/block_task.cpp | 2 +-
lib/element.cpp | 4 +-
lib/element_impl.hpp | 8 +-
lib/gr_block.cpp | 213 ---------------------
lib/gr_hier_block2.cpp | 41 ----
lib/gr_sync_block.cpp | 75 --------
lib/gr_top_block.cpp | 69 -------
lib/gras_impl/bitset.hpp | 6 +-
lib/gras_impl/block_actor.hpp | 12 +-
lib/gras_impl/buffer_queue.hpp | 6 +-
lib/gras_impl/input_buffer_queues.hpp | 6 +-
lib/gras_impl/interruptible_thread.hpp | 6 +-
lib/gras_impl/messages.hpp | 54 +++---
lib/gras_impl/output_buffer_queues.hpp | 4 +-
lib/gras_impl/token.hpp | 4 +-
lib/hier_block.cpp | 4 +-
lib/input_handlers.cpp | 2 +-
lib/output_handlers.cpp | 2 +-
lib/pmx_helper.hpp | 263 --------------------------
lib/register_messages.cpp | 38 ++--
lib/sbuffer.cpp | 6 +-
lib/tag_handlers.hpp | 4 +-
lib/tags.cpp | 6 +-
lib/theron_allocator.cpp | 2 +-
lib/top_block.cpp | 4 +-
lib/topology_handler.cpp | 2 +-
64 files changed, 1322 insertions(+), 2546 deletions(-)
create mode 100644 CMakeLists.txt
delete mode 160000 gnuradio
delete mode 100644 include/gnuradio/block.hpp
delete mode 100644 include/gnuradio/element.hpp
delete mode 100644 include/gnuradio/gr_block.h
delete mode 100644 include/gnuradio/gr_hier_block2.h
delete mode 100644 include/gnuradio/gr_io_signature.h
delete mode 100644 include/gnuradio/gr_sync_block.h
delete mode 100644 include/gnuradio/gr_sync_decimator.h
delete mode 100644 include/gnuradio/gr_sync_interpolator.h
delete mode 100644 include/gnuradio/gr_tags.h
delete mode 100644 include/gnuradio/gr_top_block.h
delete mode 100644 include/gnuradio/gr_types.h
delete mode 100644 include/gnuradio/gr_vmcircbuf.h
delete mode 100644 include/gnuradio/gras.hpp
delete mode 100644 include/gnuradio/hier_block.hpp
delete mode 100644 include/gnuradio/io_signature.hpp
delete mode 100644 include/gnuradio/sbuffer.hpp
delete mode 100644 include/gnuradio/sbuffer.ipp
delete mode 100644 include/gnuradio/tags.hpp
delete mode 100644 include/gnuradio/thread_pool.hpp
delete mode 100644 include/gnuradio/top_block.hpp
create mode 100644 include/gras/block.hpp
create mode 100644 include/gras/element.hpp
create mode 100644 include/gras/gras.hpp
create mode 100644 include/gras/hier_block.hpp
create mode 100644 include/gras/io_signature.hpp
create mode 100644 include/gras/sbuffer.hpp
create mode 100644 include/gras/sbuffer.ipp
create mode 100644 include/gras/tags.hpp
create mode 100644 include/gras/thread_pool.hpp
create mode 100644 include/gras/top_block.hpp
delete mode 100644 lib/gr_block.cpp
delete mode 100644 lib/gr_hier_block2.cpp
delete mode 100644 lib/gr_sync_block.cpp
delete mode 100644 lib/gr_top_block.cpp
delete mode 100644 lib/pmx_helper.hpp
diff --git a/.gitmodules b/.gitmodules
index 98a7640..57f9896 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,3 @@
-[submodule "gnuradio"]
- path = gnuradio
- url = https://github.com/guruofquality/gnuradio.git
[submodule "Theron"]
path = Theron
url = https://github.com/guruofquality/Theron.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..8ae84e9
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,58 @@
+########################################################################
+# Project setup
+########################################################################
+cmake_minimum_required(VERSION 2.6)
+project(gras CXX C)
+enable_testing()
+
+#select the release build type by default to get optimization flags
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release")
+ message(STATUS "Build type not specified: defaulting to release.")
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
+
+if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ add_definitions(-DGRAS_DEBUG)
+endif()
+
+set(GRAS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+
+set(LIBVER 0.0.0)
+
+if(CMAKE_COMPILER_IS_GNUCXX)
+ add_definitions(-Wall)
+ add_definitions(-fvisibility=hidden)
+ add_definitions(-fvisibility-inlines-hidden)
+endif()
+
+add_definitions(-DGRAS_DLL=1) #this project builds a dll
+
+########################################################################
+# Component names for install rules
+########################################################################
+if (NOT DEFINED GRAS_COMP_DEVEL)
+ set(GRAS_COMP_DEVEL "devel")
+endif()
+if (NOT DEFINED GRAS_COMP_RUNTIME)
+ set(GRAS_COMP_RUNTIME "runtime")
+endif()
+if (NOT DEFINED GRAS_COMP_PYTHON)
+ set(GRAS_COMP_PYTHON "python")
+endif()
+
+########################################################################
+# Setup PMC Deps
+########################################################################
+set(PMC_COMP_DEVEL ${GRAS_COMP_DEVEL})
+set(PMC_COMP_RUNTIME ${GRAS_COMP_RUNTIME})
+set(PMC_COMP_PYTHON ${GRAS_COMP_PYTHON})
+
+list(APPEND CMAKE_MODULE_PATH ${GRAS_SOURCE_DIR}/PMC/cmake/Modules)
+include_directories(${GRAS_SOURCE_DIR}/PMC/include)
+add_subdirectory(PMC)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(lib)
diff --git a/gnuradio b/gnuradio
deleted file mode 160000
index 517b057..0000000
--- a/gnuradio
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 517b057e732eee9504510f1171d44c98f1ceec95
diff --git a/include/gnuradio/block.hpp b/include/gnuradio/block.hpp
deleted file mode 100644
index bcce34a..0000000
--- a/include/gnuradio/block.hpp
+++ /dev/null
@@ -1,320 +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 .
-
-#ifndef INCLUDED_GNURADIO_BLOCK_HPP
-#define INCLUDED_GNURADIO_BLOCK_HPP
-
-#include
-#include
-#include
-#include
-#include
-#include //iterator range
-
-namespace gnuradio
-{
-
-//! Configuration parameters for an input port
-struct GRAS_API InputPortConfig
-{
- InputPortConfig(void);
-
- /*!
- * Set buffer inlining for this port config.
- * Inlining means that the input buffer can be used as an output buffer.
- * The goal is to make better use of cache and memory bandwidth.
- *
- * By default, inlining is disabled on all input ports.
- * The user should enable inlining on an input port
- * when it is understood that the work function will read
- * before writting to a particular section of the buffer.
- *
- * The scheduler will inline a buffer when
- * * inlining is enabled on the particular input port
- * * block holds the only buffer reference aka unique
- * * the input buffer has the same affinity as the block
- * * the input port has a buffer look-ahead of 0
- *
- * Default = false.
- */
- bool inline_buffer;
-
- /*!
- * Set the number of input buffer look-ahead items.
- * When num look-ahead items are not consumed,
- * they will be available for the next work call.
- * This is used to implement sample memory for
- * things like sliding dot products/FIR filters.
- *
- * Default = 0.
- */
- size_t lookahead_items;
-};
-
-//! Configuration parameters for an output port
-struct GRAS_API OutputPortConfig
-{
- OutputPortConfig(void);
-
- /*!
- * Set an output reserve requirement such that work is called
- * with an output buffer at least reserve items in size.
- *
- * Default = 1.
- */
- size_t reserve_items;
-
- /*!
- * Constrain the maximum number of items that
- * work can be called with for this port.
- *
- * Default = 0 aka disabled.
- */
- size_t maximum_items;
-};
-
-template struct WorkBuffer
-{
- //! get a native pointer type to this buffer
- inline PtrType get(void) const
- {
- return _mem;
- }
-
- //! get a pointer of the desired type to this buffer
- template inline T cast(void) const
- {
- return reinterpret_cast(this->get());
- }
-
- //! get the number of items in this buffer
- inline size_t size(void) const
- {
- return _len;
- }
-
- //! Get the memory pointer reference
- inline PtrType &get(void)
- {
- return _mem;
- }
-
- //! Get the buffer length reference
- inline size_t &size(void)
- {
- return _len;
- }
-
- PtrType _mem;
- size_t _len;
-};
-
-struct GRAS_API Block : Element
-{
-
- //! Contruct an empty/null block
- Block(void);
-
- //! Create a new block given the name
- Block(const std::string &name);
-
- /*******************************************************************
- * Deal with input and output port configuration
- ******************************************************************/
-
- //! Get the configuration rules of an input port
- InputPortConfig input_config(const size_t which_input = 0) const;
-
- //! Set the configuration rules for an input port
- void set_input_config(const InputPortConfig &config, const size_t which_input = 0);
-
- //! Get the configuration rules of an output port
- OutputPortConfig output_config(const size_t which_output = 0) const;
-
- //! Set the configuration rules for an output port
- void set_output_config(const OutputPortConfig &config, const size_t which_output = 0);
-
- /*!
- * Enable fixed rate logic.
- * When enabled, relative rate is assumed to be set,
- * and forecast is automatically called.
- * Also, consume will be called automatically.
- */
- void set_fixed_rate(const bool fixed_rate);
-
- //! Get the fixed rate setting
- bool fixed_rate(void) const;
-
- /*!
- * The relative rate can be thought of as interpolation/decimation.
- * In other words, relative rate is the ratio of output items to input items.
- */
- void set_relative_rate(const double relative_rate);
-
- //! Get the relative rate setting
- double relative_rate(void) const;
-
- /*!
- * The output multiple setting controls work output buffer sizes.
- * Buffers will be number of items modulo rounted to the multiple.
- */
- void set_output_multiple(const size_t multiple);
-
- //! Get the output multiple setting
- size_t output_multiple(void) const;
-
- /*******************************************************************
- * Deal with data production and consumption
- ******************************************************************/
-
- //! Return options for the work call
- enum
- {
- WORK_CALLED_PRODUCE = -2,
- WORK_DONE = -1
- };
-
- //! Call during work to consume items
- void consume(const size_t which_input, const size_t how_many_items);
-
- //! Call during work to consume items
- void consume_each(const size_t how_many_items);
-
- //! Call during work to produce items, must return WORK_CALLED_PRODUCE
- void produce(const size_t which_output, const size_t how_many_items);
-
- /*******************************************************************
- * Deal with tag handling and tag configuration
- ******************************************************************/
-
- enum tag_propagation_policy_t
- {
- TPP_DONT = 0,
- TPP_ALL_TO_ALL = 1,
- TPP_ONE_TO_ONE = 2
- };
-
- uint64_t nitems_read(const size_t which_input);
-
- uint64_t nitems_written(const size_t which_output);
-
- tag_propagation_policy_t tag_propagation_policy(void);
-
- void set_tag_propagation_policy(tag_propagation_policy_t p);
-
- //! Send a tag to the downstream on the given output port
- void post_output_tag(const size_t which_output, const Tag &tag);
-
- //! Iterator return type get_input_tags - stl and boost compliant
- typedef boost::iterator_range::const_iterator> TagIter;
-
- //! Get an iterator of item tags for the given input
- TagIter get_input_tags(const size_t which_input = 0);
-
- /*******************************************************************
- * Work related routines from basic block
- ******************************************************************/
-
- //! Called when the flow graph is started, can overload
- virtual bool start(void);
-
- //! Called when the flow graph is stopped, can overload
- virtual bool stop(void);
-
- typedef std::vector > InputItems;
- typedef std::vector > OutputItems;
-
- //! The official call into the work routine (overload please)
- virtual int work(
- const InputItems &input_items,
- const OutputItems &output_items
- ) = 0;
-
- //! forcast requirements, can be overloaded
- virtual void forecast(
- int noutput_items,
- std::vector &ninput_items_required
- );
-
- //! scheduler calls when the topology is updated, can be overloaded
- virtual bool check_topology(int ninputs, int noutputs);
-
- /*!
- * Set if the work call should be interruptible by stop().
- * Some work implementations block with the expectation of
- * getting a boost thread interrupt in a blocking call.
- * Set set_interruptible_work(true) if this is the case.
- * By default, work implementations are not interruptible.
- */
- void set_interruptible_work(const bool enb);
-
- /*******************************************************************
- * routines related to affinity and allocation
- ******************************************************************/
-
- /*!
- * Set the node affinity of this block.
- * This call affects how output buffers are allocated.
- * By default memory is allocated by malloc.
- * When the affinity is set, virtual memory
- * will be locked to a physical CPU/memory node.
- * \param affinity a memory node on the system
- */
- void set_buffer_affinity(const long affinity);
-
- /*!
- * The output buffer allocator method.
- * This method is called by the scheduler to allocate output buffers.
- * The user may overload this method to create a custom allocator.
- *
- * Example use case:
- * //TODO code example
- *
- * \param which_output the output port index number
- * \param token the token for the buffer's returner
- * \param recommend_length the schedulers recommended length in bytes
- * \return the token used for the buffer allocation (may be the same)
- */
- virtual SBufferToken output_buffer_allocator(
- const size_t which_output,
- const SBufferToken &token,
- const size_t recommend_length
- );
-
- /*!
- * The input buffer allocator method.
- * This method is special and very different from allocate output buffers.
- * Typically, blocks do not have control of their input buffers.
- * When overloaded, an upstream block will ask this block
- * to allocate its output buffers. This way, this block will get
- * input buffers which were actually allocated by this method.
- *
- * \param which_input the input port index number
- * \param token the token for the buffer's returner
- * \param recommend_length the schedulers recommended length in bytes
- * \return the token used for the buffer allocation (may be the same)
- */
- virtual SBufferToken input_buffer_allocator(
- const size_t which_input,
- const SBufferToken &token,
- const size_t recommend_length
- );
-
-};
-
-} //namespace gnuradio
-
-#endif /*INCLUDED_GNURADIO_BLOCK_HPP*/
diff --git a/include/gnuradio/element.hpp b/include/gnuradio/element.hpp
deleted file mode 100644
index abf0e34..0000000
--- a/include/gnuradio/element.hpp
+++ /dev/null
@@ -1,76 +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 .
-
-#ifndef INCLUDED_GNURADIO_ELEMENT_HPP
-#define INCLUDED_GNURADIO_ELEMENT_HPP
-
-#include
-#include
-#include
-#include
-
-namespace gnuradio
-{
-
-class ElementImpl;
-
-struct GRAS_API Element : boost::shared_ptr, boost::enable_shared_from_this
-{
-
- //! Create an empty element
- Element(void);
-
- //! Creates a new element given the name
- Element(const std::string &name);
-
- /*!
- * Create an element from a shared pointer to an element.
- * Good for that factory function/shared ptr paradigm.
- */
- template
- Element(const boost::shared_ptr &elem)
- {
- *this = elem->shared_to_element();
- }
-
- //! Convert a shared ptr of a derived class to an Element
- Element &shared_to_element(void);
-
- //! for internal use only
- boost::weak_ptr weak_self;
-
- //! An integer ID that is unique across the process
- long unique_id(void) const;
-
- //! Get the name of this element
- std::string name(void) const;
-
- //! get a canonical name for this element
- std::string to_string(void) const;
-
- void set_output_signature(const gnuradio::IOSignature &sig);
-
- void set_input_signature(const gnuradio::IOSignature &sig);
-
- const gnuradio::IOSignature &input_signature(void) const;
-
- const gnuradio::IOSignature &output_signature(void) const;
-
-};
-
-} //namespace gnuradio
-
-#endif /*INCLUDED_GNURADIO_ELEMENT_HPP*/
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 .
-
-#ifndef INCLUDED_GNURADIO_GR_BLOCK_H
-#define INCLUDED_GNURADIO_GR_BLOCK_H
-
-#include
-#include
-#include
-#include
-#include
-
-typedef std::vector gr_vector_int;
-typedef std::vector gr_vector_void_star;
-typedef std::vector gr_vector_const_void_star;
-
-namespace gnuradio
-{
-//! dummy entry, just here for legacy purposes
-template
-boost::shared_ptr get_initial_sptr(T *p)
-{
- return boost::shared_ptr(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 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 &);
-
- /*!
- * \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 &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_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 .
-
-#ifndef INCLUDED_GNURADIO_GR_HIER_BLOCK2_H
-#define INCLUDED_GNURADIO_GR_HIER_BLOCK2_H
-
-#include
-#include
-
-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_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 .
-
-#ifndef INCLUDED_GNURADIO_GR_IO_SIGNATURE_H
-#define INCLUDED_GNURADIO_GR_IO_SIGNATURE_H
-
-#include
-#include
-
-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
-inline gr_io_signature_sptr gr_make_io_signaturev(
- int min_streams,
- int max_streams,
- const std::vector &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 .
-
-#ifndef INCLUDED_GNURADIO_GR_SYNC_BLOCK_H
-#define INCLUDED_GNURADIO_GR_SYNC_BLOCK_H
-
-#include
-
-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 .
-
-#ifndef INCLUDED_GNURADIO_GR_SYNC_DECIMATOR_H
-#define INCLUDED_GNURADIO_GR_SYNC_DECIMATOR_H
-
-#include
-
-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 .
-
-#ifndef INCLUDED_GNURADIO_GR_SYNC_INTERPOLATOR_H
-#define INCLUDED_GNURADIO_GR_SYNC_INTERPOLATOR_H
-
-#include
-
-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 .
-
-#ifndef INCLUDED_GR_TAGS_H
-#define INCLUDED_GR_TAGS_H
-
-#include
-#include
-
-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 .
-
-#ifndef INCLUDED_GNURADIO_GR_TOP_BLOCK_H
-#define INCLUDED_GNURADIO_GR_TOP_BLOCK_H
-
-#include
-#include
-
-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_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 .
-
-#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
-#include
-#include
-#include
-#include
-
-// and gnuradio apparently needs its own typedefs for stdint...
-#ifdef __cplusplus
-
-#include
-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
-typedef std::complex gr_complex;
-typedef std::complex 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 .
-
-#ifndef INCLUDED_GNURADIO_GRAS_HPP
-#define INCLUDED_GNURADIO_GRAS_HPP
-
-#include
-
-//this is part of core for now, treat it as such
-#include
-#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/hier_block.hpp b/include/gnuradio/hier_block.hpp
deleted file mode 100644
index c981b03..0000000
--- a/include/gnuradio/hier_block.hpp
+++ /dev/null
@@ -1,75 +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 .
-
-#ifndef INCLUDED_GNURADIO_HIER_BLOCK_HPP
-#define INCLUDED_GNURADIO_HIER_BLOCK_HPP
-
-#include
-
-namespace gnuradio
-{
-
-struct GRAS_API HierBlock : Element
-{
- HierBlock(void);
-
- HierBlock(const std::string &name);
-
- void connect(const Element &elem);
-
- void disconnect(const Element &elem);
-
- void connect(
- const Element &src,
- const size_t src_index,
- const Element &sink,
- const size_t sink_index
- );
-
- void disconnect(
- const Element &src,
- const size_t src_index,
- const Element &sink,
- const size_t sink_index
- );
-
- void disconnect_all(void);
-
- /*!
- * Commit changes to the overall flow graph.
- * Call this after modifying connections.
- */
- virtual void commit(void);
-
- /*!
- * The lock() call is deprecated.
- * Topology can be changed duing design execution.
- * The underlying implementation is literally a NOP.
- */
- inline void lock(void){}
-
- /*!
- * The unlock() call is deprecated.
- * Topology can be changed duing design execution.
- * The underlying implementation is this->commit().
- */
- inline void unlock(void){this->commit();}
-
-};
-
-} //namespace gnuradio
-
-#endif /*INCLUDED_GNURADIO_HIER_BLOCK_HPP*/
diff --git a/include/gnuradio/io_signature.hpp b/include/gnuradio/io_signature.hpp
deleted file mode 100644
index b6b11a5..0000000
--- a/include/gnuradio/io_signature.hpp
+++ /dev/null
@@ -1,113 +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 .
-
-#ifndef INCLUDED_GNURADIO_IO_SIGNATURE_HPP
-#define INCLUDED_GNURADIO_IO_SIGNATURE_HPP
-
-#include
-#include
-
-namespace gnuradio
-{
-
-/*!
- * An IO signature describes the input or output specifications
- * for the streaming input or output ports of a block.
- * Properties are a maximum and minimum number of ports,
- * and an item size in bytes for each port.
- */
-struct IOSignature : std::vector
-{
- static const int IO_INFINITE = -1;
-
- //! Create an empty signature with infinite IO
- IOSignature(void)
- {
- this->set_min_streams(IO_INFINITE);
- this->set_max_streams(IO_INFINITE);
- }
-
- //! Create a signature with the specified min and max streams
- IOSignature(const int min_streams, const int max_streams)
- {
- if (min_streams > max_streams and max_streams != IO_INFINITE)
- {
- throw std::invalid_argument("io signature fail: min_streams > max_streams");
- }
- this->set_min_streams(min_streams);
- this->set_max_streams(max_streams);
- }
-
- //! Construct from pointer for backwards compatible shared_ptr usage.
- IOSignature(const IOSignature *sig)
- {
- *this = *sig;
- }
-
- //! Overloaded arrow operator for backwards compatible shared_ptr usage.
- IOSignature* operator->(void)
- {
- return this;
- };
-
- //! Overloaded arrow operator for backwards compatible shared_ptr usage.
- const IOSignature* operator->(void) const
- {
- return this;
- };
-
- void set_min_streams(const int val)
- {
- _min_streams = val;
- }
-
- void set_max_streams(const int val)
- {
- _max_streams = val;
- }
-
- int min_streams(void) const
- {
- return _min_streams;
- }
-
- int max_streams(void) const
- {
- return _max_streams;
- }
-
- int sizeof_stream_item(const int index) const
- {
- if (this->empty()) return 0;
- if (this->size() > unsigned(index))
- {
- return this->at(index);
- }
- return this->back();
- }
-
- std::vector sizeof_stream_items(void) const
- {
- return *this;
- }
-
- int _min_streams;
- int _max_streams;
-};
-
-} //namespace gnuradio
-
-#endif /*INCLUDED_GNURADIO_IO_SIGNATURE_HPP*/
diff --git a/include/gnuradio/sbuffer.hpp b/include/gnuradio/sbuffer.hpp
deleted file mode 100644
index 6398991..0000000
--- a/include/gnuradio/sbuffer.hpp
+++ /dev/null
@@ -1,142 +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 .
-
-#ifndef INCLUDED_GNURADIO_SBUFFER_HPP
-#define INCLUDED_GNURADIO_SBUFFER_HPP
-
-#include
-#include
-#include
-#include
-#include
-
-namespace gnuradio
-{
-
-struct SBufferImpl;
-struct SBuffer;
-
-//! The callback function type when buffers dereference
-typedef boost::function SBufferDeleter;
-
-//! The token type held by the caller
-typedef boost::shared_ptr SBufferToken;
-
-//! The token type weak ptr help by buffer
-typedef boost::weak_ptr SBufferTokenWeak;
-
-struct GRAS_API SBufferConfig
-{
- //! Default constructor zeros out buffer config
- SBufferConfig(void);
-
- //! pointer to the memory start
- void *memory;
-
- //! length of the memory in bytes
- size_t length;
-
- //! memory affinity - meta information
- long affinity;
-
- //! index number for custom allocation purposes
- size_t user_index;
-
- //! deleter callback, may be used to free
- SBufferDeleter deleter;
-
- //! token object, called if set under deref condition
- SBufferTokenWeak token;
-};
-
-/*!
- * SBuffer is a smart/shared reference counted handler of memory.
- * Thank you boost smart/shared pointers for the disambiguation!
- *
- * Default allocator:
- * To use the default system allocator, set the memory to NULL,
- * and set length and affinity to the desired values.
- * The deleter will be automaically configured by the allocator.
- *
- * Custom allocator:
- * Set all config struct members. Its all you!
- *
- * Token usage:
- * When a token is set, the buffer will not cleanup and call the deleter.
- * Rather, the bound function in the token will be called with the buffer.
- * A parent object should hold the shared pointer to the token.
- * When the parent object deconstructs, the weak pointer will die,
- * and the normal buffer cleanup/freeing/deconstruction will happen.
- *
- * Length and offset usage:
- * Length and offset are intentionally object members
- * and not part of the ref-counted intrusive_ptr guts.
- * These members should be modified carefully
- * to pass a subset of the memory downstream.
- *
- * Length and offset recommendation:
- * These values should probably be reset by the
- * bound token or when a fresh buffer is popped.
- */
-struct GRAS_API SBuffer : boost::intrusive_ptr
-{
- //! Default constructor, zeros things
- SBuffer(void);
-
- /*!
- * Create a new buffer.
- * The config object represents a chunk of memory,
- * or instructions for the default allocator.
- */
- SBuffer(const SBufferConfig &config);
-
- /*!
- * Get a pointer to the start of the underlying memory
- */
- void *get_actual_memory(void) const;
-
- /*!
- * Get the length of the underlying memory in bytes
- */
- size_t get_actual_length(void) const;
-
- //! Get a pointer into valid memory
- void *get(const ptrdiff_t delta_bytes = 0) const;
-
- //! The offset into valid memory in bytes
- size_t offset;
-
- //! The number of valid bytes past offset
- size_t length;
-
- //! Get the affinity of the memory
- long get_affinity(void) const;
-
- //! Get the user index number
- size_t get_user_index(void) const;
-
- //! Unique if caller holds the only reference count
- bool unique(void) const;
-
- //! Get the number of reference holders
- size_t use_count(void) const;
-};
-
-} //namespace gnuradio
-
-#include
-
-#endif /*INCLUDED_GNURADIO_SBUFFER_HPP*/
diff --git a/include/gnuradio/sbuffer.ipp b/include/gnuradio/sbuffer.ipp
deleted file mode 100644
index 11a16a0..0000000
--- a/include/gnuradio/sbuffer.ipp
+++ /dev/null
@@ -1,98 +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 .
-
-#ifndef INCLUDED_GNURADIO_SBUFFER_IPP
-#define INCLUDED_GNURADIO_SBUFFER_IPP
-
-#include
-
-namespace gnuradio
-{
-
-struct SBufferImpl
-{
- SBufferImpl(const SBufferConfig &config):
- count(0),
- config(config)
- {
- //NOP
- }
-
- boost::detail::atomic_count count;
- SBufferConfig config;
-};
-
-
-extern GRAS_API void sbuffer_handle_deref(SBufferImpl *impl);
-
-GRAS_FORCE_INLINE void intrusive_ptr_add_ref(SBufferImpl *impl)
-{
- ++impl->count;
-}
-
-GRAS_FORCE_INLINE void intrusive_ptr_release(SBufferImpl *impl)
-{
- if (--impl->count == 0)
- {
- sbuffer_handle_deref(impl);
- }
-}
-
-GRAS_FORCE_INLINE SBuffer::SBuffer(void):
- offset(0),
- length(0)
-{
- //NOP
-}
-
-GRAS_FORCE_INLINE void *SBuffer::get_actual_memory(void) const
-{
- return (*this)->config.memory;
-}
-
-GRAS_FORCE_INLINE size_t SBuffer::get_actual_length(void) const
-{
- return (*this)->config.length;
-}
-
-GRAS_FORCE_INLINE void *SBuffer::get(const ptrdiff_t delta_bytes) const
-{
- return ((char *)(*this)->config.memory) + this->offset + delta_bytes;
-}
-
-GRAS_FORCE_INLINE long SBuffer::get_affinity(void) const
-{
- return (*this)->config.affinity;
-}
-
-GRAS_FORCE_INLINE size_t SBuffer::get_user_index(void) const
-{
- return (*this)->config.user_index;
-}
-
-GRAS_FORCE_INLINE bool SBuffer::unique(void) const
-{
- return (*this)->count == 1;
-}
-
-GRAS_FORCE_INLINE size_t SBuffer::use_count(void) const
-{
- return (*this)->count;
-}
-
-} //namespace gnuradio
-
-#endif /*INCLUDED_GNURADIO_SBUFFER_IPP*/
diff --git a/include/gnuradio/tags.hpp b/include/gnuradio/tags.hpp
deleted file mode 100644
index bc83709..0000000
--- a/include/gnuradio/tags.hpp
+++ /dev/null
@@ -1,53 +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 .
-
-#ifndef INCLUDED_GNURADIO_TAGS_HPP
-#define INCLUDED_GNURADIO_TAGS_HPP
-
-#include
-#include
-#include
-#include
-
-namespace gnuradio
-{
-
-struct GRAS_API Tag : boost::less_than_comparable
-{
- //! Make an empty tag with null members
- Tag(void);
-
- //! Make a tag from parameters to initialize the members
- Tag(const uint64_t &offset, const PMCC &key, const PMCC &value, const PMCC &srcid = PMCC());
-
- //! the absolute item count associated with this tag
- boost::uint64_t offset;
-
- //! A symbolic name identifying the type of tag
- PMCC key;
-
- //! The value of this tag -> the sample metadata
- PMCC value;
-
- //! The optional source ID -> something unique
- PMCC srcid;
-};
-
-GRAS_API bool operator<(const Tag &lhs, const Tag &rhs);
-
-} //namespace gnuradio
-
-#endif /*INCLUDED_GNURADIO_TAGS_HPP*/
diff --git a/include/gnuradio/thread_pool.hpp b/include/gnuradio/thread_pool.hpp
deleted file mode 100644
index d34c161..0000000
--- a/include/gnuradio/thread_pool.hpp
+++ /dev/null
@@ -1,92 +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 .
-
-#ifndef INCLUDED_GNURADIO_THREAD_POOL_HPP
-#define INCLUDED_GNURADIO_THREAD_POOL_HPP
-
-#include
-#include
-#include
-#include
-
-//! ThreadPool is an unexposed Theron Framework
-//! Forward declare the Framwork for c++ users
-namespace Theron
-{
- class Framework;
-}
-
-namespace gnuradio
-{
-
-struct GRAS_API ThreadPoolConfig
-{
- ThreadPoolConfig(void);
-
- /*!
- * The initial number of worker threads to create within the framework.
- * Default is the number of CPUs on the system.
- */
- size_t thread_count;
-
- /*!
- * Specifies the NUMA processor nodes upon which the framework may execute.
- * Default is all NUMA nodes on the system.
- */
- size_t node_mask;
-
- /*!
- * Specifies the subset of the processors in each NUMA processor node upon which the framework may execute.
- * Default is all CPUs per NUMA node.
- */
- size_t processor_mask;
-
- /*!
- * Yield strategy employed by the worker threads in the framework.
- * POLITE, ///< Threads go to sleep when not in use.
- * STRONG, ///< Threads yield to other threads but don't go to sleep.
- * AGGRESSIVE ///< Threads never yield to other threads.
- * Default is STRONG.
- */
- std::string yield_strategy;
-};
-
-/*!
- * Thread Pool is is a this wrapper of Theron Framework, see link for more details:
- * http://docs.theron-library.com/5.00/structTheron_1_1Framework_1_1Parameters.html
- */
-struct GRAS_API ThreadPool : boost::shared_ptr
-{
- //! Create an empty thread pool
- ThreadPool(void);
-
- //! Create a thread pool from a weak pointer to a framework
- ThreadPool(boost::weak_ptr p);
-
- //! Create a new thread pool with parameters
- ThreadPool(const ThreadPoolConfig &config);
-
- /*!
- * When a block is created, it will execute in the active pool.
- * Use this call before creating a block to control which
- * thread pool that the block's work routine will run in.
- */
- void set_active(void);
-};
-
-} //namespace gnuradio
-
-#endif /*INCLUDED_GNURADIO_THREAD_POOL_HPP*/
diff --git a/include/gnuradio/top_block.hpp b/include/gnuradio/top_block.hpp
deleted file mode 100644
index ad9f02a..0000000
--- a/include/gnuradio/top_block.hpp
+++ /dev/null
@@ -1,98 +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 .
-
-#ifndef INCLUDED_GNURADIO_TOP_BLOCK_HPP
-#define INCLUDED_GNURADIO_TOP_BLOCK_HPP
-
-#include
-
-namespace gnuradio
-{
-
-struct GRAS_API GlobalBlockConfig
-{
- GlobalBlockConfig(void);
-
- /*!
- * Constrain the maximum number of items that
- * work can be called with for all output ports.
- *
- * Default = 0 aka disabled.
- */
- size_t maximum_output_items;
-
- /*!
- * Set the global memory node affinity.
- * Blocks that have not been explicitly set,
- * will take on this new buffer_affinity.
- *
- * Default = -1 aka no affinity.
- */
- long buffer_affinity;
-};
-
-struct GRAS_API TopBlock : HierBlock
-{
- TopBlock(void);
-
- TopBlock(const std::string &name);
-
- //! Get the global block config settings
- GlobalBlockConfig global_config(void) const;
-
- //! Set the global block config settings
- void set_global_config(const GlobalBlockConfig &config);
-
- /*!
- * Commit changes to the overall flow graph.
- * Call this after modifying connections.
- * Commit is called automatically by start/stop/run.
- */
- void commit(void);
-
- /*!
- * Run is for finite flow graph executions.
- * Mostly for testing purposes only.
- */
- void run(void);
-
- //! Start a flow graph execution (does not block)
- void start(void);
-
- //! Stop a flow graph execution (does not block)
- void stop(void);
-
- /*!
- * Wait for threads to exit after stop() or run().
- * This is a blocking call and will not return until
- * all blocks in the topology have been marked done.
- */
- virtual void wait(void);
-
- /*!
- * Wait for threads to exit after stop() or run().
- * This is call will block until timeout or done.
- *
- * \param timeout the timeout in seconds
- * \return true of execution completed
- */
- virtual bool wait(const double timeout);
-
-};
-
-} //namespace gnuradio
-
-#endif /*INCLUDED_GNURADIO_TOP_BLOCK_HPP*/
diff --git a/include/gras/block.hpp b/include/gras/block.hpp
new file mode 100644
index 0000000..983d54a
--- /dev/null
+++ b/include/gras/block.hpp
@@ -0,0 +1,320 @@
+//
+// 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 .
+
+#ifndef INCLUDED_GRAS_BLOCK_HPP
+#define INCLUDED_GRAS_BLOCK_HPP
+
+#include
+#include
+#include
+#include
+#include
+#include //iterator range
+
+namespace gras
+{
+
+//! Configuration parameters for an input port
+struct GRAS_API InputPortConfig
+{
+ InputPortConfig(void);
+
+ /*!
+ * Set buffer inlining for this port config.
+ * Inlining means that the input buffer can be used as an output buffer.
+ * The goal is to make better use of cache and memory bandwidth.
+ *
+ * By default, inlining is disabled on all input ports.
+ * The user should enable inlining on an input port
+ * when it is understood that the work function will read
+ * before writting to a particular section of the buffer.
+ *
+ * The scheduler will inline a buffer when
+ * * inlining is enabled on the particular input port
+ * * block holds the only buffer reference aka unique
+ * * the input buffer has the same affinity as the block
+ * * the input port has a buffer look-ahead of 0
+ *
+ * Default = false.
+ */
+ bool inline_buffer;
+
+ /*!
+ * Set the number of input buffer look-ahead items.
+ * When num look-ahead items are not consumed,
+ * they will be available for the next work call.
+ * This is used to implement sample memory for
+ * things like sliding dot products/FIR filters.
+ *
+ * Default = 0.
+ */
+ size_t lookahead_items;
+};
+
+//! Configuration parameters for an output port
+struct GRAS_API OutputPortConfig
+{
+ OutputPortConfig(void);
+
+ /*!
+ * Set an output reserve requirement such that work is called
+ * with an output buffer at least reserve items in size.
+ *
+ * Default = 1.
+ */
+ size_t reserve_items;
+
+ /*!
+ * Constrain the maximum number of items that
+ * work can be called with for this port.
+ *
+ * Default = 0 aka disabled.
+ */
+ size_t maximum_items;
+};
+
+template struct WorkBuffer
+{
+ //! get a native pointer type to this buffer
+ inline PtrType get(void) const
+ {
+ return _mem;
+ }
+
+ //! get a pointer of the desired type to this buffer
+ template inline T cast(void) const
+ {
+ return reinterpret_cast(this->get());
+ }
+
+ //! get the number of items in this buffer
+ inline size_t size(void) const
+ {
+ return _len;
+ }
+
+ //! Get the memory pointer reference
+ inline PtrType &get(void)
+ {
+ return _mem;
+ }
+
+ //! Get the buffer length reference
+ inline size_t &size(void)
+ {
+ return _len;
+ }
+
+ PtrType _mem;
+ size_t _len;
+};
+
+struct GRAS_API Block : Element
+{
+
+ //! Contruct an empty/null block
+ Block(void);
+
+ //! Create a new block given the name
+ Block(const std::string &name);
+
+ /*******************************************************************
+ * Deal with input and output port configuration
+ ******************************************************************/
+
+ //! Get the configuration rules of an input port
+ InputPortConfig input_config(const size_t which_input = 0) const;
+
+ //! Set the configuration rules for an input port
+ void set_input_config(const InputPortConfig &config, const size_t which_input = 0);
+
+ //! Get the configuration rules of an output port
+ OutputPortConfig output_config(const size_t which_output = 0) const;
+
+ //! Set the configuration rules for an output port
+ void set_output_config(const OutputPortConfig &config, const size_t which_output = 0);
+
+ /*!
+ * Enable fixed rate logic.
+ * When enabled, relative rate is assumed to be set,
+ * and forecast is automatically called.
+ * Also, consume will be called automatically.
+ */
+ void set_fixed_rate(const bool fixed_rate);
+
+ //! Get the fixed rate setting
+ bool fixed_rate(void) const;
+
+ /*!
+ * The relative rate can be thought of as interpolation/decimation.
+ * In other words, relative rate is the ratio of output items to input items.
+ */
+ void set_relative_rate(const double relative_rate);
+
+ //! Get the relative rate setting
+ double relative_rate(void) const;
+
+ /*!
+ * The output multiple setting controls work output buffer sizes.
+ * Buffers will be number of items modulo rounted to the multiple.
+ */
+ void set_output_multiple(const size_t multiple);
+
+ //! Get the output multiple setting
+ size_t output_multiple(void) const;
+
+ /*******************************************************************
+ * Deal with data production and consumption
+ ******************************************************************/
+
+ //! Return options for the work call
+ enum
+ {
+ WORK_CALLED_PRODUCE = -2,
+ WORK_DONE = -1
+ };
+
+ //! Call during work to consume items
+ void consume(const size_t which_input, const size_t how_many_items);
+
+ //! Call during work to consume items
+ void consume_each(const size_t how_many_items);
+
+ //! Call during work to produce items, must return WORK_CALLED_PRODUCE
+ void produce(const size_t which_output, const size_t how_many_items);
+
+ /*******************************************************************
+ * Deal with tag handling and tag configuration
+ ******************************************************************/
+
+ enum tag_propagation_policy_t
+ {
+ TPP_DONT = 0,
+ TPP_ALL_TO_ALL = 1,
+ TPP_ONE_TO_ONE = 2
+ };
+
+ uint64_t nitems_read(const size_t which_input);
+
+ uint64_t nitems_written(const size_t which_output);
+
+ tag_propagation_policy_t tag_propagation_policy(void);
+
+ void set_tag_propagation_policy(tag_propagation_policy_t p);
+
+ //! Send a tag to the downstream on the given output port
+ void post_output_tag(const size_t which_output, const Tag &tag);
+
+ //! Iterator return type get_input_tags - stl and boost compliant
+ typedef boost::iterator_range::const_iterator> TagIter;
+
+ //! Get an iterator of item tags for the given input
+ TagIter get_input_tags(const size_t which_input = 0);
+
+ /*******************************************************************
+ * Work related routines from basic block
+ ******************************************************************/
+
+ //! Called when the flow graph is started, can overload
+ virtual bool start(void);
+
+ //! Called when the flow graph is stopped, can overload
+ virtual bool stop(void);
+
+ typedef std::vector > InputItems;
+ typedef std::vector > OutputItems;
+
+ //! The official call into the work routine (overload please)
+ virtual int work(
+ const InputItems &input_items,
+ const OutputItems &output_items
+ ) = 0;
+
+ //! forcast requirements, can be overloaded
+ virtual void forecast(
+ int noutput_items,
+ std::vector &ninput_items_required
+ );
+
+ //! scheduler calls when the topology is updated, can be overloaded
+ virtual bool check_topology(int ninputs, int noutputs);
+
+ /*!
+ * Set if the work call should be interruptible by stop().
+ * Some work implementations block with the expectation of
+ * getting a boost thread interrupt in a blocking call.
+ * Set set_interruptible_work(true) if this is the case.
+ * By default, work implementations are not interruptible.
+ */
+ void set_interruptible_work(const bool enb);
+
+ /*******************************************************************
+ * routines related to affinity and allocation
+ ******************************************************************/
+
+ /*!
+ * Set the node affinity of this block.
+ * This call affects how output buffers are allocated.
+ * By default memory is allocated by malloc.
+ * When the affinity is set, virtual memory
+ * will be locked to a physical CPU/memory node.
+ * \param affinity a memory node on the system
+ */
+ void set_buffer_affinity(const long affinity);
+
+ /*!
+ * The output buffer allocator method.
+ * This method is called by the scheduler to allocate output buffers.
+ * The user may overload this method to create a custom allocator.
+ *
+ * Example use case:
+ * //TODO code example
+ *
+ * \param which_output the output port index number
+ * \param token the token for the buffer's returner
+ * \param recommend_length the schedulers recommended length in bytes
+ * \return the token used for the buffer allocation (may be the same)
+ */
+ virtual SBufferToken output_buffer_allocator(
+ const size_t which_output,
+ const SBufferToken &token,
+ const size_t recommend_length
+ );
+
+ /*!
+ * The input buffer allocator method.
+ * This method is special and very different from allocate output buffers.
+ * Typically, blocks do not have control of their input buffers.
+ * When overloaded, an upstream block will ask this block
+ * to allocate its output buffers. This way, this block will get
+ * input buffers which were actually allocated by this method.
+ *
+ * \param which_input the input port index number
+ * \param token the token for the buffer's returner
+ * \param recommend_length the schedulers recommended length in bytes
+ * \return the token used for the buffer allocation (may be the same)
+ */
+ virtual SBufferToken input_buffer_allocator(
+ const size_t which_input,
+ const SBufferToken &token,
+ const size_t recommend_length
+ );
+
+};
+
+} //namespace gras
+
+#endif /*INCLUDED_GRAS_BLOCK_HPP*/
diff --git a/include/gras/element.hpp b/include/gras/element.hpp
new file mode 100644
index 0000000..3142510
--- /dev/null
+++ b/include/gras/element.hpp
@@ -0,0 +1,76 @@
+//
+// 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 .
+
+#ifndef INCLUDED_GRAS_ELEMENT_HPP
+#define INCLUDED_GRAS_ELEMENT_HPP
+
+#include
+#include
+#include
+#include
+
+namespace gras
+{
+
+class ElementImpl;
+
+struct GRAS_API Element : boost::shared_ptr, boost::enable_shared_from_this
+{
+
+ //! Create an empty element
+ Element(void);
+
+ //! Creates a new element given the name
+ Element(const std::string &name);
+
+ /*!
+ * Create an element from a shared pointer to an element.
+ * Good for that factory function/shared ptr paradigm.
+ */
+ template
+ Element(const boost::shared_ptr &elem)
+ {
+ *this = elem->shared_to_element();
+ }
+
+ //! Convert a shared ptr of a derived class to an Element
+ Element &shared_to_element(void);
+
+ //! for internal use only
+ boost::weak_ptr weak_self;
+
+ //! An integer ID that is unique across the process
+ long unique_id(void) const;
+
+ //! Get the name of this element
+ std::string name(void) const;
+
+ //! get a canonical name for this element
+ std::string to_string(void) const;
+
+ void set_output_signature(const gras::IOSignature &sig);
+
+ void set_input_signature(const gras::IOSignature &sig);
+
+ const gras::IOSignature &input_signature(void) const;
+
+ const gras::IOSignature &output_signature(void) const;
+
+};
+
+} //namespace gras
+
+#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 .
+
+#ifndef INCLUDED_GRAS_GRAS_HPP
+#define INCLUDED_GRAS_GRAS_HPP
+
+#include
+
+// 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/gras/hier_block.hpp b/include/gras/hier_block.hpp
new file mode 100644
index 0000000..0574f14
--- /dev/null
+++ b/include/gras/hier_block.hpp
@@ -0,0 +1,75 @@
+//
+// 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 .
+
+#ifndef INCLUDED_GRAS_HIER_BLOCK_HPP
+#define INCLUDED_GRAS_HIER_BLOCK_HPP
+
+#include
+
+namespace gras
+{
+
+struct GRAS_API HierBlock : Element
+{
+ HierBlock(void);
+
+ HierBlock(const std::string &name);
+
+ void connect(const Element &elem);
+
+ void disconnect(const Element &elem);
+
+ void connect(
+ const Element &src,
+ const size_t src_index,
+ const Element &sink,
+ const size_t sink_index
+ );
+
+ void disconnect(
+ const Element &src,
+ const size_t src_index,
+ const Element &sink,
+ const size_t sink_index
+ );
+
+ void disconnect_all(void);
+
+ /*!
+ * Commit changes to the overall flow graph.
+ * Call this after modifying connections.
+ */
+ virtual void commit(void);
+
+ /*!
+ * The lock() call is deprecated.
+ * Topology can be changed duing design execution.
+ * The underlying implementation is literally a NOP.
+ */
+ inline void lock(void){}
+
+ /*!
+ * The unlock() call is deprecated.
+ * Topology can be changed duing design execution.
+ * The underlying implementation is this->commit().
+ */
+ inline void unlock(void){this->commit();}
+
+};
+
+} //namespace gras
+
+#endif /*INCLUDED_GRAS_HIER_BLOCK_HPP*/
diff --git a/include/gras/io_signature.hpp b/include/gras/io_signature.hpp
new file mode 100644
index 0000000..bb0df5f
--- /dev/null
+++ b/include/gras/io_signature.hpp
@@ -0,0 +1,113 @@
+//
+// 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 .
+
+#ifndef INCLUDED_GRAS_IO_SIGNATURE_HPP
+#define INCLUDED_GRAS_IO_SIGNATURE_HPP
+
+#include
+#include
+
+namespace gras
+{
+
+/*!
+ * An IO signature describes the input or output specifications
+ * for the streaming input or output ports of a block.
+ * Properties are a maximum and minimum number of ports,
+ * and an item size in bytes for each port.
+ */
+struct IOSignature : std::vector
+{
+ static const int IO_INFINITE = -1;
+
+ //! Create an empty signature with infinite IO
+ IOSignature(void)
+ {
+ this->set_min_streams(IO_INFINITE);
+ this->set_max_streams(IO_INFINITE);
+ }
+
+ //! Create a signature with the specified min and max streams
+ IOSignature(const int min_streams, const int max_streams)
+ {
+ if (min_streams > max_streams and max_streams != IO_INFINITE)
+ {
+ throw std::invalid_argument("io signature fail: min_streams > max_streams");
+ }
+ this->set_min_streams(min_streams);
+ this->set_max_streams(max_streams);
+ }
+
+ //! Construct from pointer for backwards compatible shared_ptr usage.
+ IOSignature(const IOSignature *sig)
+ {
+ *this = *sig;
+ }
+
+ //! Overloaded arrow operator for backwards compatible shared_ptr usage.
+ IOSignature* operator->(void)
+ {
+ return this;
+ };
+
+ //! Overloaded arrow operator for backwards compatible shared_ptr usage.
+ const IOSignature* operator->(void) const
+ {
+ return this;
+ };
+
+ void set_min_streams(const int val)
+ {
+ _min_streams = val;
+ }
+
+ void set_max_streams(const int val)
+ {
+ _max_streams = val;
+ }
+
+ int min_streams(void) const
+ {
+ return _min_streams;
+ }
+
+ int max_streams(void) const
+ {
+ return _max_streams;
+ }
+
+ int sizeof_stream_item(const int index) const
+ {
+ if (this->empty()) return 0;
+ if (this->size() > unsigned(index))
+ {
+ return this->at(index);
+ }
+ return this->back();
+ }
+
+ std::vector sizeof_stream_items(void) const
+ {
+ return *this;
+ }
+
+ int _min_streams;
+ int _max_streams;
+};
+
+} //namespace gras
+
+#endif /*INCLUDED_GRAS_IO_SIGNATURE_HPP*/
diff --git a/include/gras/sbuffer.hpp b/include/gras/sbuffer.hpp
new file mode 100644
index 0000000..7997e09
--- /dev/null
+++ b/include/gras/sbuffer.hpp
@@ -0,0 +1,142 @@
+//
+// 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 .
+
+#ifndef INCLUDED_GRAS_SBUFFER_HPP
+#define INCLUDED_GRAS_SBUFFER_HPP
+
+#include
+#include
+#include
+#include
+#include
+
+namespace gras
+{
+
+struct SBufferImpl;
+struct SBuffer;
+
+//! The callback function type when buffers dereference
+typedef boost::function SBufferDeleter;
+
+//! The token type held by the caller
+typedef boost::shared_ptr SBufferToken;
+
+//! The token type weak ptr help by buffer
+typedef boost::weak_ptr SBufferTokenWeak;
+
+struct GRAS_API SBufferConfig
+{
+ //! Default constructor zeros out buffer config
+ SBufferConfig(void);
+
+ //! pointer to the memory start
+ void *memory;
+
+ //! length of the memory in bytes
+ size_t length;
+
+ //! memory affinity - meta information
+ long affinity;
+
+ //! index number for custom allocation purposes
+ size_t user_index;
+
+ //! deleter callback, may be used to free
+ SBufferDeleter deleter;
+
+ //! token object, called if set under deref condition
+ SBufferTokenWeak token;
+};
+
+/*!
+ * SBuffer is a smart/shared reference counted handler of memory.
+ * Thank you boost smart/shared pointers for the disambiguation!
+ *
+ * Default allocator:
+ * To use the default system allocator, set the memory to NULL,
+ * and set length and affinity to the desired values.
+ * The deleter will be automaically configured by the allocator.
+ *
+ * Custom allocator:
+ * Set all config struct members. Its all you!
+ *
+ * Token usage:
+ * When a token is set, the buffer will not cleanup and call the deleter.
+ * Rather, the bound function in the token will be called with the buffer.
+ * A parent object should hold the shared pointer to the token.
+ * When the parent object deconstructs, the weak pointer will die,
+ * and the normal buffer cleanup/freeing/deconstruction will happen.
+ *
+ * Length and offset usage:
+ * Length and offset are intentionally object members
+ * and not part of the ref-counted intrusive_ptr guts.
+ * These members should be modified carefully
+ * to pass a subset of the memory downstream.
+ *
+ * Length and offset recommendation:
+ * These values should probably be reset by the
+ * bound token or when a fresh buffer is popped.
+ */
+struct GRAS_API SBuffer : boost::intrusive_ptr
+{
+ //! Default constructor, zeros things
+ SBuffer(void);
+
+ /*!
+ * Create a new buffer.
+ * The config object represents a chunk of memory,
+ * or instructions for the default allocator.
+ */
+ SBuffer(const SBufferConfig &config);
+
+ /*!
+ * Get a pointer to the start of the underlying memory
+ */
+ void *get_actual_memory(void) const;
+
+ /*!
+ * Get the length of the underlying memory in bytes
+ */
+ size_t get_actual_length(void) const;
+
+ //! Get a pointer into valid memory
+ void *get(const ptrdiff_t delta_bytes = 0) const;
+
+ //! The offset into valid memory in bytes
+ size_t offset;
+
+ //! The number of valid bytes past offset
+ size_t length;
+
+ //! Get the affinity of the memory
+ long get_affinity(void) const;
+
+ //! Get the user index number
+ size_t get_user_index(void) const;
+
+ //! Unique if caller holds the only reference count
+ bool unique(void) const;
+
+ //! Get the number of reference holders
+ size_t use_count(void) const;
+};
+
+} //namespace gras
+
+#include
+
+#endif /*INCLUDED_GRAS_SBUFFER_HPP*/
diff --git a/include/gras/sbuffer.ipp b/include/gras/sbuffer.ipp
new file mode 100644
index 0000000..c090123
--- /dev/null
+++ b/include/gras/sbuffer.ipp
@@ -0,0 +1,98 @@
+//
+// 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 .
+
+#ifndef INCLUDED_GRAS_SBUFFER_IPP
+#define INCLUDED_GRAS_SBUFFER_IPP
+
+#include
+
+namespace gras
+{
+
+struct SBufferImpl
+{
+ SBufferImpl(const SBufferConfig &config):
+ count(0),
+ config(config)
+ {
+ //NOP
+ }
+
+ boost::detail::atomic_count count;
+ SBufferConfig config;
+};
+
+
+extern GRAS_API void sbuffer_handle_deref(SBufferImpl *impl);
+
+GRAS_FORCE_INLINE void intrusive_ptr_add_ref(SBufferImpl *impl)
+{
+ ++impl->count;
+}
+
+GRAS_FORCE_INLINE void intrusive_ptr_release(SBufferImpl *impl)
+{
+ if (--impl->count == 0)
+ {
+ sbuffer_handle_deref(impl);
+ }
+}
+
+GRAS_FORCE_INLINE SBuffer::SBuffer(void):
+ offset(0),
+ length(0)
+{
+ //NOP
+}
+
+GRAS_FORCE_INLINE void *SBuffer::get_actual_memory(void) const
+{
+ return (*this)->config.memory;
+}
+
+GRAS_FORCE_INLINE size_t SBuffer::get_actual_length(void) const
+{
+ return (*this)->config.length;
+}
+
+GRAS_FORCE_INLINE void *SBuffer::get(const ptrdiff_t delta_bytes) const
+{
+ return ((char *)(*this)->config.memory) + this->offset + delta_bytes;
+}
+
+GRAS_FORCE_INLINE long SBuffer::get_affinity(void) const
+{
+ return (*this)->config.affinity;
+}
+
+GRAS_FORCE_INLINE size_t SBuffer::get_user_index(void) const
+{
+ return (*this)->config.user_index;
+}
+
+GRAS_FORCE_INLINE bool SBuffer::unique(void) const
+{
+ return (*this)->count == 1;
+}
+
+GRAS_FORCE_INLINE size_t SBuffer::use_count(void) const
+{
+ return (*this)->count;
+}
+
+} //namespace gras
+
+#endif /*INCLUDED_GRAS_SBUFFER_IPP*/
diff --git a/include/gras/tags.hpp b/include/gras/tags.hpp
new file mode 100644
index 0000000..9faa667
--- /dev/null
+++ b/include/gras/tags.hpp
@@ -0,0 +1,53 @@
+//
+// 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 .
+
+#ifndef INCLUDED_GRAS_TAGS_HPP
+#define INCLUDED_GRAS_TAGS_HPP
+
+#include
+#include
+#include
+#include
+
+namespace gras
+{
+
+struct GRAS_API Tag : boost::less_than_comparable
+{
+ //! Make an empty tag with null members
+ Tag(void);
+
+ //! Make a tag from parameters to initialize the members
+ Tag(const uint64_t &offset, const PMCC &key, const PMCC &value, const PMCC &srcid = PMCC());
+
+ //! the absolute item count associated with this tag
+ boost::uint64_t offset;
+
+ //! A symbolic name identifying the type of tag
+ PMCC key;
+
+ //! The value of this tag -> the sample metadata
+ PMCC value;
+
+ //! The optional source ID -> something unique
+ PMCC srcid;
+};
+
+GRAS_API bool operator<(const Tag &lhs, const Tag &rhs);
+
+} //namespace gras
+
+#endif /*INCLUDED_GRAS_TAGS_HPP*/
diff --git a/include/gras/thread_pool.hpp b/include/gras/thread_pool.hpp
new file mode 100644
index 0000000..bfda931
--- /dev/null
+++ b/include/gras/thread_pool.hpp
@@ -0,0 +1,92 @@
+//
+// 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 .
+
+#ifndef INCLUDED_GRAS_THREAD_POOL_HPP
+#define INCLUDED_GRAS_THREAD_POOL_HPP
+
+#include
+#include
+#include
+#include
+
+//! ThreadPool is an unexposed Theron Framework
+//! Forward declare the Framwork for c++ users
+namespace Theron
+{
+ class Framework;
+}
+
+namespace gras
+{
+
+struct GRAS_API ThreadPoolConfig
+{
+ ThreadPoolConfig(void);
+
+ /*!
+ * The initial number of worker threads to create within the framework.
+ * Default is the number of CPUs on the system.
+ */
+ size_t thread_count;
+
+ /*!
+ * Specifies the NUMA processor nodes upon which the framework may execute.
+ * Default is all NUMA nodes on the system.
+ */
+ size_t node_mask;
+
+ /*!
+ * Specifies the subset of the processors in each NUMA processor node upon which the framework may execute.
+ * Default is all CPUs per NUMA node.
+ */
+ size_t processor_mask;
+
+ /*!
+ * Yield strategy employed by the worker threads in the framework.
+ * POLITE, ///< Threads go to sleep when not in use.
+ * STRONG, ///< Threads yield to other threads but don't go to sleep.
+ * AGGRESSIVE ///< Threads never yield to other threads.
+ * Default is STRONG.
+ */
+ std::string yield_strategy;
+};
+
+/*!
+ * Thread Pool is is a this wrapper of Theron Framework, see link for more details:
+ * http://docs.theron-library.com/5.00/structTheron_1_1Framework_1_1Parameters.html
+ */
+struct GRAS_API ThreadPool : boost::shared_ptr
+{
+ //! Create an empty thread pool
+ ThreadPool(void);
+
+ //! Create a thread pool from a weak pointer to a framework
+ ThreadPool(boost::weak_ptr p);
+
+ //! Create a new thread pool with parameters
+ ThreadPool(const ThreadPoolConfig &config);
+
+ /*!
+ * When a block is created, it will execute in the active pool.
+ * Use this call before creating a block to control which
+ * thread pool that the block's work routine will run in.
+ */
+ void set_active(void);
+};
+
+} //namespace gras
+
+#endif /*INCLUDED_GRAS_THREAD_POOL_HPP*/
diff --git a/include/gras/top_block.hpp b/include/gras/top_block.hpp
new file mode 100644
index 0000000..8bf366f
--- /dev/null
+++ b/include/gras/top_block.hpp
@@ -0,0 +1,98 @@
+//
+// 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 .
+
+#ifndef INCLUDED_GRAS_TOP_BLOCK_HPP
+#define INCLUDED_GRAS_TOP_BLOCK_HPP
+
+#include
+
+namespace gras
+{
+
+struct GRAS_API GlobalBlockConfig
+{
+ GlobalBlockConfig(void);
+
+ /*!
+ * Constrain the maximum number of items that
+ * work can be called with for all output ports.
+ *
+ * Default = 0 aka disabled.
+ */
+ size_t maximum_output_items;
+
+ /*!
+ * Set the global memory node affinity.
+ * Blocks that have not been explicitly set,
+ * will take on this new buffer_affinity.
+ *
+ * Default = -1 aka no affinity.
+ */
+ long buffer_affinity;
+};
+
+struct GRAS_API TopBlock : HierBlock
+{
+ TopBlock(void);
+
+ TopBlock(const std::string &name);
+
+ //! Get the global block config settings
+ GlobalBlockConfig global_config(void) const;
+
+ //! Set the global block config settings
+ void set_global_config(const GlobalBlockConfig &config);
+
+ /*!
+ * Commit changes to the overall flow graph.
+ * Call this after modifying connections.
+ * Commit is called automatically by start/stop/run.
+ */
+ void commit(void);
+
+ /*!
+ * Run is for finite flow graph executions.
+ * Mostly for testing purposes only.
+ */
+ void run(void);
+
+ //! Start a flow graph execution (does not block)
+ void start(void);
+
+ //! Stop a flow graph execution (does not block)
+ void stop(void);
+
+ /*!
+ * Wait for threads to exit after stop() or run().
+ * This is a blocking call and will not return until
+ * all blocks in the topology have been marked done.
+ */
+ virtual void wait(void);
+
+ /*!
+ * Wait for threads to exit after stop() or run().
+ * This is call will block until timeout or done.
+ *
+ * \param timeout the timeout in seconds
+ * \return true of execution completed
+ */
+ virtual bool wait(const double timeout);
+
+};
+
+} //namespace gras
+
+#endif /*INCLUDED_GRAS_TOP_BLOCK_HPP*/
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index bb471f7..e67f341 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -1,28 +1,30 @@
########################################################################
-# This file included, use CMake directory variables
+# Setup the GRAS library build
########################################################################
+include_directories(${GRAS_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-set(GRAS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../)
-set(GRAS_BINARY_DIR ${CMAKE_BINARY_DIR}/gruel/src)
-set(RUNTIME_SOURCE_DIR ${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/runtime)
-
-if(CMAKE_BUILD_TYPE STREQUAL "Debug")
- add_definitions(-DGRAS_DEBUG)
-endif()
-
########################################################################
-# Setup PMC Deps
+# Setup Boost
########################################################################
-include_directories(${GRAS_SOURCE_DIR}/PMC/include)
+if(UNIX AND EXISTS "/usr/lib64")
+ list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
+endif(UNIX AND EXISTS "/usr/lib64")
-list(APPEND GNURADIO_CORE_INCLUDE_DIRS ${GRAS_SOURCE_DIR}/PMC/include)
-GR_SET_GLOBAL(GNURADIO_CORE_INCLUDE_DIRS ${GNURADIO_CORE_INCLUDE_DIRS})
-
-list(APPEND GNURADIO_CORE_SWIG_INCLUDE_DIRS ${GRAS_SOURCE_DIR}/PMC/include)
-GR_SET_GLOBAL(GNURADIO_CORE_SWIG_INCLUDE_DIRS ${GNURADIO_CORE_SWIG_INCLUDE_DIRS})
+set(Boost_ADDITIONAL_VERSIONS
+ "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
+ "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
+ "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
+ "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
+ "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
+ "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
+ "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
+)
+find_package(Boost COMPONENTS)
-add_subdirectory(${GRAS_SOURCE_DIR}/PMC ${CMAKE_BINARY_DIR}/PMC)
+include_directories(${Boost_INCLUDE_DIRS})
+link_directories(${Boost_LIBRARY_DIRS})
+list(APPEND GRAS_LIBRARIES ${Boost_LIBRARIES})
########################################################################
# Setup Theron Deps
@@ -33,8 +35,8 @@ include_directories(${THERON_INCLUDE_DIRS})
link_directories(${THERON_LIBRARY_DIRS})
add_definitions(${THERON_DEFINES})
-list(APPEND gnuradio_core_libs ${THERON_LIBRARIES})
-list(APPEND gnuradio_core_sources ${THERON_SOURCES})
+list(APPEND GRAS_LIBRARIES ${THERON_LIBRARIES})
+list(APPEND GRAS_SOURCES ${THERON_SOURCES})
########################################################################
# Setup Apology Deps
@@ -43,12 +45,12 @@ include_directories(${GRAS_SOURCE_DIR}/Apology/include)
include_directories(${GRAS_SOURCE_DIR}/Apology/lib)
file(GLOB apology_sources "${GRAS_SOURCE_DIR}/Apology/lib/*.cpp")
-list(APPEND gnuradio_core_sources ${apology_sources})
+list(APPEND GRAS_SOURCES ${apology_sources})
########################################################################
-# Append gnuradio-core library sources
+# Append gras-core library sources
########################################################################
-list(APPEND gnuradio_core_sources
+list(APPEND GRAS_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/debug.cpp
${CMAKE_CURRENT_SOURCE_DIR}/element.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sbuffer.cpp
@@ -64,113 +66,15 @@ list(APPEND gnuradio_core_sources
${CMAKE_CURRENT_SOURCE_DIR}/output_handlers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hier_block.cpp
${CMAKE_CURRENT_SOURCE_DIR}/top_block.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/gr_block.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_block.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block.cpp
${CMAKE_CURRENT_SOURCE_DIR}/register_messages.cpp
)
-#sources that are in tree that have not changed
-list(APPEND gnuradio_core_sources
- ${RUNTIME_SOURCE_DIR}/gr_sys_paths.cc
- ${RUNTIME_SOURCE_DIR}/gr_message.cc
- ${RUNTIME_SOURCE_DIR}/gr_msg_queue.cc
- ${RUNTIME_SOURCE_DIR}/gr_msg_handler.cc
-)
-
-########################################################################
-# Append gnuradio-core test sources
-########################################################################
-list(APPEND test_gnuradio_core_sources
- ${RUNTIME_SOURCE_DIR}/qa_gr_block.cc
- ${RUNTIME_SOURCE_DIR}/qa_gr_hier_block2.cc
- ${RUNTIME_SOURCE_DIR}/qa_gr_hier_block2_derived.cc
- #${RUNTIME_SOURCE_DIR}/qa_gr_buffer.cc
- #${RUNTIME_SOURCE_DIR}/qa_gr_flowgraph.cc
- ${RUNTIME_SOURCE_DIR}/qa_gr_top_block.cc
- ${RUNTIME_SOURCE_DIR}/qa_gr_io_signature.cc
- #${RUNTIME_SOURCE_DIR}/qa_gr_vmcircbuf.cc
- ${RUNTIME_SOURCE_DIR}/qa_block_tags.cc
- ${GRAS_SOURCE_DIR}/lib/qa_runtime.cc
- #${RUNTIME_SOURCE_DIR}/qa_set_msg_handler.cc
-)
-
-#copy test headers to include dir
-set(test_headers
- ${RUNTIME_SOURCE_DIR}/qa_gr_block.h
- ${RUNTIME_SOURCE_DIR}/qa_gr_hier_block2.h
- ${RUNTIME_SOURCE_DIR}/qa_gr_hier_block2_derived.h
- #${RUNTIME_SOURCE_DIR}/qa_gr_buffer.h
- #${RUNTIME_SOURCE_DIR}/qa_gr_flowgraph.h
- ${RUNTIME_SOURCE_DIR}/qa_gr_top_block.h
- ${RUNTIME_SOURCE_DIR}/qa_gr_io_signature.h
- #${RUNTIME_SOURCE_DIR}/qa_gr_vmcircbuf.h
- ${RUNTIME_SOURCE_DIR}/qa_block_tags.h
- ${RUNTIME_SOURCE_DIR}/qa_runtime.h
- #${RUNTIME_SOURCE_DIR}/qa_set_msg_handler.h
- ${RUNTIME_SOURCE_DIR}/gr_unittests.h
-)
-foreach(header ${test_headers})
- execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${header} ${GRAS_BINARY_DIR}/include)
-endforeach(header)
-
-########################################################################
-# Install runtime headers
-########################################################################
-set(runtime_copy_headers
- ${RUNTIME_SOURCE_DIR}/gr_sys_paths.h
- ${RUNTIME_SOURCE_DIR}/gr_message.h
- ${RUNTIME_SOURCE_DIR}/gr_msg_queue.h
- ${RUNTIME_SOURCE_DIR}/gr_msg_handler.h
- ${RUNTIME_SOURCE_DIR}/gr_complex.h
-)
-
-#copy the headers to a place that is in the include path
-foreach(runtime_copy_header ${runtime_copy_headers})
- execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${runtime_copy_header} ${GRAS_BINARY_DIR}/include)
-endforeach(runtime_copy_header)
-
-file(GLOB runtime_headers "${GRAS_SOURCE_DIR}/include/gnuradio/*")
-install(FILES
- ${runtime_headers} ${runtime_copy_headers}
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio
- COMPONENT "core_devel"
-)
-
########################################################################
-# Install swig headers
+# Build library
########################################################################
-if(ENABLE_PYTHON)
-
-set(runtime_copy_swigs
- ${RUNTIME_SOURCE_DIR}/gr_message.i
- ${RUNTIME_SOURCE_DIR}/gr_msg_queue.i
- ${RUNTIME_SOURCE_DIR}/gr_msg_handler.i
-)
-
-#makes swig doc generator happy
-execute_process(
- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/runtime/
- COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/nop.h
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/nop.h
- ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/runtime/nop.h
-)
-
-#copy the headers to a place that is in the include path
-foreach(runtime_copy_header ${runtime_copy_swigs})
- execute_process(
- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig/
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${runtime_copy_header} ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig/
- )
-endforeach(runtime_copy_header)
-
-file(GLOB runtime_swigs "${GRAS_SOURCE_DIR}/swig/*.i")
-install(FILES
- ${runtime_swigs} ${runtime_copy_swigs}
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
- COMPONENT "core_swig"
-)
+include(GrMiscUtils)
-endif(ENABLE_PYTHON)
+add_library(gras SHARED ${GRAS_SOURCES})
+target_link_libraries(gras ${GRAS_LIBRARIES})
+set(GR_LIBRARY_DIR lib)
+GR_LIBRARY_FOO(gras RUNTIME_COMPONENT ${GRAS_COMP_RUNTIME} DEVEL_COMPONENT ${GRAS_COMP_DEVEL})
diff --git a/lib/block.cpp b/lib/block.cpp
index 95d27fa..0d50ef7 100644
--- a/lib/block.cpp
+++ b/lib/block.cpp
@@ -15,9 +15,9 @@
// along with this program. If not, see .
#include "element_impl.hpp"
-#include
+#include
-using namespace gnuradio;
+using namespace gras;
InputPortConfig::InputPortConfig(void)
{
@@ -136,7 +136,7 @@ bool Block::fixed_rate(void) const
void Block::set_output_multiple(const size_t multiple)
{
(*this)->block->output_multiple_items = multiple;
- gnuradio::OutputPortConfig config = this->output_config();
+ gras::OutputPortConfig config = this->output_config();
config.reserve_items = multiple;
this->set_output_config(config);
}
diff --git a/lib/block_actor.cpp b/lib/block_actor.cpp
index 108e7d3..0576588 100644
--- a/lib/block_actor.cpp
+++ b/lib/block_actor.cpp
@@ -14,12 +14,12 @@
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see .
-#include
+#include
#include
#include
#include
-using namespace gnuradio;
+using namespace gras;
ThreadPoolConfig::ThreadPoolConfig(void)
{
diff --git a/lib/block_allocator.cpp b/lib/block_allocator.cpp
index 05b35ac..8a94141 100644
--- a/lib/block_allocator.cpp
+++ b/lib/block_allocator.cpp
@@ -19,7 +19,7 @@
#include
#include
-using namespace gnuradio;
+using namespace gras;
const size_t AT_LEAST_DEFAULT_ITEMS = 1 << 13;
const size_t AHH_TOO_MANY_BYTES = 1 << 20; //TODO
diff --git a/lib/block_handlers.cpp b/lib/block_handlers.cpp
index ca42b45..6140d40 100644
--- a/lib/block_handlers.cpp
+++ b/lib/block_handlers.cpp
@@ -18,7 +18,7 @@
#include
#include
-using namespace gnuradio;
+using namespace gras;
void BlockActor::handle_top_active(
diff --git a/lib/block_task.cpp b/lib/block_task.cpp
index a291c01..be97af2 100644
--- a/lib/block_task.cpp
+++ b/lib/block_task.cpp
@@ -19,7 +19,7 @@
#define REALLY_BIG size_t(1 << 30)
-using namespace gnuradio;
+using namespace gras;
void BlockActor::mark_done(void)
{
diff --git a/lib/element.cpp b/lib/element.cpp
index 39cbca3..6d116e9 100644
--- a/lib/element.cpp
+++ b/lib/element.cpp
@@ -15,13 +15,13 @@
// along with this program. If not, see .
#include "element_impl.hpp"
-#include
+#include
#include
#include
static boost::detail::atomic_count unique_id_pool(0);
-using namespace gnuradio;
+using namespace gras;
Element::Element(void)
{
diff --git a/lib/element_impl.hpp b/lib/element_impl.hpp
index d058e63..e079d8e 100644
--- a/lib/element_impl.hpp
+++ b/lib/element_impl.hpp
@@ -20,12 +20,12 @@
#include
#include
#include
-#include
-#include
+#include
+#include
#include
#include
-namespace gnuradio
+namespace gras
{
struct ElementImpl
@@ -61,6 +61,6 @@ struct ElementImpl
};
-} //namespace gnuradio
+} //namespace gras
#endif /*INCLUDED_LIBGRAS_ELEMENT_IMPL_HPP*/
diff --git a/lib/gr_block.cpp b/lib/gr_block.cpp
deleted file mode 100644
index f8ce6f4..0000000
--- a/lib/gr_block.cpp
+++ /dev/null
@@ -1,213 +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 .
-
-#include "element_impl.hpp"
-#include "pmx_helper.hpp"
-#include
-#include
-
-gr_block::gr_block(void)
-{
- //NOP
-}
-
-gr_block::gr_block(
- const std::string &name,
- gr_io_signature_sptr input_signature,
- gr_io_signature_sptr output_signature
-):
- gnuradio::Block(name)
-{
- this->set_fixed_rate(false);
- this->set_input_signature(input_signature);
- this->set_output_signature(output_signature);
-}
-
-int gr_block::work(
- const InputItems &input_items,
- const OutputItems &output_items
-){
- return this->general_work(
- (*this)->block->work_noutput_items,
- (*this)->block->work_ninput_items,
- (*this)->block->work_input_items,
- (*this)->block->work_output_items
- );
-}
-
-void gr_block::forecast(int noutput_items, std::vector &ninputs_req)
-{
- for (size_t i = 0; i < ninputs_req.size(); i++)
- {
- ninputs_req[i] = fixed_rate_noutput_to_ninput(noutput_items);
- }
-}
-
-int gr_block::general_work(
- int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items
-){
- throw std::runtime_error("gr_block subclasses must overload general_work!");
-}
-
-void gr_block::set_alignment(const size_t)
-{
- //TODO
- //probably dont need this since buffers always start aligned
- //and therefore alignment is always re-acheived
-}
-
-bool gr_block::is_unaligned(void)
-{
- //TODO
- //probably dont need this since volk dispatcher checks alignment
- //32 byte aligned is good enough for you
- return ((*this)->block->work_io_ptr_mask & ptrdiff_t(GRAS_MAX_ALIGNMENT-1)) != 0;
-}
-
-size_t gr_block::fixed_rate_noutput_to_ninput(const size_t noutput_items)
-{
- if (this->fixed_rate())
- {
- return size_t(0.5 + (noutput_items/this->relative_rate())) + this->history() - 1;
- }
- else
- {
- return noutput_items + this->history() - 1;
- }
-}
-
-size_t gr_block::interpolation(void) const
-{
- return size_t(1.0*this->relative_rate());
-}
-
-void gr_block::set_interpolation(const size_t interp)
-{
- this->set_relative_rate(1.0*interp);
- this->set_output_multiple(interp);
-}
-
-size_t gr_block::decimation(void) const
-{
- return size_t(1.0/this->relative_rate());
-}
-
-void gr_block::set_decimation(const size_t decim)
-{
- this->set_relative_rate(1.0/decim);
-}
-
-unsigned gr_block::history(void) const
-{
- //implement off-by-one history compat
- return this->input_config().lookahead_items+1;
-}
-
-void gr_block::set_history(unsigned history)
-{
- gnuradio::InputPortConfig config = this->input_config();
- //implement off-by-one history compat
- if (history == 0) history++;
- config.lookahead_items = history-1;
- this->set_input_config(config);
-}
-
-int gr_block::max_noutput_items(void) const
-{
- return this->output_config().maximum_items;
-}
-
-void gr_block::set_max_noutput_items(int max_items)
-{
- gnuradio::OutputPortConfig config = this->output_config();
- config.maximum_items = max_items;
- this->set_output_config(config);
-}
-
-void gr_block::unset_max_noutput_items(void)
-{
- this->set_max_noutput_items(0);
-}
-
-bool gr_block::is_set_max_noutput_items(void) const
-{
- return this->max_noutput_items() != 0;
-}
-
-//TODO Tag2gr_tag and gr_tag2Tag need PMC to/from PMT logic
-//currently PMC holds the pmt_t, this is temporary
-static gr_tag_t Tag2gr_tag(const gnuradio::Tag &tag)
-{
- gr_tag_t t;
- t.offset = tag.offset;
- t.key = pmt::pmc_to_pmt(tag.key);
- t.value = pmt::pmc_to_pmt(tag.value);
- t.srcid = pmt::pmc_to_pmt(tag.srcid);
- return t;
-}
-
-static gnuradio::Tag gr_tag2Tag(const gr_tag_t &tag)
-{
- return gnuradio::Tag
- (
- tag.offset,
- pmt::pmt_to_pmc(tag.key),
- pmt::pmt_to_pmc(tag.value),
- pmt::pmt_to_pmc(tag.srcid)
- );
-}
-
-void gr_block::add_item_tag(
- const size_t which_output, const gr_tag_t &tag
-){
- this->post_output_tag(which_output, gr_tag2Tag(tag));
-}
-
-void gr_block::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
-){
- gr_tag_t t;
- t.offset = abs_offset;
- t.key = key;
- t.value = value;
- t.srcid = srcid;
- this->add_item_tag(which_output, t);
-}
-
-void gr_block::get_tags_in_range(
- std::vector &tags,
- const size_t which_input,
- uint64_t abs_start,
- uint64_t abs_end,
- const pmt::pmt_t &key
-){
- tags.clear();
- BOOST_FOREACH(const gnuradio::Tag &tag, this->get_input_tags(which_input))
- {
- if (tag.offset >= abs_start and tag.offset <= abs_end)
- {
- gr_tag_t t = Tag2gr_tag(tag);
- if (key or pmt::pmt_equal(t.key, key)) tags.push_back(t);
- }
- }
-}
diff --git a/lib/gr_hier_block2.cpp b/lib/gr_hier_block2.cpp
deleted file mode 100644
index b40755a..0000000
--- a/lib/gr_hier_block2.cpp
+++ /dev/null
@@ -1,41 +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 .
-
-#include
-
-gr_hier_block2::gr_hier_block2(void)
-{
- //NOP
-}
-
-gr_hier_block2::gr_hier_block2(
- const std::string &name,
- gr_io_signature_sptr input_signature,
- gr_io_signature_sptr output_signature
-):
- gnuradio::HierBlock(name)
-{
- this->set_input_signature(input_signature);
- this->set_output_signature(output_signature);
-}
-
-gr_hier_block2_sptr gr_make_hier_block2(
- const std::string &name,
- gr_io_signature_sptr input_signature,
- gr_io_signature_sptr output_signature
-){
- return gr_hier_block2_sptr(new gr_hier_block2(name, input_signature, output_signature));
-}
diff --git a/lib/gr_sync_block.cpp b/lib/gr_sync_block.cpp
deleted file mode 100644
index e883861..0000000
--- a/lib/gr_sync_block.cpp
+++ /dev/null
@@ -1,75 +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 .
-
-#include "element_impl.hpp"
-#include
-#include
-#include
-
-gr_sync_block::gr_sync_block(void)
-{
- //NOP
-}
-
-gr_sync_block::gr_sync_block(
- const std::string &name,
- gr_io_signature_sptr input_signature,
- gr_io_signature_sptr output_signature
-):
- gr_block(name, input_signature, output_signature)
-{
- this->set_fixed_rate(true);
-}
-
-int gr_sync_block::work(
- int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items
-){
- throw std::runtime_error("gr_block subclasses must overload general_work!");
-}
-
-gr_sync_interpolator::gr_sync_interpolator(void)
-{
- //NOP
-}
-
-gr_sync_interpolator::gr_sync_interpolator(
- const std::string &name,
- gr_io_signature_sptr input_signature,
- gr_io_signature_sptr output_signature,
- const size_t interp_rate
-):
- gr_sync_block(name, input_signature, output_signature)
-{
- this->set_interpolation(interp_rate);
-}
-
-gr_sync_decimator::gr_sync_decimator(void)
-{
- //NOP
-}
-
-gr_sync_decimator::gr_sync_decimator(
- const std::string &name,
- gr_io_signature_sptr input_signature,
- gr_io_signature_sptr output_signature,
- const size_t decim_rate
-):
- gr_sync_block(name, input_signature, output_signature)
-{
- this->set_decimation(decim_rate);
-}
diff --git a/lib/gr_top_block.cpp b/lib/gr_top_block.cpp
deleted file mode 100644
index c51f9b3..0000000
--- a/lib/gr_top_block.cpp
+++ /dev/null
@@ -1,69 +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 .
-
-#include
-
-gr_top_block::gr_top_block(void):
- //cannot make a null top block, use name constructor
- gnuradio::TopBlock("top")
-{
- //NOP
-}
-
-gr_top_block::gr_top_block(const std::string &name):
- gnuradio::TopBlock(name)
-{
- //NOP
-}
-
-gr_top_block_sptr gr_make_top_block(const std::string &name)
-{
- return gr_top_block_sptr(new gr_top_block(name));
-}
-
-void gr_top_block::start(void)
-{
- gnuradio::TopBlock::start();
-}
-
-void gr_top_block::start(const size_t max_items)
-{
- this->set_max_noutput_items(max_items);
- gnuradio::TopBlock::start();
-}
-
-void gr_top_block::run(void)
-{
- gnuradio::TopBlock::run();
-}
-
-void gr_top_block::run(const size_t max_items)
-{
- this->set_max_noutput_items(max_items);
- gnuradio::TopBlock::run();
-}
-
-int gr_top_block::max_noutput_items(void) const
-{
- return this->global_config().maximum_output_items;
-}
-
-void gr_top_block::set_max_noutput_items(int max_items)
-{
- gnuradio::GlobalBlockConfig config = this->global_config();
- config.maximum_output_items = max_items;
- this->set_global_config(config);
-}
diff --git a/lib/gras_impl/bitset.hpp b/lib/gras_impl/bitset.hpp
index 5ea2acb..7a2184f 100644
--- a/lib/gras_impl/bitset.hpp
+++ b/lib/gras_impl/bitset.hpp
@@ -17,10 +17,10 @@
#ifndef INCLUDED_LIBGRAS_IMPL_BITSET_HPP
#define INCLUDED_LIBGRAS_IMPL_BITSET_HPP
-#include
+#include
#include
-namespace gnuradio
+namespace gras
{
//! Its just dynamic bitset w/ the handle all() routine
@@ -32,6 +32,6 @@ struct BitSet : boost::dynamic_bitset<>
}
};
-} //namespace gnuradio
+} //namespace gras
#endif /*INCLUDED_LIBGRAS_IMPL_BITSET_HPP*/
diff --git a/lib/gras_impl/block_actor.hpp b/lib/gras_impl/block_actor.hpp
index d32c105..4ef71e8 100644
--- a/lib/gras_impl/block_actor.hpp
+++ b/lib/gras_impl/block_actor.hpp
@@ -19,10 +19,10 @@
#include
#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
#include
#include
#include
@@ -32,7 +32,7 @@
#include
#include
-namespace gnuradio
+namespace gras
{
static GRAS_FORCE_INLINE unsigned long myulround(const double x)
@@ -201,6 +201,6 @@ struct BlockActor : Apology::Worker
bool topology_init;
};
-} //namespace gnuradio
+} //namespace gras
#endif /*INCLUDED_LIBGRAS_IMPL_BLOCK_ACTOR_HPP*/
diff --git a/lib/gras_impl/buffer_queue.hpp b/lib/gras_impl/buffer_queue.hpp
index bde4986..5a9c28c 100644
--- a/lib/gras_impl/buffer_queue.hpp
+++ b/lib/gras_impl/buffer_queue.hpp
@@ -17,11 +17,11 @@
#ifndef INCLUDED_LIBGRAS_IMPL_BUFFER_QUEUE_HPP
#define INCLUDED_LIBGRAS_IMPL_BUFFER_QUEUE_HPP
-#include
+#include
#include
#include
-namespace gnuradio
+namespace gras
{
struct BufferQueue : std::queue
@@ -54,6 +54,6 @@ struct BufferQueue : std::queue
SBufferToken _token;
};
-} //namespace gnuradio
+} //namespace gras
#endif /*INCLUDED_LIBGRAS_IMPL_BUFFER_QUEUE_HPP*/
diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp
index d17c4f0..92bfb02 100644
--- a/lib/gras_impl/input_buffer_queues.hpp
+++ b/lib/gras_impl/input_buffer_queues.hpp
@@ -20,14 +20,14 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
#include //memcpy/memset
#include
-namespace gnuradio
+namespace gras
{
struct InputBufferQueues
@@ -217,6 +217,6 @@ GRAS_FORCE_INLINE void InputBufferQueues::consume(const size_t i, const size_t b
__update(i);
}
-} //namespace gnuradio
+} //namespace gras
#endif /*INCLUDED_LIBGRAS_IMPL_INPUT_BUFFERS_HPP*/
diff --git a/lib/gras_impl/interruptible_thread.hpp b/lib/gras_impl/interruptible_thread.hpp
index 1cb9b64..5af9369 100644
--- a/lib/gras_impl/interruptible_thread.hpp
+++ b/lib/gras_impl/interruptible_thread.hpp
@@ -32,7 +32,7 @@
/*!
* This is the only place you will find any threading stuff.
- * The entire point here is that the source's in gnuradio
+ * The entire point here is that the source's in gras
* are sometimed bad and block forever (the author is guilty too).
* This thread pool creates an interruptible thread to perform work.
* Everything is nice and synchronous with the block actor.
@@ -40,7 +40,7 @@
* However, this will be interrupted and not block forever,
* when the executor is told to stop/interrupt and wait/join.
*/
-namespace gnuradio
+namespace gras
{
typedef boost::shared_ptr SharedThreadGroup;
@@ -138,6 +138,6 @@ namespace gnuradio
boost::thread *_thread;
};
-} //namespace gnuradio
+} //namespace gras
#endif /*INCLUDED_LIBGRAS_IMPL_INTERRUPTIBLE_THREAD_HPP*/
diff --git a/lib/gras_impl/messages.hpp b/lib/gras_impl/messages.hpp
index 68c3392..d09a71c 100644
--- a/lib/gras_impl/messages.hpp
+++ b/lib/gras_impl/messages.hpp
@@ -17,12 +17,12 @@
#ifndef INCLUDED_LIBGRAS_IMPL_MESSAGES_HPP
#define INCLUDED_LIBGRAS_IMPL_MESSAGES_HPP
-#include
-#include
-#include
+#include
+#include
+#include
#include
-namespace gnuradio
+namespace gras
{
//----------------------------------------------------------------------
@@ -137,33 +137,33 @@ struct UpdateInputsMessage
//empty
};
-} //namespace gnuradio
+} //namespace gras
#include
-#include
+#include
#include
#include
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::TopAllocMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::TopActiveMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::TopInertMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::TopTokenMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::GlobalBlockConfig);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::SharedThreadGroup);
-
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::InputTagMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::InputBufferMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::InputTokenMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::InputCheckMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::InputAllocMessage);
-
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::OutputBufferMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::OutputTokenMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::OutputCheckMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::OutputHintMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::OutputAllocMessage);
-
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::SelfKickMessage);
-THERON_DECLARE_REGISTERED_MESSAGE(gnuradio::UpdateInputsMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::TopAllocMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::TopActiveMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::TopInertMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::TopTokenMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::GlobalBlockConfig);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::SharedThreadGroup);
+
+THERON_DECLARE_REGISTERED_MESSAGE(gras::InputTagMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::InputBufferMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::InputTokenMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::InputCheckMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::InputAllocMessage);
+
+THERON_DECLARE_REGISTERED_MESSAGE(gras::OutputBufferMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::OutputTokenMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::OutputCheckMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::OutputHintMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::OutputAllocMessage);
+
+THERON_DECLARE_REGISTERED_MESSAGE(gras::SelfKickMessage);
+THERON_DECLARE_REGISTERED_MESSAGE(gras::UpdateInputsMessage);
#endif /*INCLUDED_LIBGRAS_IMPL_MESSAGES_HPP*/
diff --git a/lib/gras_impl/output_buffer_queues.hpp b/lib/gras_impl/output_buffer_queues.hpp
index 1f07af0..d876aa7 100644
--- a/lib/gras_impl/output_buffer_queues.hpp
+++ b/lib/gras_impl/output_buffer_queues.hpp
@@ -21,7 +21,7 @@
#include
#include
-namespace gnuradio
+namespace gras
{
template
@@ -100,6 +100,6 @@ struct OutputBufferQueues
}
};
-} //namespace gnuradio
+} //namespace gras
#endif /*INCLUDED_LIBGRAS_IMPL_OUTPUT_BUFFER_QUEUES_HPP*/
diff --git a/lib/gras_impl/token.hpp b/lib/gras_impl/token.hpp
index db5f047..5cc634f 100644
--- a/lib/gras_impl/token.hpp
+++ b/lib/gras_impl/token.hpp
@@ -20,7 +20,7 @@
#include
#include
-namespace gnuradio
+namespace gras
{
typedef boost::weak_ptr WeakToken;
@@ -35,6 +35,6 @@ struct Token : boost::shared_ptr
}
};
-} //namespace gnuradio
+} //namespace gras
#endif /*INCLUDED_LIBGRAS_IMPL_TOKEN_HPP*/
diff --git a/lib/hier_block.cpp b/lib/hier_block.cpp
index 422ed77..6c95e9b 100644
--- a/lib/hier_block.cpp
+++ b/lib/hier_block.cpp
@@ -15,9 +15,9 @@
// along with this program. If not, see .
#include "element_impl.hpp"
-#include
+#include
-using namespace gnuradio;
+using namespace gras;
HierBlock::HierBlock(void)
{
diff --git a/lib/input_handlers.cpp b/lib/input_handlers.cpp
index 30bb613..d9adfa5 100644
--- a/lib/input_handlers.cpp
+++ b/lib/input_handlers.cpp
@@ -17,7 +17,7 @@
#include
#include
-using namespace gnuradio;
+using namespace gras;
void BlockActor::handle_input_tag(const InputTagMessage &message, const Theron::Address)
{
diff --git a/lib/output_handlers.cpp b/lib/output_handlers.cpp
index c3d8392..7256a75 100644
--- a/lib/output_handlers.cpp
+++ b/lib/output_handlers.cpp
@@ -17,7 +17,7 @@
#include
#include
-using namespace gnuradio;
+using namespace gras;
void BlockActor::handle_output_buffer(const OutputBufferMessage &message, const Theron::Address)
diff --git a/lib/pmx_helper.hpp b/lib/pmx_helper.hpp
deleted file mode 100644
index b44345c..0000000
--- a/lib/pmx_helper.hpp
+++ /dev/null
@@ -1,263 +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 .
-
-#ifndef INCLUDED_LIBGRAS_PMX_HELPER_HPP
-#define INCLUDED_LIBGRAS_PMX_HELPER_HPP
-
-#include
-#include
-#include
-#include
-
-namespace pmt
-{
-
-inline pmt_t pmc_to_pmt(const PMCC &p)
-{
- //the container is null
- if (not p) return pmt::pmt_t();
-
- #define decl_pmc_to_pmt(type, conv) if (p.is()) return conv(p.as())
-
- //bool
- decl_pmc_to_pmt(bool, pmt_from_bool);
-
- //string
- decl_pmc_to_pmt(std::string, pmt_string_to_symbol);
-
- //numeric types
- decl_pmc_to_pmt(int8_t, pmt_from_long);
- decl_pmc_to_pmt(int16_t, pmt_from_long);
- decl_pmc_to_pmt(int32_t, pmt_from_long);
- decl_pmc_to_pmt(uint8_t, pmt_from_long);
- decl_pmc_to_pmt(uint16_t, pmt_from_long);
- decl_pmc_to_pmt(uint32_t, pmt_from_long);
- decl_pmc_to_pmt(int64_t, pmt_from_uint64);
- decl_pmc_to_pmt(uint64_t, pmt_from_uint64);
- decl_pmc_to_pmt(float, pmt_from_double);
- decl_pmc_to_pmt(double, pmt_from_double);
- #define pmt_from_complex(x) pmt_make_rectangular((x).real(), (x).imag())
- decl_pmc_to_pmt(std::complex, pmt_from_complex);
- decl_pmc_to_pmt(std::complex, pmt_from_complex);
-
- //pair container
- if (p.is())
- {
- const PMCPair &pr = p.as();
- return pmt_cons(pmc_to_pmt(pr.first), pmc_to_pmt(pr.second));
- }
-
- //fucking tuples
-/*
-for i in range(11):
- args = list()
- for j in range(i):
- args.append('pmc_to_pmt(p.as >()[%d])'%(i, j))
- print ' if (p.is >())'%i
- print ' return pmt_make_tuple(%s);'%(', '.join(args),)
-*/
- if (p.is >())
- return pmt_make_tuple();
- if (p.is >())
- return pmt_make_tuple(pmc_to_pmt(p.as >()[0]));
- if (p.is >())
- return pmt_make_tuple(pmc_to_pmt(p.as >()[0]), pmc_to_pmt(p.as >()[1]));
- if (p.is >())
- return pmt_make_tuple(pmc_to_pmt(p.as