diff options
Diffstat (limited to 'lib')
31 files changed, 128 insertions, 885 deletions
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 <http://www.gnu.org/licenses/>. #include "element_impl.hpp" -#include <gnuradio/block.hpp> +#include <gras/block.hpp> -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 <http://www.gnu.org/licenses/>. -#include <gnuradio/thread_pool.hpp> +#include <gras/thread_pool.hpp> #include <gras_impl/block_actor.hpp> #include <boost/thread/thread.hpp> #include <Theron/Framework.h> -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 <boost/bind.hpp> #include <boost/foreach.hpp> -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 <boost/make_shared.hpp> #include <boost/bind.hpp> -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 <http://www.gnu.org/licenses/>. #include "element_impl.hpp" -#include <gnuradio/element.hpp> +#include <gras/element.hpp> #include <boost/format.hpp> #include <boost/detail/atomic_count.hpp> 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 <gras_impl/block_actor.hpp> #include <Apology/Topology.hpp> #include <Apology/Executor.hpp> -#include <gnuradio/element.hpp> -#include <gnuradio/block.hpp> +#include <gras/element.hpp> +#include <gras/block.hpp> #include <gras_impl/token.hpp> #include <gras_impl/interruptible_thread.hpp> -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 <http://www.gnu.org/licenses/>. - -#include "element_impl.hpp" -#include "pmx_helper.hpp" -#include <gr_block.h> -#include <boost/foreach.hpp> - -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<int> &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<gr_tag_t> &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 <http://www.gnu.org/licenses/>. - -#include <gr_hier_block2.h> - -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 <http://www.gnu.org/licenses/>. - -#include "element_impl.hpp" -#include <gr_sync_block.h> -#include <gr_sync_interpolator.h> -#include <gr_sync_decimator.h> - -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 <http://www.gnu.org/licenses/>. - -#include <gr_top_block.h> - -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 <gnuradio/gras.hpp> +#include <gras/gras.hpp> #include <boost/dynamic_bitset.hpp> -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 <gras_impl/debug.hpp> #include <gras_impl/bitset.hpp> -#include <gnuradio/gras.hpp> -#include <gnuradio/block.hpp> -#include <gnuradio/top_block.hpp> -#include <gnuradio/thread_pool.hpp> +#include <gras/gras.hpp> +#include <gras/block.hpp> +#include <gras/top_block.hpp> +#include <gras/thread_pool.hpp> #include <Apology/Worker.hpp> #include <gras_impl/token.hpp> #include <gras_impl/messages.hpp> @@ -32,7 +32,7 @@ #include <vector> #include <set> -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 <gnuradio/sbuffer.hpp> +#include <gras/sbuffer.hpp> #include <boost/bind.hpp> #include <queue> -namespace gnuradio +namespace gras { struct BufferQueue : std::queue<SBuffer> @@ -54,6 +54,6 @@ struct BufferQueue : std::queue<SBuffer> 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 <gras_impl/debug.hpp> #include <gras_impl/bitset.hpp> #include <gras_impl/buffer_queue.hpp> -#include <gnuradio/sbuffer.hpp> +#include <gras/sbuffer.hpp> #include <vector> #include <queue> #include <deque> #include <cstring> //memcpy/memset #include <boost/circular_buffer.hpp> -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<boost::thread_group> 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 <gnuradio/sbuffer.hpp> -#include <gnuradio/tags.hpp> -#include <gnuradio/sbuffer.hpp> +#include <gras/sbuffer.hpp> +#include <gras/tags.hpp> +#include <gras/sbuffer.hpp> #include <gras_impl/token.hpp> -namespace gnuradio +namespace gras { //---------------------------------------------------------------------- @@ -137,33 +137,33 @@ struct UpdateInputsMessage //empty }; -} //namespace gnuradio +} //namespace gras #include <Theron/Register.h> -#include <gnuradio/top_block.hpp> +#include <gras/top_block.hpp> #include <gras_impl/messages.hpp> #include <gras_impl/interruptible_thread.hpp> -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 <vector> #include <boost/circular_buffer.hpp> -namespace gnuradio +namespace gras { template <typename T> @@ -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 <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> -namespace gnuradio +namespace gras { typedef boost::weak_ptr<int> WeakToken; @@ -35,6 +35,6 @@ struct Token : boost::shared_ptr<int> } }; -} //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 <http://www.gnu.org/licenses/>. #include "element_impl.hpp" -#include <gnuradio/hier_block.hpp> +#include <gras/hier_block.hpp> -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 <gras_impl/block_actor.hpp> #include <boost/foreach.hpp> -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 <gras_impl/block_actor.hpp> #include <boost/foreach.hpp> -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 <http://www.gnu.org/licenses/>. - -#ifndef INCLUDED_LIBGRAS_PMX_HELPER_HPP -#define INCLUDED_LIBGRAS_PMX_HELPER_HPP - -#include <PMC/PMC.hpp> -#include <PMC/Containers.hpp> -#include <gruel/pmt.h> -#include <boost/foreach.hpp> - -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<type >()) return conv(p.as<type >()) - - //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<float>, pmt_from_complex); - decl_pmc_to_pmt(std::complex<double>, pmt_from_complex); - - //pair container - if (p.is<PMCPair>()) - { - const PMCPair &pr = p.as<PMCPair>(); - 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<PMCTuple<%d> >()[%d])'%(i, j)) - print ' if (p.is<PMCTuple<%d> >())'%i - print ' return pmt_make_tuple(%s);'%(', '.join(args),) -*/ - if (p.is<PMCTuple<0> >()) - return pmt_make_tuple(); - if (p.is<PMCTuple<1> >()) - return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<1> >()[0])); - if (p.is<PMCTuple<2> >()) - return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<2> >()[0]), pmc_to_pmt(p.as<PMCTuple<2> >()[1])); - if (p.is<PMCTuple<3> >()) - return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<3> >()[0]), pmc_to_pmt(p.as<PMCTuple<3> >()[1]), pmc_to_pmt(p.as<PMCTuple<3> >()[2])); - if (p.is<PMCTuple<4> >()) - return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<4> >()[0]), pmc_to_pmt(p.as<PMCTuple<4> >()[1]), pmc_to_pmt(p.as<PMCTuple<4> >()[2]), pmc_to_pmt(p.as<PMCTuple<4> >()[3])); - if (p.is<PMCTuple<5> >()) - return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<5> >()[0]), pmc_to_pmt(p.as<PMCTuple<5> >()[1]), pmc_to_pmt(p.as<PMCTuple<5> >()[2]), pmc_to_pmt(p.as<PMCTuple<5> >()[3]), pmc_to_pmt(p.as<PMCTuple<5> >()[4])); - if (p.is<PMCTuple<6> >()) - return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<6> >()[0]), pmc_to_pmt(p.as<PMCTuple<6> >()[1]), pmc_to_pmt(p.as<PMCTuple<6> >()[2]), pmc_to_pmt(p.as<PMCTuple<6> >()[3]), pmc_to_pmt(p.as<PMCTuple<6> >()[4]), pmc_to_pmt(p.as<PMCTuple<6> >()[5])); - if (p.is<PMCTuple<7> >()) - return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<7> >()[0]), pmc_to_pmt(p.as<PMCTuple<7> >()[1]), pmc_to_pmt(p.as<PMCTuple<7> >()[2]), pmc_to_pmt(p.as<PMCTuple<7> >()[3]), pmc_to_pmt(p.as<PMCTuple<7> >()[4]), pmc_to_pmt(p.as<PMCTuple<7> >()[5]), pmc_to_pmt(p.as<PMCTuple<7> >()[6])); - if (p.is<PMCTuple<8> >()) - return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<8> >()[0]), pmc_to_pmt(p.as<PMCTuple<8> >()[1]), pmc_to_pmt(p.as<PMCTuple<8> >()[2]), pmc_to_pmt(p.as<PMCTuple<8> >()[3]), pmc_to_pmt(p.as<PMCTuple<8> >()[4]), pmc_to_pmt(p.as<PMCTuple<8> >()[5]), pmc_to_pmt(p.as<PMCTuple<8> >()[6]), pmc_to_pmt(p.as<PMCTuple<8> >()[7])); - if (p.is<PMCTuple<9> >()) - return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<9> >()[0]), pmc_to_pmt(p.as<PMCTuple<9> >()[1]), pmc_to_pmt(p.as<PMCTuple<9> >()[2]), pmc_to_pmt(p.as<PMCTuple<9> >()[3]), pmc_to_pmt(p.as<PMCTuple<9> >()[4]), pmc_to_pmt(p.as<PMCTuple<9> >()[5]), pmc_to_pmt(p.as<PMCTuple<9> >()[6]), pmc_to_pmt(p.as<PMCTuple<9> >()[7]), pmc_to_pmt(p.as<PMCTuple<9> >()[8])); - if (p.is<PMCTuple<10> >()) - return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<10> >()[0]), pmc_to_pmt(p.as<PMCTuple<10> >()[1]), pmc_to_pmt(p.as<PMCTuple<10> >()[2]), pmc_to_pmt(p.as<PMCTuple<10> >()[3]), pmc_to_pmt(p.as<PMCTuple<10> >()[4]), pmc_to_pmt(p.as<PMCTuple<10> >()[5]), pmc_to_pmt(p.as<PMCTuple<10> >()[6]), pmc_to_pmt(p.as<PMCTuple<10> >()[7]), pmc_to_pmt(p.as<PMCTuple<10> >()[8]), pmc_to_pmt(p.as<PMCTuple<10> >()[9])); - - //vector container - if (p.is<PMCList>()) - { - const PMCList &l = p.as<PMCList>(); - pmt_t v = pmt_make_vector(l.size(), pmt_t()); - for (size_t i = 0; i < l.size(); i++) - { - pmt_vector_set(v, i, pmc_to_pmt(l[i])); - } - return v; - } - - //numeric arrays - #define decl_pmc_to_pmt_numeric_array(type, suffix) \ - if (p.is<std::vector<type> >()) return pmt_init_ ## suffix ## vector(p.as<std::vector<type> >().size(), &p.as<std::vector<type> >()[0]) - decl_pmc_to_pmt_numeric_array(uint8_t, u8); - decl_pmc_to_pmt_numeric_array(uint16_t, u16); - decl_pmc_to_pmt_numeric_array(uint32_t, u32); - decl_pmc_to_pmt_numeric_array(uint64_t, u64); - decl_pmc_to_pmt_numeric_array(int8_t, s8); - decl_pmc_to_pmt_numeric_array(int16_t, s16); - decl_pmc_to_pmt_numeric_array(int32_t, s32); - decl_pmc_to_pmt_numeric_array(int64_t, s64); - decl_pmc_to_pmt_numeric_array(float, f32); - decl_pmc_to_pmt_numeric_array(double, f64); - decl_pmc_to_pmt_numeric_array(std::complex<float>, c32); - decl_pmc_to_pmt_numeric_array(std::complex<double>, c64); - - //dictionary container - if (p.is<PMCDict>()) - { - const PMCDict &m = p.as<PMCDict>(); - pmt_t d = pmt_make_dict(); - BOOST_FOREACH(const PMCPair &pr, m) - { - d = pmt_dict_add(d, pmc_to_pmt(pr.first), pmc_to_pmt(pr.second)); - } - return d; - } - - //set container - if (p.is<PMCSet>()) - { - const PMCSet &s = p.as<PMCSet>(); - pmt_t l = PMT_NIL; - BOOST_FOREACH(const PMCC &elem, s) - { - l = pmt_list_add(l, pmc_to_pmt(elem)); - } - return l; - } - - //is it already a pmt? - if (p.is<pmt_t>()) return p.as<pmt_t>(); - - //backup plan... boost::any - return pmt_make_any(p); - -} - -inline PMCC pmt_to_pmc(const pmt_t &p) -{ - //if the container null? - if (not p) return PMC(); - - #define decl_pmt_to_pmc(check, conv) if (check(p)) return PMC::make(conv(p)) - - //bool - decl_pmt_to_pmc(pmt_is_bool, pmt_to_bool); - - //string - decl_pmt_to_pmc(pmt_is_symbol, pmt_symbol_to_string); - - //numeric types - decl_pmt_to_pmc(pmt_is_integer, pmt_to_long); - decl_pmt_to_pmc(pmt_is_uint64, pmt_to_uint64); - decl_pmt_to_pmc(pmt_is_real, pmt_to_double); - decl_pmt_to_pmc(pmt_is_complex, pmt_to_complex); - - //is it a boost any holding a PMCC? - if (pmt_is_any(p)) - { - const boost::any a = pmt_any_ref(p); - if (a.type() == typeid(PMCC)) return boost::any_cast<PMCC>(a); - } - - //pair container - if (pmt_is_pair(p)) - { - PMCPair pr(pmt_to_pmc(pmt_car(p)), pmt_to_pmc(pmt_cdr(p))); - return PMC::make(pr); - } - - //fucking tuples - #define decl_pmt_to_pmc_tuple(n) \ - if (pmt_is_tuple(p) and pmt_length(p) == n) \ - { \ - PMCTuple<n> t; \ - for (size_t i = 0; i < n; i++) t[i] = pmt_to_pmc(pmt_tuple_ref(p, i)); \ - return PMC::make(t); \ - } - decl_pmt_to_pmc_tuple(0); - decl_pmt_to_pmc_tuple(1); - decl_pmt_to_pmc_tuple(2); - decl_pmt_to_pmc_tuple(3); - decl_pmt_to_pmc_tuple(4); - decl_pmt_to_pmc_tuple(5); - decl_pmt_to_pmc_tuple(6); - decl_pmt_to_pmc_tuple(7); - decl_pmt_to_pmc_tuple(8); - decl_pmt_to_pmc_tuple(9); - decl_pmt_to_pmc_tuple(10); - - //vector container - if (pmt_is_vector(p)) - { - PMCList l(pmt_length(p)); - for (size_t i = 0; i < l.size(); i++) - { - l[i] = pmt_to_pmc(pmt_vector_ref(p, i)); - } - return PMC::make(l); - } - - //numeric arrays - #define decl_pmt_to_pmc_numeric_array(type, suffix) \ - if (pmt_is_ ## suffix ## vector(p)) \ - { \ - size_t n; const type* i = pmt_ ## suffix ## vector_elements(p, n); \ - return PMC::make(std::vector<type>(i, i+n)); \ - } - decl_pmt_to_pmc_numeric_array(uint8_t, u8); - decl_pmt_to_pmc_numeric_array(uint16_t, u16); - decl_pmt_to_pmc_numeric_array(uint32_t, u32); - decl_pmt_to_pmc_numeric_array(uint64_t, u64); - decl_pmt_to_pmc_numeric_array(int8_t, s8); - decl_pmt_to_pmc_numeric_array(int16_t, s16); - decl_pmt_to_pmc_numeric_array(int32_t, s32); - decl_pmt_to_pmc_numeric_array(int64_t, s64); - decl_pmt_to_pmc_numeric_array(float, f32); - decl_pmt_to_pmc_numeric_array(double, f64); - decl_pmt_to_pmc_numeric_array(std::complex<float>, c32); - decl_pmt_to_pmc_numeric_array(std::complex<double>, c64); - - //dictionary container - if (pmt_is_dict(p)) - { - PMCDict m; - pmt_t items = pmt_dict_items(p); - for (size_t i = 0; i < pmt_length(items); i++) - { - pmt_t item = pmt_nth(i, items); - PMCC key = pmt_to_pmc(pmt_car(item)); - PMCC val = pmt_to_pmc(pmt_cdr(item)); - m[key] = val; - } - return PMC::make(m); - } - - //set container - //FIXME no pmt_is_list... - - //backup plan... store the pmt - return PMC::make(p); -} - -} - -#endif /*INCLUDED_LIBGRAS_PMX_HELPER_HPP*/ diff --git a/lib/register_messages.cpp b/lib/register_messages.cpp index 4d774ea..b23c4a2 100644 --- a/lib/register_messages.cpp +++ b/lib/register_messages.cpp @@ -14,28 +14,28 @@ // You should have received a copy of the GNU Lesser General Public License // along with io_sig program. If not, see <http://www.gnu.org/licenses/>. -#include <gnuradio/top_block.hpp> +#include <gras/top_block.hpp> #include <gras_impl/messages.hpp> #include <gras_impl/interruptible_thread.hpp> -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::TopAllocMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::TopActiveMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::TopInertMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::TopTokenMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::GlobalBlockConfig); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::SharedThreadGroup); +THERON_DEFINE_REGISTERED_MESSAGE(gras::TopAllocMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::TopActiveMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::TopInertMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::TopTokenMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::GlobalBlockConfig); +THERON_DEFINE_REGISTERED_MESSAGE(gras::SharedThreadGroup); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::InputTagMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::InputBufferMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::InputTokenMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::InputCheckMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::InputAllocMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::InputTagMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::InputBufferMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::InputTokenMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::InputCheckMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::InputAllocMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::OutputBufferMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::OutputTokenMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::OutputCheckMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::OutputHintMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::OutputAllocMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::OutputBufferMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::OutputTokenMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::OutputCheckMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::OutputHintMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::OutputAllocMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::SelfKickMessage); -THERON_DEFINE_REGISTERED_MESSAGE(gnuradio::UpdateInputsMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::SelfKickMessage); +THERON_DEFINE_REGISTERED_MESSAGE(gras::UpdateInputsMessage); diff --git a/lib/sbuffer.cpp b/lib/sbuffer.cpp index ab5c72c..37c2c33 100644 --- a/lib/sbuffer.cpp +++ b/lib/sbuffer.cpp @@ -14,13 +14,13 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#include <gnuradio/sbuffer.hpp> +#include <gras/sbuffer.hpp> #include "alloc_on_node.hpp" #include <boost/bind.hpp> -using namespace gnuradio; +using namespace gras; -void gnuradio::sbuffer_handle_deref(SBufferImpl *impl) +void gras::sbuffer_handle_deref(SBufferImpl *impl) { //call the deleter if possible boost::shared_ptr<SBufferDeleter> token_deleter = impl->config.token.lock(); diff --git a/lib/tag_handlers.hpp b/lib/tag_handlers.hpp index 4e630fb..408e28b 100644 --- a/lib/tag_handlers.hpp +++ b/lib/tag_handlers.hpp @@ -20,7 +20,7 @@ #include <gras_impl/block_actor.hpp> #include <algorithm> -namespace gnuradio +namespace gras { GRAS_FORCE_INLINE void BlockActor::sort_tags(const size_t i) @@ -80,6 +80,6 @@ GRAS_FORCE_INLINE void BlockActor::trim_tags(const size_t i) if (last != 0) tags_i.erase(tags_i.begin(), tags_i.begin()+last); } -} //namespace gnuradio +} //namespace gras #endif /*INCLUDED_LIBGRAS_TAG_HANDLERS_HPP*/ diff --git a/lib/tags.cpp b/lib/tags.cpp index ec563d0..a837c24 100644 --- a/lib/tags.cpp +++ b/lib/tags.cpp @@ -14,9 +14,9 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#include <gnuradio/tags.hpp> +#include <gras/tags.hpp> -using namespace gnuradio; +using namespace gras; Tag::Tag(void): offset(0) @@ -30,7 +30,7 @@ Tag::Tag(const uint64_t &offset, const PMCC &key, const PMCC &value, const PMCC //NOP } -bool gnuradio::operator<(const Tag &lhs, const Tag &rhs) +bool gras::operator<(const Tag &lhs, const Tag &rhs) { return lhs.offset < rhs.offset; } diff --git a/lib/theron_allocator.cpp b/lib/theron_allocator.cpp index 3158159..e5b3748 100644 --- a/lib/theron_allocator.cpp +++ b/lib/theron_allocator.cpp @@ -22,7 +22,7 @@ * and otherwise the regular malloc/free for larger buffers. **********************************************************************/ -#include <gnuradio/gras.hpp> +#include <gras/gras.hpp> #include <gras_impl/debug.hpp> #include <Theron/Detail/Threading/SpinLock.h> #include <Theron/IAllocator.h> diff --git a/lib/top_block.cpp b/lib/top_block.cpp index a09744e..b82f603 100644 --- a/lib/top_block.cpp +++ b/lib/top_block.cpp @@ -15,10 +15,10 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. #include "element_impl.hpp" -#include <gnuradio/top_block.hpp> +#include <gras/top_block.hpp> #include <boost/thread/thread.hpp> //sleep -using namespace gnuradio; +using namespace gras; GlobalBlockConfig::GlobalBlockConfig(void) { diff --git a/lib/topology_handler.cpp b/lib/topology_handler.cpp index 5ad9378..27c2346 100644 --- a/lib/topology_handler.cpp +++ b/lib/topology_handler.cpp @@ -16,7 +16,7 @@ #include <gras_impl/block_actor.hpp> -using namespace gnuradio; +using namespace gras; template <typename V, typename Sig> void fill_item_sizes_from_sig(V &v, const Sig &s, const size_t size) |