summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/gras/block.hpp15
-rw-r--r--lib/block.cpp7
2 files changed, 19 insertions, 3 deletions
diff --git a/include/gras/block.hpp b/include/gras/block.hpp
index 70c570c..ba09377 100644
--- a/include/gras/block.hpp
+++ b/include/gras/block.hpp
@@ -236,7 +236,7 @@ struct GRAS_API Block : Element
void mark_done(void);
/*!
- * Get access to the underlying reference counted buffer.
+ * Get access to the underlying reference counted input buffer.
* This is the same buffer pointed to by input_items[which].
* This function must be called during the call to work().
* Use this function to implement passive work-flows.
@@ -244,7 +244,18 @@ struct GRAS_API Block : Element
* \param which_input the input port index
* \return a const reference to the buffer
*/
- const SBuffer &get_input_buffer(const size_t which_input);
+ const SBuffer &get_input_buffer(const size_t which_input) const;
+
+ /*!
+ * Get access to the underlying reference counted output buffer.
+ * This is the same buffer pointed to by output_items[which].
+ * This function must be called during the call to work().
+ * Use this to get a pool of buffers for datagram message ports.
+ *
+ * \param which_output the output port index
+ * \return a const reference to the buffer
+ */
+ const SBuffer &get_output_buffer(const size_t which_output) const;
/*!
* Post the given output buffer to the downstream.
diff --git a/lib/block.cpp b/lib/block.cpp
index a4e2780..0521490 100644
--- a/lib/block.cpp
+++ b/lib/block.cpp
@@ -198,11 +198,16 @@ void Block::mark_done(void)
(*this)->block->mark_done();
}
-const SBuffer &Block::get_input_buffer(const size_t which_input)
+const SBuffer &Block::get_input_buffer(const size_t which_input) const
{
return (*this)->block->input_queues.front(which_input);
}
+const SBuffer &Block::get_output_buffer(const size_t which_output) const
+{
+ return (*this)->block->output_queues.front(which_output);
+}
+
void Block::post_output_buffer(const size_t which_output, const SBuffer &buffer)
{
(*this)->block->produce_buffer(which_output, buffer);