diff options
author | Josh Blum | 2013-01-18 18:25:06 -0800 |
---|---|---|
committer | Josh Blum | 2013-01-18 18:25:06 -0800 |
commit | 0a8e3475a6606620a9ad588074da713fb93e1188 (patch) | |
tree | 767ddbd27d17d948449a889f5293f6cd05078263 /include/gras | |
parent | f8fdedcf8e89179794eac7ca8d8b8550e87ac9bd (diff) | |
download | sandhi-0a8e3475a6606620a9ad588074da713fb93e1188.tar.gz sandhi-0a8e3475a6606620a9ad588074da713fb93e1188.tar.bz2 sandhi-0a8e3475a6606620a9ad588074da713fb93e1188.zip |
address that pop vs get output buffer issue
Diffstat (limited to 'include/gras')
-rw-r--r-- | include/gras/block.hpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/include/gras/block.hpp b/include/gras/block.hpp index 1acc532..c33f7f9 100644 --- a/include/gras/block.hpp +++ b/include/gras/block.hpp @@ -264,21 +264,31 @@ struct GRAS_API Block : Element * Use this function to implement passive work-flows. * * \param which_input the input port index - * \return a const reference to the buffer + * \return a reference counted copy of 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. - * This function removes the output buffer from the internal queue. * * \param which_output the output port index * \return a reference counted copy of the buffer */ - SBuffer pop_output_buffer(const size_t which_output); + SBuffer get_output_buffer(const size_t which_output) const; + + /*! + * Remove a given number of bytes from the output buffer queue. + * This call is intended to be used with get_output_buffer(). + * If pop_output_buffer() is not called after get_output_buffer(), + * The full-size of the buffer will be automatically popped. + * + * \param which_output the output port index + * \param num_bytes bytes to pop from the output buffer queue + */ + void pop_output_buffer(const size_t which_output, const size_t num_bytes); /*! * Post the given output buffer to the downstream. |