diff options
author | Josh Blum | 2013-05-04 20:42:09 -0700 |
---|---|---|
committer | Josh Blum | 2013-05-04 20:42:09 -0700 |
commit | 734c3740c4ddccfbedf697edbd39021580fd51ce (patch) | |
tree | bdd3d4a9d00b110397ef673692500b62a389cfe6 | |
parent | 540a314a00b747c293f81d7931c22252a861fcdd (diff) | |
download | sandhi-734c3740c4ddccfbedf697edbd39021580fd51ce.tar.gz sandhi-734c3740c4ddccfbedf697edbd39021580fd51ce.tar.bz2 sandhi-734c3740c4ddccfbedf697edbd39021580fd51ce.zip |
gras: implement force done input port option
fixes #28
m--------- | PMC | 0 | ||||
m--------- | grextras | 0 | ||||
-rw-r--r-- | include/gras/block.hpp | 16 | ||||
-rw-r--r-- | lib/block.cpp | 1 | ||||
-rw-r--r-- | lib/gras_impl/block_actor.hpp | 4 |
5 files changed, 20 insertions, 1 deletions
diff --git a/PMC b/PMC -Subproject 6b444922db565cd64b39729a8129eac7c81fe0c +Subproject 060c76567c4e0adeee089dd8e060befdff295f6 diff --git a/grextras b/grextras -Subproject 07fbc5681cc4dcd2813ff7a1ef8fd1632085964 +Subproject 643da81a652a38afe10201390ab343667d10ae8 diff --git a/include/gras/block.hpp b/include/gras/block.hpp index 8cb5f95..5f51acf 100644 --- a/include/gras/block.hpp +++ b/include/gras/block.hpp @@ -76,6 +76,22 @@ struct GRAS_API InputPortConfig * Default = 0. */ size_t preload_items; + + /*! + * Force this block done when input port is done. + * When the upstream feeding this port declares done, + * this block will mark done once upstream notifies. + * The primary usage is to modify the done logic + * for the purposes of unit test confiruability. + * + * If the force done option is false, the block will + * not mark done when this port's upstream is done. + * However, this block will mark done when all + * input ports are done, reguardless of this setting. + * + * Default = true. + */ + bool force_done; }; //! Configuration parameters for an output port diff --git a/lib/block.cpp b/lib/block.cpp index 0015f10..75af20c 100644 --- a/lib/block.cpp +++ b/lib/block.cpp @@ -14,6 +14,7 @@ InputPortConfig::InputPortConfig(void) maximum_items = 0; inline_buffer = false; preload_items = 0; + force_done = true; } OutputPortConfig::OutputPortConfig(void) diff --git a/lib/gras_impl/block_actor.hpp b/lib/gras_impl/block_actor.hpp index 5444bb0..e5dbaac 100644 --- a/lib/gras_impl/block_actor.hpp +++ b/lib/gras_impl/block_actor.hpp @@ -182,7 +182,9 @@ GRAS_FORCE_INLINE void BlockActor::update_input_avail(const size_t i) GRAS_FORCE_INLINE bool BlockActor::is_input_done(const size_t i) { - return this->inputs_done[i] and not this->inputs_available[i]; + const bool force_done = this->input_configs[i].force_done; + if GRAS_LIKELY(force_done) return this->inputs_done[i] and not this->inputs_available[i]; + return this->inputs_done.all() and this->inputs_available.none(); } GRAS_FORCE_INLINE bool BlockActor::is_work_allowed(void) |