summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJosh Blum2012-12-01 11:31:29 -0800
committerJosh Blum2012-12-01 11:31:29 -0800
commit999d15b5dca5de7c32ddb87469d5c78136473de7 (patch)
tree7e19590ee940344ea1c1acbcb666af2c5f8ab3ae /lib
parent894674ff1cbcebfa6ba24de362d709068af41f25 (diff)
parentda0a29416576eb535c2e4d6ca4516d02cdd80089 (diff)
downloadsandhi-999d15b5dca5de7c32ddb87469d5c78136473de7.tar.gz
sandhi-999d15b5dca5de7c32ddb87469d5c78136473de7.tar.bz2
sandhi-999d15b5dca5de7c32ddb87469d5c78136473de7.zip
Merge branch 'pop_input_msg'
Conflicts: grextras
Diffstat (limited to 'lib')
-rw-r--r--lib/block.cpp21
-rw-r--r--lib/input_handlers.cpp5
2 files changed, 19 insertions, 7 deletions
diff --git a/lib/block.cpp b/lib/block.cpp
index 469a233..945b1e9 100644
--- a/lib/block.cpp
+++ b/lib/block.cpp
@@ -144,18 +144,27 @@ void Block::erase_input_tags(const size_t which_input)
(*this)->block->input_tags[which_input].clear();
}
+Tag Block::pop_input_msg(const size_t which_input)
+{
+ std::vector<Tag> &input_tags = (*this)->block->input_tags[which_input];
+ if (input_tags.empty()) return Tag();
+ Tag t = input_tags.front();
+ input_tags.erase(input_tags.begin());
+ return t;
+}
+
void Block::propagate_tags(const size_t i, const TagIter &iter)
{
const size_t num_outputs = (*this)->block->get_num_outputs();
for (size_t o = 0; o < num_outputs; o++)
+ {
+ BOOST_FOREACH(gras::Tag t, iter)
{
- BOOST_FOREACH(gras::Tag t, iter)
- {
- t.offset -= this->get_consumed(i);
- t.offset += this->get_produced(o);
- this->post_output_tag(o, t);
- }
+ t.offset -= this->get_consumed(i);
+ t.offset += this->get_produced(o);
+ this->post_output_tag(o, t);
}
+ }
}
bool Block::start(void)
diff --git a/lib/input_handlers.cpp b/lib/input_handlers.cpp
index 6b9fd2d..02f62f3 100644
--- a/lib/input_handlers.cpp
+++ b/lib/input_handlers.cpp
@@ -12,7 +12,10 @@ void BlockActor::handle_input_tag(const InputTagMessage &message, const Theron::
//handle incoming stream tag, push into the tag storage
this->input_tags[index].push_back(message.tag);
- this->input_tags_changed[index] = true;
+
+ //Changed is a boolean to enable sorting of tags: If the offset is 0, there is nothing to sort,
+ //because tags are being used for message passing, or this is just the first tag in a stream.
+ this->input_tags_changed[index] = this->input_tags_changed[index] or message.tag.offset != 0;
this->inputs_available.set(index);
this->handle_task();
}