Commit 63419b09 by Marcus Winter

examples: adapted dataflow example for new semantics

parent 4d0f7a62
......@@ -3,10 +3,14 @@ class Producer {
public:
explicit Producer(int seed) : seed_(seed), count_(4) {}
bool Run(T& x) {
// produce a new value x
x = SimpleRand(seed_);
count_--;
return count_ >= 0;
if (count_ >= 0) {
// produce a new value x
x = SimpleRand(seed_);
count_--;
return true;
} else {
return false;
}
}
private:
......
bool SourceFunction(std::string & str) {
std::getline(file, str);
return !file.eof();
if (!file.eof()) {
std::getline(file, str);
return true;
} else {
return false;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment