Commit 63419b09 by Marcus Winter

examples: adapted dataflow example for new semantics

parent 4d0f7a62
...@@ -3,10 +3,14 @@ class Producer { ...@@ -3,10 +3,14 @@ class Producer {
public: public:
explicit Producer(int seed) : seed_(seed), count_(4) {} explicit Producer(int seed) : seed_(seed), count_(4) {}
bool Run(T& x) { bool Run(T& x) {
// produce a new value x if (count_ >= 0) {
x = SimpleRand(seed_); // produce a new value x
count_--; x = SimpleRand(seed_);
return count_ >= 0; count_--;
return true;
} else {
return false;
}
} }
private: private:
......
bool SourceFunction(std::string & str) { bool SourceFunction(std::string & str) {
std::getline(file, str); if (!file.eof()) {
return !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