diff options
m--------- | gnuradio | 0 | ||||
-rw-r--r-- | include/gnuradio/block.hpp | 19 | ||||
-rw-r--r-- | include/gnuradio/sbuffer.hpp | 6 | ||||
-rw-r--r-- | include/gnuradio/sbuffer.ipp | 5 | ||||
-rw-r--r-- | lib/block_task.cpp | 10 |
5 files changed, 31 insertions, 9 deletions
diff --git a/gnuradio b/gnuradio -Subproject 5b64019e6c1640edd13ae04fea251b144c0d2fb +Subproject 00eca71506a89b19fff2081d158a3da5a36a18e diff --git a/include/gnuradio/block.hpp b/include/gnuradio/block.hpp index abfb07e..cf0cebf 100644 --- a/include/gnuradio/block.hpp +++ b/include/gnuradio/block.hpp @@ -27,7 +27,7 @@ namespace gnuradio { -template <typename PtrType> struct Buffer +template <typename PtrType> struct WorkBuffer { //! get a native pointer type to this buffer inline PtrType get(void) const @@ -47,7 +47,18 @@ template <typename PtrType> struct Buffer return _len; } -//private: + //! 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; }; @@ -182,8 +193,8 @@ struct GRAS_API Block : Element //! Called when the flow graph is stopped, can overload virtual bool stop(void); - typedef std::vector<Buffer<const void *> > InputItems; - typedef std::vector<Buffer<void *> > OutputItems; + typedef std::vector<WorkBuffer<const void *> > InputItems; + typedef std::vector<WorkBuffer<void *> > OutputItems; //! The official call into the work routine (overload please) virtual int Work( diff --git a/include/gnuradio/sbuffer.hpp b/include/gnuradio/sbuffer.hpp index 71a588a..9984e81 100644 --- a/include/gnuradio/sbuffer.hpp +++ b/include/gnuradio/sbuffer.hpp @@ -62,6 +62,9 @@ struct GRAS_API SBufferConfig //! memory affinity - meta information Affinity affinity; + //! index number for custom allocation purposes + size_t user_index; + //! deleter callback, may be used to free SBufferDeleter deleter; @@ -128,6 +131,9 @@ struct GRAS_API SBuffer : boost::intrusive_ptr<SBufferImpl> //! Get the affinity of the memory Affinity 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; diff --git a/include/gnuradio/sbuffer.ipp b/include/gnuradio/sbuffer.ipp index e4ad62a..15719b6 100644 --- a/include/gnuradio/sbuffer.ipp +++ b/include/gnuradio/sbuffer.ipp @@ -72,6 +72,11 @@ inline Affinity SBuffer::get_affinity(void) const return (*this)->config.affinity; } +inline size_t SBuffer::get_user_index(void) const +{ + return (*this)->config.user_index; +} + inline bool SBuffer::unique(void) const { return (*this)->count == 1; diff --git a/lib/block_task.cpp b/lib/block_task.cpp index bfdc49d..7648e34 100644 --- a/lib/block_task.cpp +++ b/lib/block_task.cpp @@ -74,7 +74,7 @@ void ElementImpl::mark_done(const tsbe::TaskInterface &task_iface) void ElementImpl::handle_task(const tsbe::TaskInterface &task_iface) { #ifdef WORK_DEBUG - WorkDebugPrinter(this->name); + WorkDebugPrinter WDP(this->name); #endif //------------------------------------------------------------------ @@ -122,8 +122,8 @@ void ElementImpl::handle_task(const tsbe::TaskInterface &task_iface) const size_t items = buff.length/this->input_items_sizes[i]; this->work_io_ptr_mask |= ptrdiff_t(mem); - this->input_items[i]._mem = mem; - this->input_items[i]._len = items; + this->input_items[i].get() = mem; + this->input_items[i].size() = items; this->work_input_items[i] = mem; this->work_ninput_items[i] = items; num_input_items = std::min(num_input_items, items); @@ -161,8 +161,8 @@ void ElementImpl::handle_task(const tsbe::TaskInterface &task_iface) const size_t items = bytes/this->output_items_sizes[i]; this->work_io_ptr_mask |= ptrdiff_t(mem); - this->output_items[i]._mem = mem; - this->output_items[i]._len = items; + this->output_items[i].get() = mem; + this->output_items[i].size() = items; this->work_output_items[i] = mem; num_output_items = std::min(num_output_items, items); } |