diff options
author | Josh Blum | 2012-11-13 20:52:53 -0800 |
---|---|---|
committer | Josh Blum | 2012-11-13 20:52:53 -0800 |
commit | 8b714226a0c73ccb458707126d73bae752186db6 (patch) | |
tree | a2d70316dd0cfe319ee75e8bae63924c9b86a6ff /include | |
parent | e6c5ccd5190917adcb3518add8a2dc7599bd86f1 (diff) | |
download | sandhi-8b714226a0c73ccb458707126d73bae752186db6.tar.gz sandhi-8b714226a0c73ccb458707126d73bae752186db6.tar.bz2 sandhi-8b714226a0c73ccb458707126d73bae752186db6.zip |
created API for passive work-flow
Diffstat (limited to 'include')
-rw-r--r-- | include/gras/block.hpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/gras/block.hpp b/include/gras/block.hpp index bde70b1..65649b2 100644 --- a/include/gras/block.hpp +++ b/include/gras/block.hpp @@ -226,6 +226,34 @@ struct GRAS_API Block : Element void mark_done(void); /*! + * Get access to the underlying reference counted 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. + * + * \param which_input the input port index + * \return a const reference to the buffer + */ + const SBuffer &get_input_buffer(const size_t which_input); + + /*! + * Post the given output buffer to the downstream. + * This function must be called during the call to work(). + * Use this function to implement passive work-flows. + * + * Take the following rules into account: + * - The buffer will be immediately sent to the downstream. + * - The value for get_produced will automatically increase. + * - buffer.length should be in number of bytes (not items). + * - Do not call produce() for items in this buffer. + * - Call post_output_tag() before post_output_buffer(). + * + * \param which_output the output port index + * \param buffer the buffer to send downstream + */ + void post_output_buffer(const size_t which_output, const SBuffer &buffer); + + /*! * Overload notify_topology to get called on topological changes. * Use notify_topology to perform one-time resizing operations * to avoid a conditional resizing operation inside the work(). |