diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/block.cpp | 11 | ||||
-rw-r--r-- | lib/block_handlers.cpp | 1 | ||||
-rw-r--r-- | lib/element_impl.hpp | 5 | ||||
-rw-r--r-- | lib/gras_impl/output_buffer_queues.hpp (renamed from lib/gras_impl/vector_of_queues.hpp) | 25 |
4 files changed, 31 insertions, 11 deletions
diff --git a/lib/block.cpp b/lib/block.cpp index 9dd0028..6bbdcd8 100644 --- a/lib/block.cpp +++ b/lib/block.cpp @@ -30,6 +30,7 @@ Block::Block(const std::string &name): { this->set_history(0); this->set_output_multiple(1); + this->set_input_inline(0, true); this->set_fixed_rate(true); this->set_relative_rate(1.0); this->set_tag_propagation_policy(TPP_ALL_TO_ALL); @@ -107,6 +108,16 @@ void Block::produce(const size_t which_output, const size_t how_many_items) (*this)->produce_items[which_output] = how_many_items; } +void Block::set_input_inline(const size_t which_input, const bool enb) +{ + vector_set((*this)->input_inline_enables, enb, which_input); +} + +bool Block::input_inline(const size_t which_input) const +{ + return (*this)->input_inline_enables[which_input]; +} + void Block::set_fixed_rate(const bool fixed_rate) { (*this)->enable_fixed_rate = fixed_rate; diff --git a/lib/block_handlers.cpp b/lib/block_handlers.cpp index 3715615..2cb167f 100644 --- a/lib/block_handlers.cpp +++ b/lib/block_handlers.cpp @@ -152,6 +152,7 @@ void ElementImpl::topology_update(const tsbe::TaskInterface &task_iface) //resize and fill port properties resize_fill_back(this->input_history_items, num_inputs); resize_fill_back(this->output_multiple_items, num_outputs); + resize_fill_grow(this->input_inline_enables, num_inputs, false); //resize the bytes consumed/produced resize_fill_grow(this->items_consumed, num_inputs, 0); diff --git a/lib/element_impl.hpp b/lib/element_impl.hpp index 44125b1..01a9791 100644 --- a/lib/element_impl.hpp +++ b/lib/element_impl.hpp @@ -20,7 +20,7 @@ #include <gras_impl/debug.hpp> #include <gras_impl/token.hpp> #include <gras_impl/messages.hpp> -#include <gras_impl/vector_of_queues.hpp> +#include <gras_impl/output_buffer_queues.hpp> #include <gras_impl/input_buffer_queues.hpp> #include <gras_impl/interruptible_thread.hpp> @@ -67,6 +67,7 @@ struct ElementImpl std::vector<size_t> input_history_items; std::vector<size_t> output_multiple_items; std::vector<size_t> input_multiple_items; + std::vector<bool> input_inline_enables; //keeps track of production std::vector<uint64_t> items_consumed; @@ -97,7 +98,7 @@ struct ElementImpl //buffer queues and ready conditions InputBufferQueues input_queues; - VectorOfQueues<SBuffer> output_queues; + OutputBufferQueues<SBuffer> output_queues; //tag tracking std::vector<bool> input_tags_changed; diff --git a/lib/gras_impl/vector_of_queues.hpp b/lib/gras_impl/output_buffer_queues.hpp index 32e0b7f..cf3ea0c 100644 --- a/lib/gras_impl/vector_of_queues.hpp +++ b/lib/gras_impl/output_buffer_queues.hpp @@ -14,21 +14,21 @@ // 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/>. -#ifndef INCLUDED_LIBGRAS_IMPL_VECTOR_OF_QUEUES_HPP -#define INCLUDED_LIBGRAS_IMPL_VECTOR_OF_QUEUES_HPP +#ifndef INCLUDED_LIBGRAS_IMPL_OUTPUT_BUFFER_QUEUES_HPP +#define INCLUDED_LIBGRAS_IMPL_OUTPUT_BUFFER_QUEUES_HPP #include <boost/dynamic_bitset.hpp> #include <vector> -#include <queue> +#include <deque> namespace gnuradio { template <typename T> -struct VectorOfQueues +struct OutputBufferQueues { boost::dynamic_bitset<> _bitset; - std::vector<std::queue<T> > _queues; + std::vector<std::deque<T> > _queues; inline void resize(const size_t size) { @@ -38,7 +38,14 @@ struct VectorOfQueues inline void push(const size_t i, const T &value) { - _queues[i].push(value); + _queues[i].push_back(value); + _bitset.set(i); + } + + //! used for input buffer inlining + inline void push_front(const size_t i, const T &value) + { + _queues[i].push_front(value); _bitset.set(i); } @@ -54,13 +61,13 @@ struct VectorOfQueues inline void pop(const size_t i) { - _queues[i].pop(); + _queues[i].pop_front(); _bitset.set(i, not _queues[i].empty()); } inline void flush(const size_t i) { - _queues[i] = std::queue<T>(); + _queues[i] = std::deque<T>(); _bitset.reset(i); } @@ -89,4 +96,4 @@ struct VectorOfQueues } //namespace gnuradio -#endif /*INCLUDED_LIBGRAS_IMPL_VECTOR_OF_QUEUES_HPP*/ +#endif /*INCLUDED_LIBGRAS_IMPL_OUTPUT_BUFFER_QUEUES_HPP*/ |