diff options
-rw-r--r-- | CMakeLists.txt | 6 | ||||
m--------- | PMC | 0 | ||||
m--------- | Theron | 0 | ||||
m--------- | gnuradio | 0 | ||||
m--------- | grextras | 0 | ||||
-rw-r--r-- | include/gras/CMakeLists.txt | 2 | ||||
-rw-r--r-- | include/gras/block.hpp | 36 | ||||
-rw-r--r-- | include/gras/element.hpp | 21 | ||||
-rw-r--r-- | include/gras/element.i | 1 | ||||
-rw-r--r-- | include/gras/io_signature.hpp | 129 | ||||
-rw-r--r-- | include/gras/io_signature.i | 27 | ||||
-rw-r--r-- | include/gras/top_block.hpp | 13 | ||||
-rw-r--r-- | lib/CMakeLists.txt | 4 | ||||
-rw-r--r-- | lib/block.cpp | 30 | ||||
-rw-r--r-- | lib/block_handlers.cpp | 2 | ||||
-rw-r--r-- | lib/block_task.cpp | 2 | ||||
-rw-r--r-- | lib/element.cpp | 35 | ||||
-rw-r--r-- | lib/element_impl.hpp | 2 | ||||
-rw-r--r-- | lib/top_block.cpp | 26 | ||||
-rw-r--r-- | lib/topology_handler.cpp | 19 | ||||
-rw-r--r-- | python/gras/CMakeLists.txt | 2 | ||||
-rw-r--r-- | python/gras/GRAS_Block.i | 33 | ||||
-rw-r--r-- | python/gras/GRAS_HierBlock.i | 19 | ||||
-rw-r--r-- | python/gras/GRAS_IOSignature.i | 3 | ||||
-rw-r--r-- | python/gras/__init__.py | 1 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/io_sig_test.py | 21 |
27 files changed, 100 insertions, 335 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index fa15891..cfbea10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,8 +105,14 @@ add_subdirectory(tests) set(CMAKE_SOURCE_DIR ${GRAS_SOURCE_DIR}/gnuradio) set(CMAKE_BINARY_DIR ${GRAS_BINARY_DIR}/gnuradio) +#Theron isnt affected by boost thread issues. +#So we allow the gr black listed versions. +OPTION(ENABLE_BAD_BOOST "Enable known bad versions of Boost" ON) + set(CMAKE_PROJECT_NAME gnuradio) #for submodule vars +set(GR_MOAR_LIBRARIES ${GRAS_LIBRARIES}) + add_subdirectory(gnuradio) ######################################################################## diff --git a/PMC b/PMC -Subproject 1943ac6f64315cf10ff54ec8493a062d5ccdd91 +Subproject 7eb4e57c3d5b13db1616408cea6befc2b96de45 diff --git a/Theron b/Theron -Subproject 48ca705abf79dafae06d9e75e37637d4a793ecb +Subproject bca3174ae410767c283742cebbb996b745fc40e diff --git a/gnuradio b/gnuradio -Subproject 7b6594232b5f3f48352cad0e335ad0cdbc3d004 +Subproject df9bcf4297f0da202d28f9cdf1efd5bf8167d71 diff --git a/grextras b/grextras -Subproject df5a9cd37aeff2b484fd9f46f7ba1c8f9a3ae9c +Subproject f274e53f3a74f7fbac6f241504be3eafee30e58 diff --git a/include/gras/CMakeLists.txt b/include/gras/CMakeLists.txt index 0ec3c98..301f96a 100644 --- a/include/gras/CMakeLists.txt +++ b/include/gras/CMakeLists.txt @@ -11,8 +11,6 @@ install(FILES gras.hpp hier_block.hpp hier_block.i - io_signature.hpp - io_signature.i sbuffer.hpp sbuffer.i tags.hpp diff --git a/include/gras/block.hpp b/include/gras/block.hpp index c33f7f9..f00a6f7 100644 --- a/include/gras/block.hpp +++ b/include/gras/block.hpp @@ -109,6 +109,22 @@ struct GRAS_API Block : Element Block(const std::string &name); /******************************************************************* + * Item sizes for ports + ******************************************************************/ + + //! Get the input item size for this port in bytes + size_t get_input_size(const size_t which_input) const; + + //! Set the input item size for this port in bytes + void set_input_size(const size_t which_input, const size_t bytes); + + //! Get the output item size for this port in bytes + size_t get_output_size(const size_t which_output) const; + + //! Set the output item size for this port in bytes + void set_output_size(const size_t which_output, const size_t bytes); + + /******************************************************************* * Deal with input and output port configuration ******************************************************************/ @@ -204,12 +220,6 @@ struct GRAS_API Block : Element * Work related routines and fail states ******************************************************************/ - //! 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 WorkBufferArray<const void *> InputItems; typedef WorkBufferArray<void *> OutputItems; @@ -308,6 +318,20 @@ struct GRAS_API Block : Element void post_output_buffer(const size_t which_output, const SBuffer &buffer); /*! + * Overload notify_active to get called when block becomes active. + * This will be called when the TopBlock start/run API call executes. + * The default implementation of notify_active is a NOP. + */ + virtual void notify_active(void); + + /*! + * Overload notify_inactive to get called when block becomes inactive. + * This will be called when the TopBlock stop/run API call executes. + * The default implementation of notify_inactive is a NOP. + */ + virtual void notify_inactive(void); + + /*! * Overload notify_topology to get called on topological changes. * Use notify_topology to perform one-time resizing operations * to avoid a conditional resizing operation inside the work(). diff --git a/include/gras/element.hpp b/include/gras/element.hpp index 140a732..e6da881 100644 --- a/include/gras/element.hpp +++ b/include/gras/element.hpp @@ -4,7 +4,6 @@ #define INCLUDED_GRAS_ELEMENT_HPP #include <gras/gras.hpp> -#include <gras/io_signature.hpp> #include <boost/shared_ptr.hpp> #include <boost/enable_shared_from_this.hpp> @@ -33,14 +32,6 @@ struct GRAS_API Element : ElementBase, boost::enable_shared_from_this<Element> //! 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; - /******************************************************************* * Compatibility for dealing with shared ptrs of Elements ******************************************************************/ @@ -49,13 +40,21 @@ struct GRAS_API Element : ElementBase, boost::enable_shared_from_this<Element> * Good for that factory function/shared ptr paradigm. */ template <typename T> - Element(const boost::shared_ptr<T> &elem) + inline Element(const boost::shared_ptr<T> &elem) { *this = elem->shared_to_element(); } //! Convert a shared ptr of a derived class to an Element - Element &shared_to_element(void); + inline Element &shared_to_element(void) + { + try + { + this->weak_self = this->shared_from_this(); + } + catch(...){} + return *this; + } //! for internal use only boost::weak_ptr<Element> weak_self; diff --git a/include/gras/element.i b/include/gras/element.i index f826ca8..1408eac 100644 --- a/include/gras/element.i +++ b/include/gras/element.i @@ -29,7 +29,6 @@ //////////////////////////////////////////////////////////////////////// %include <std_string.i> %include <gras/gras.hpp> -%import <gras/io_signature.i> %include <gras/element.hpp> //////////////////////////////////////////////////////////////////////// diff --git a/include/gras/io_signature.hpp b/include/gras/io_signature.hpp deleted file mode 100644 index 1d102e4..0000000 --- a/include/gras/io_signature.hpp +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information. - -#ifndef INCLUDED_GRAS_IO_SIGNATURE_HPP -#define INCLUDED_GRAS_IO_SIGNATURE_HPP - -#include <gras/gras.hpp> -#include <vector> -#include <stdexcept> - -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<unsigned> -{ - static const int IO_INFINITE = ~0; - - //! Create an empty signature - IOSignature(void) - { - this->set_min_streams(IO_INFINITE); - this->set_max_streams(IO_INFINITE); - } - - //! Create a signature with a single item size - IOSignature(const unsigned size) - { - this->push_back(size); - 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); - } - - //! Create a signature from a vector of IO widths - IOSignature(const std::vector<unsigned> &sig) - { - this->assign(sig.begin(), sig.end()); - this->set_min_streams(IO_INFINITE); - this->set_max_streams(IO_INFINITE); - } - - //! Construct from pointer for backwards compatible shared_ptr usage. - explicit 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; - }; - - const unsigned &at(const unsigned index) const - { - if (this->empty()) - { - throw std::invalid_argument("io signature fail: indexing empty vector"); - } - if (this->size() > index) - { - return std::vector<unsigned>::at(index); - } - return this->back(); - } - - const unsigned &operator[](const unsigned index) const - { - return this->at(index); - } - - 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 unsigned index) const - { - return this->at(index); - } - - const std::vector<unsigned> &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/io_signature.i b/include/gras/io_signature.i deleted file mode 100644 index be9a3fd..0000000 --- a/include/gras/io_signature.i +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information. - -#ifndef INCLUDED_GRAS_IO_SIGNATURE_I -#define INCLUDED_GRAS_IO_SIGNATURE_I - -%{ -#include <gras/io_signature.hpp> -%} - -%ignore gras::IOSignature::operator->(); -%ignore gras::IOSignature::operator->() const; -%ignore gras::IOSignature::operator[]; //ignore warnings about %extend - -%include <std_vector.i> -%template (std_vector_gras_io_signature_unsigned) std::vector<unsigned>; - -%include <gras/io_signature.hpp> - -%extend gras::IOSignature -{ - const unsigned &__getitem__(const unsigned index) - { - return ($self)->at(index); - } -} - -#endif /*INCLUDED_GRAS_IO_SIGNATURE_I*/ diff --git a/include/gras/top_block.hpp b/include/gras/top_block.hpp index a96cfe8..497f54f 100644 --- a/include/gras/top_block.hpp +++ b/include/gras/top_block.hpp @@ -82,19 +82,6 @@ struct GRAS_API TopBlock : HierBlock * An external app will visualize the data. */ std::string get_stats_xml(void); - - //! Deprecated - void start(const size_t max_items); - - //! Deprecated - void run(const size_t max_items); - - //! Deprecated - int max_noutput_items(void) const; - - //! Deprecated - void set_max_noutput_items(int max_items); - }; } //namespace gras diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 69ada7c..76e4f2d 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -21,6 +21,9 @@ include_directories(${THERON_INCLUDE_DIRS}) link_directories(${THERON_LIBRARY_DIRS}) add_definitions(${THERON_DEFINES}) +#put custom allocator first into the sources list to guarantee precedence +list(APPEND GRAS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/theron_allocator.cpp) + list(APPEND GRAS_LIBRARIES ${THERON_LIBRARIES}) list(APPEND GRAS_SOURCES ${THERON_SOURCES}) @@ -47,7 +50,6 @@ list(APPEND GRAS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/block.cpp ${CMAKE_CURRENT_SOURCE_DIR}/block_actor.cpp ${CMAKE_CURRENT_SOURCE_DIR}/block_task.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/theron_allocator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/block_allocator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/block_handlers.cpp ${CMAKE_CURRENT_SOURCE_DIR}/topology_handler.cpp diff --git a/lib/block.cpp b/lib/block.cpp index f5ba6ce..424df83 100644 --- a/lib/block.cpp +++ b/lib/block.cpp @@ -38,6 +38,8 @@ Block::Block(const std::string &name): (*this)->block->block_state = BlockActor::BLOCK_STATE_INIT; //call block methods to init stuff + this->set_input_size(0, 1); + this->set_output_size(0, 1); this->set_input_config(0, InputPortConfig()); this->set_output_config(0, OutputPortConfig()); this->set_interruptible_work(false); @@ -80,6 +82,26 @@ typename V::value_type vector_get(const V &v, const size_t index) return v[index]; } +size_t Block::get_input_size(const size_t which_input) const +{ + return vector_get((*this)->block->input_items_sizes, which_input); +} + +void Block::set_input_size(const size_t which_input, const size_t bytes) +{ + vector_set((*this)->block->input_items_sizes, bytes, which_input); +} + +size_t Block::get_output_size(const size_t which_output) const +{ + return vector_get((*this)->block->output_items_sizes, which_output); +} + +void Block::set_output_size(const size_t which_output, const size_t bytes) +{ + vector_set((*this)->block->output_items_sizes, bytes, which_output); +} + InputPortConfig Block::get_input_config(const size_t which_input) const { return vector_get((*this)->block->input_configs, which_input); @@ -191,14 +213,14 @@ void Block::propagate_tags(const size_t i, const TagIter &iter) } } -bool Block::start(void) +void Block::notify_active(void) { - return true; + //NOP } -bool Block::stop(void) +void Block::notify_inactive(void) { - return true; + //NOP } void Block::notify_topology(const size_t, const size_t) diff --git a/lib/block_handlers.cpp b/lib/block_handlers.cpp index af0fc20..73a22da 100644 --- a/lib/block_handlers.cpp +++ b/lib/block_handlers.cpp @@ -15,7 +15,7 @@ void BlockActor::handle_top_active( if (this->block_state != BLOCK_STATE_LIVE) { - this->block_ptr->start(); + this->block_ptr->notify_active(); this->stats.start_time = time_now(); } this->block_state = BLOCK_STATE_LIVE; diff --git a/lib/block_task.cpp b/lib/block_task.cpp index ca106ab..52cf505 100644 --- a/lib/block_task.cpp +++ b/lib/block_task.cpp @@ -10,7 +10,7 @@ void BlockActor::mark_done(void) if (this->block_state == BLOCK_STATE_DONE) return; //can re-enter checking done first this->stats.stop_time = time_now(); - this->block_ptr->stop(); + this->block_ptr->notify_inactive(); //flush partial output buffers to the downstream for (size_t i = 0; i < this->get_num_outputs(); i++) diff --git a/lib/element.cpp b/lib/element.cpp index faefee9..368dbea 100644 --- a/lib/element.cpp +++ b/lib/element.cpp @@ -22,11 +22,6 @@ Element::Element(const std::string &name) (*this)->id = str(boost::format("%s(%d)") % this->name() % this->unique_id()); if (GENESIS) std::cerr << "New element: " << to_string() << std::endl; - - //default io signature to something - IOSignature sig; sig.push_back(1); - this->set_input_signature(sig); - this->set_output_signature(sig); } ElementImpl::~ElementImpl(void) @@ -36,16 +31,6 @@ ElementImpl::~ElementImpl(void) if (this->block) this->block_cleanup(); } -Element &Element::shared_to_element(void) -{ - try - { - this->weak_self = this->shared_from_this(); - } - catch(...){} - return *this; -} - long Element::unique_id(void) const { return (*this)->unique_id; @@ -60,23 +45,3 @@ std::string Element::to_string(void) const { return (*this)->id; } - -void Element::set_output_signature(const IOSignature &sig) -{ - (*this)->output_signature = sig; -} - -void Element::set_input_signature(const IOSignature &sig) -{ - (*this)->input_signature = sig; -} - -const IOSignature &Element::input_signature(void) const -{ - return (*this)->input_signature; -} - -const IOSignature &Element::output_signature(void) const -{ - return (*this)->output_signature; -} diff --git a/lib/element_impl.hpp b/lib/element_impl.hpp index 4fb025e..c707268 100644 --- a/lib/element_impl.hpp +++ b/lib/element_impl.hpp @@ -27,8 +27,6 @@ struct ElementImpl std::string name; long unique_id; std::string id; - IOSignature input_signature; - IOSignature output_signature; //top block stuff SharedThreadGroup thread_group; diff --git a/lib/top_block.cpp b/lib/top_block.cpp index 4d2f956..bfb0e85 100644 --- a/lib/top_block.cpp +++ b/lib/top_block.cpp @@ -136,29 +136,3 @@ bool TopBlock::wait(const double timeout) return (*this)->token.unique(); } - -///////////////////////// Deprecated interfaces //////////////////////// - -void TopBlock::start(const size_t max_items) -{ - this->set_max_noutput_items(max_items); - this->start(); -} - -void TopBlock::run(const size_t max_items) -{ - this->set_max_noutput_items(max_items); - this->run(); -} - -int TopBlock::max_noutput_items(void) const -{ - return this->get_global_config().maximum_output_items; -} - -void TopBlock::set_max_noutput_items(int max_items) -{ - gras::GlobalBlockConfig config = this->get_global_config(); - config.maximum_output_items = max_items; - this->set_global_config(config); -} diff --git a/lib/topology_handler.cpp b/lib/topology_handler.cpp index 06e0b60..4f12619 100644 --- a/lib/topology_handler.cpp +++ b/lib/topology_handler.cpp @@ -4,19 +4,6 @@ using namespace gras; -template <typename V, typename Sig> -void fill_item_sizes_from_sig(V &v, const Sig &s, const size_t size) -{ - //default item size of 1 in case we cant set - v.resize(size, 1); - - //empty signature? maybe it was a message port - if (s.empty()) return; - - //fill v by copying signature (with back extend mode) - for (size_t i = 0; i < v.size(); i++) v[i] = s[i]; -} - template <typename V, typename T> void resize_fill_grow(V &v, const size_t new_len, const T &fill) { @@ -43,9 +30,9 @@ void BlockActor::handle_topology( //call notify_topology on block before committing settings this->block_ptr->notify_topology(num_inputs, num_outputs); - //fill the item sizes from the IO signatures - fill_item_sizes_from_sig(this->input_items_sizes, block_ptr->input_signature(), num_inputs); - fill_item_sizes_from_sig(this->output_items_sizes, block_ptr->output_signature(), num_outputs); + //fill the item sizes per port + resize_fill_back(this->input_items_sizes, num_inputs); + resize_fill_back(this->output_items_sizes, num_outputs); //resize and fill port properties resize_fill_back(this->input_configs, num_inputs); diff --git a/python/gras/CMakeLists.txt b/python/gras/CMakeLists.txt index a6d3f52..4c72e9b 100644 --- a/python/gras/CMakeLists.txt +++ b/python/gras/CMakeLists.txt @@ -23,7 +23,6 @@ GR_SWIG_MAKE(GRAS_Block GRAS_Block.i) GR_SWIG_MAKE(GRAS_HierBlock GRAS_HierBlock.i) GR_SWIG_MAKE(GRAS_ThreadPool GRAS_ThreadPool.i) GR_SWIG_MAKE(GRAS_SBuffer GRAS_SBuffer.i) -GR_SWIG_MAKE(GRAS_IOSignature GRAS_IOSignature.i) GR_SWIG_INSTALL( TARGETS GRAS_Tags @@ -31,7 +30,6 @@ GR_SWIG_INSTALL( GRAS_HierBlock GRAS_ThreadPool GRAS_SBuffer - GRAS_IOSignature DESTINATION ${GR_PYTHON_DIR}/gras COMPONENT ${GRAS_COMP_PYTHON} ) diff --git a/python/gras/GRAS_Block.i b/python/gras/GRAS_Block.i index e8df07c..9e7299c 100644 --- a/python/gras/GRAS_Block.i +++ b/python/gras/GRAS_Block.i @@ -8,8 +8,8 @@ %feature("nodirector") gras::BlockPython::input_buffer_allocator; %feature("nodirector") gras::BlockPython::output_buffer_allocator; %feature("nodirector") gras::BlockPython::propagate_tags; -%feature("nodirector") gras::BlockPython::start; -%feature("nodirector") gras::BlockPython::stop; +%feature("nodirector") gras::BlockPython::notify_active; +%feature("nodirector") gras::BlockPython::notify_inactive; %feature("nodirector") gras::BlockPython::notify_topology; %feature("nodirector") gras::BlockPython::work; @@ -101,21 +101,21 @@ struct BlockPython : Block //NOP } - bool start(void) + void notify_active(void) { PyGILPhondler phil; - return this->_Py_start(); + return this->_Py_notify_active(); } - virtual bool _Py_start(void) = 0; + virtual void _Py_notify_active(void) = 0; - bool stop(void) + void notify_inactive(void) { PyGILPhondler phil; - return this->_Py_stop(); + return this->_Py_notify_inactive(); } - virtual bool _Py_stop(void) = 0; + virtual void _Py_notify_inactive(void) = 0; void notify_topology(const size_t num_inputs, const size_t num_outputs) { @@ -186,7 +186,6 @@ struct BlockPython : Block import numpy import traceback from GRAS_Utils import pointer_to_ndarray -from GRAS_IOSignature import IOSignature from PMC import * def sig_to_dtype_sig(sig): @@ -205,11 +204,11 @@ class Block(BlockPython): def set_input_signature(self, sig): self.__in_sig = sig_to_dtype_sig(sig) - BlockPython.set_input_signature(self, IOSignature([s.itemsize for s in self.__in_sig])) + for i, n in enumerate(self.__in_sig): self.set_input_size(i, n.itemsize) def set_output_signature(self, sig): self.__out_sig = sig_to_dtype_sig(sig) - BlockPython.set_output_signature(self, IOSignature([s.itemsize for s in self.__out_sig])) + for i, n in enumerate(self.__out_sig): self.set_output_size(i, n.itemsize) def input_signature(self): return self.__in_sig def output_signature(self): return self.__out_sig @@ -257,17 +256,17 @@ class Block(BlockPython): def notify_topology(self, *args): return - def _Py_start(self): - try: return self.start() + def _Py_notify_active(self): + try: return self.notify_active() except: traceback.print_exc(); raise - def start(self): return True + def notify_active(self): pass - def _Py_stop(self): - try: return self.stop() + def _Py_notify_inactive(self): + try: return self.notify_inactive() except: traceback.print_exc(); raise - def stop(self): return True + def notify_inactive(self): pass def _Py_propagate_tags(self, which_input, iter): try: return self.propagate_tags(which_input, iter) diff --git a/python/gras/GRAS_HierBlock.i b/python/gras/GRAS_HierBlock.i index 9cd705e..f2a9b5a 100644 --- a/python/gras/GRAS_HierBlock.i +++ b/python/gras/GRAS_HierBlock.i @@ -104,17 +104,6 @@ struct HierBlockPython : HierBlock { //NOP } - - HierBlockPython( - const std::string &name, - const IOSignature &input_signature, - const IOSignature &output_signature - ): - HierBlock(name) - { - this->set_input_signature(input_signature); - this->set_output_signature(output_signature); - } }; } @@ -151,8 +140,8 @@ def internal_connect__(fcn, obj, *args): fcn(obj, src, src_index, sink, sink_index) class TopBlock(TopBlockPython): - def __init__(self, *args, **kwargs): - TopBlockPython.__init__(self, *args, **kwargs) + def __init__(self, name="Top", *args, **kwargs): + TopBlockPython.__init__(self, name) def connect(self, *args): return internal_connect__(TopBlockPython.connect, self, *args) @@ -161,8 +150,8 @@ class TopBlock(TopBlockPython): return internal_connect__(TopBlockPython.disconnect, self, *args) class HierBlock(HierBlockPython): - def __init__(self, *args, **kwargs): - HierBlockPython.__init__(self, *args, **kwargs) + def __init__(self, name="Hier", *args, **kwargs): + HierBlockPython.__init__(self, name) #backwards compatible silliness import weakref diff --git a/python/gras/GRAS_IOSignature.i b/python/gras/GRAS_IOSignature.i deleted file mode 100644 index 36f51dd..0000000 --- a/python/gras/GRAS_IOSignature.i +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information. - -%include <gras/io_signature.i> diff --git a/python/gras/__init__.py b/python/gras/__init__.py index 2bdbc3a..33d2b00 100644 --- a/python/gras/__init__.py +++ b/python/gras/__init__.py @@ -3,7 +3,6 @@ from PMC import * from GRAS_SBuffer import SBufferConfig, SBuffer from GRAS_Tags import Tag, StreamTag, PacketMsg -from GRAS_IOSignature import IOSignature from GRAS_Block import Block from GRAS_HierBlock import HierBlock, TopBlock from GRAS_ThreadPool import ThreadPoolConfig, ThreadPool diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ebab7a6..27a2965 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -11,5 +11,4 @@ GR_ADD_TEST(block_test ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/block_te GR_ADD_TEST(hier_block_test ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/hier_block_test.py) GR_ADD_TEST(thread_pool_test ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/thread_pool_test.py) GR_ADD_TEST(sbuffer_test ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/sbuffer_test.py) -GR_ADD_TEST(io_sig_test ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/io_sig_test.py) GR_ADD_TEST(stats_test ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/stats_test.py) diff --git a/tests/io_sig_test.py b/tests/io_sig_test.py deleted file mode 100644 index 3cd90bf..0000000 --- a/tests/io_sig_test.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (C) by Josh Blum. See LICENSE.txt for licensing information. - -import unittest -import gras - -class IOSigTest(unittest.TestCase): - - def test_io_sig(self): - io = gras.IOSignature() - self.assertEqual(len(io), 0) - - def test_io_sig_extend(self): - io = gras.IOSignature([5, 6, 7]) - self.assertEqual(len(io), 3) - self.assertEqual(io[0], 5) - self.assertEqual(io[1], 6) - self.assertEqual(io[2], 7) - self.assertEqual(io[3], 7) #auto extend - -if __name__ == '__main__': - unittest.main() |