diff options
author | Josh Blum | 2013-03-29 03:22:28 -0500 |
---|---|---|
committer | Josh Blum | 2013-03-29 03:22:28 -0500 |
commit | e78ac3e9582f46670a904f119d2ee80d7310b42e (patch) | |
tree | a24d20db2631c9d9e3d41642ee604228d5495e14 | |
parent | ca6d6b4a7786ecc3754532d85ed39da33684d5fc (diff) | |
parent | d6f413965cc91fd239f7ba587e9550233b386cc5 (diff) | |
download | sandhi-e78ac3e9582f46670a904f119d2ee80d7310b42e.tar.gz sandhi-e78ac3e9582f46670a904f119d2ee80d7310b42e.tar.bz2 sandhi-e78ac3e9582f46670a904f119d2ee80d7310b42e.zip |
Merge branch 'master' into query_work
-rw-r--r-- | include/gras/block.hpp | 2 | ||||
-rw-r--r-- | include/gras/element.hpp | 3 | ||||
-rw-r--r-- | include/gras/hier_block.hpp | 2 | ||||
-rw-r--r-- | include/gras/top_block.hpp | 2 | ||||
-rw-r--r-- | lib/block.cpp | 5 | ||||
-rw-r--r-- | lib/element.cpp | 5 | ||||
-rw-r--r-- | lib/gras_impl/input_buffer_queues.hpp | 22 | ||||
-rw-r--r-- | lib/hier_block.cpp | 5 | ||||
-rw-r--r-- | lib/top_block.cpp | 5 | ||||
-rw-r--r-- | python/gras/GRAS_Block.i | 3 | ||||
-rw-r--r-- | python/gras/GRAS_HierBlock.i | 8 |
11 files changed, 48 insertions, 14 deletions
diff --git a/include/gras/block.hpp b/include/gras/block.hpp index 7595345..4211255 100644 --- a/include/gras/block.hpp +++ b/include/gras/block.hpp @@ -113,6 +113,8 @@ struct GRAS_API Block : Element //! Create a new block given the name Block(const std::string &name); + virtual ~Block(void); + /******************************************************************* * Deal with input and output port configuration ******************************************************************/ diff --git a/include/gras/element.hpp b/include/gras/element.hpp index 633ab84..0bebc14 100644 --- a/include/gras/element.hpp +++ b/include/gras/element.hpp @@ -23,13 +23,14 @@ struct Block; struct GRAS_API Element : ElementBase, boost::enable_shared_from_this<Element> { - //! Create an empty element Element(void); //! Creates a new element given the name Element(const std::string &name); + /*virtual*/ ~Element(void); + /******************************************************************* * identification interface ******************************************************************/ diff --git a/include/gras/hier_block.hpp b/include/gras/hier_block.hpp index 398024e..73eeabd 100644 --- a/include/gras/hier_block.hpp +++ b/include/gras/hier_block.hpp @@ -14,6 +14,8 @@ struct GRAS_API HierBlock : Element HierBlock(const std::string &name); + virtual ~HierBlock(void); + /******************************************************************* * connection flow interface ******************************************************************/ diff --git a/include/gras/top_block.hpp b/include/gras/top_block.hpp index f99d341..17f1e30 100644 --- a/include/gras/top_block.hpp +++ b/include/gras/top_block.hpp @@ -36,6 +36,8 @@ struct GRAS_API TopBlock : HierBlock TopBlock(const std::string &name); + virtual ~TopBlock(void); + //! Get the global block config settings const GlobalBlockConfig &global_config(void) const; diff --git a/lib/block.cpp b/lib/block.cpp index d2f0a0d..5bb959b 100644 --- a/lib/block.cpp +++ b/lib/block.cpp @@ -46,6 +46,11 @@ Block::Block(const std::string &name): this->set_buffer_affinity(-1); } +Block::~Block(void) +{ + //NOP +} + void ElementImpl::block_cleanup(void) { //wait for actor to chew through enqueued messages diff --git a/lib/element.cpp b/lib/element.cpp index 4adc92c..f291310 100644 --- a/lib/element.cpp +++ b/lib/element.cpp @@ -26,6 +26,11 @@ Element::Element(const std::string &name) if (GENESIS) std::cerr << "New element: " << to_string() << std::endl; } +Element::~Element(void) +{ + //NOP +} + ElementImpl::~ElementImpl(void) { if (this->executor) this->top_block_cleanup(); diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp index 48996ef..48533b9 100644 --- a/lib/gras_impl/input_buffer_queues.hpp +++ b/lib/gras_impl/input_buffer_queues.hpp @@ -117,9 +117,13 @@ struct InputBufferQueues GRAS_FORCE_INLINE void flush_all(void) { - const size_t old_size = this->size(); - this->resize(0); - this->resize(old_size); + //clear all data in queues and update vars to reflect + for (size_t i = 0; i < this->size(); i++) + { + _queues[i] = boost::circular_buffer<SBuffer>(1); + _enqueued_bytes[i] = 0; + this->__update(i); + } } GRAS_FORCE_INLINE bool ready(const size_t i) const @@ -164,14 +168,10 @@ GRAS_FORCE_INLINE void InputBufferQueues::resize(const size_t size) _enqueued_bytes.resize(size, 0); _queues.resize(size, boost::circular_buffer<SBuffer>(1)); _aux_queues.resize(size); - - if (size != 0) //keep config info when flushing - { - _items_sizes.resize(size, 0); - _preload_bytes.resize(size, 0); - _reserve_bytes.resize(size, 1); - _maximum_bytes.resize(size, MAX_AUX_BUFF_BYTES); - } + _items_sizes.resize(size, 0); + _preload_bytes.resize(size, 0); + _reserve_bytes.resize(size, 1); + _maximum_bytes.resize(size, MAX_AUX_BUFF_BYTES); } inline void InputBufferQueues::update_config( diff --git a/lib/hier_block.cpp b/lib/hier_block.cpp index b7ffe4c..4c0aef3 100644 --- a/lib/hier_block.cpp +++ b/lib/hier_block.cpp @@ -18,6 +18,11 @@ HierBlock::HierBlock(const std::string &name): (*this)->topology = boost::shared_ptr<Apology::Topology>(new Apology::Topology()); } +HierBlock::~HierBlock(void) +{ + //NOP +} + void ElementImpl::hier_block_cleanup(void) { this->topology->clear_all(); diff --git a/lib/top_block.cpp b/lib/top_block.cpp index 10d5ef2..5370920 100644 --- a/lib/top_block.cpp +++ b/lib/top_block.cpp @@ -30,6 +30,11 @@ TopBlock::TopBlock(const std::string &name): << std::flush; } +TopBlock::~TopBlock(void) +{ + //NOP +} + void ElementImpl::top_block_cleanup(void) { this->pre_post_all_set_prio(); diff --git a/python/gras/GRAS_Block.i b/python/gras/GRAS_Block.i index b4d8293..84d6548 100644 --- a/python/gras/GRAS_Block.i +++ b/python/gras/GRAS_Block.i @@ -79,7 +79,8 @@ struct BlockPython : Block virtual ~BlockPython(void) { - //NOP + PyTSPhondler phil; + this->reset(); } void notify_active(void) diff --git a/python/gras/GRAS_HierBlock.i b/python/gras/GRAS_HierBlock.i index 12a5952..21d087e 100644 --- a/python/gras/GRAS_HierBlock.i +++ b/python/gras/GRAS_HierBlock.i @@ -45,7 +45,7 @@ struct TopBlockPython : TopBlock //NOP } - ~TopBlockPython(void) + virtual ~TopBlockPython(void) { PyTSPhondler phil; this->reset(); @@ -89,6 +89,12 @@ struct HierBlockPython : HierBlock { //NOP } + + virtual ~HierBlockPython(void) + { + PyTSPhondler phil; + this->reset(); + } }; } |