summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJosh Blum2012-09-17 23:37:12 -0700
committerJosh Blum2012-09-17 23:37:12 -0700
commitd575f066a8f9e5330645aae5cb8b42c94131471a (patch)
tree98619e07d87da5b48a72e4e9d888fd76efb19322 /include
parente2251508a10070ddb02734efbf470a0082ef1a98 (diff)
downloadsandhi-d575f066a8f9e5330645aae5cb8b42c94131471a.tar.gz
sandhi-d575f066a8f9e5330645aae5cb8b42c94131471a.tar.bz2
sandhi-d575f066a8f9e5330645aae5cb8b42c94131471a.zip
created write accessors for the work buffers
Diffstat (limited to 'include')
-rw-r--r--include/gnuradio/block.hpp19
-rw-r--r--include/gnuradio/sbuffer.hpp6
-rw-r--r--include/gnuradio/sbuffer.ipp5
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;