diff options
Diffstat (limited to 'include/gnuradio')
-rw-r--r-- | include/gnuradio/block.hpp | 19 | ||||
-rw-r--r-- | include/gnuradio/sbuffer.hpp | 6 | ||||
-rw-r--r-- | include/gnuradio/sbuffer.ipp | 5 |
3 files changed, 26 insertions, 4 deletions
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; |