| 14 | : stream_(stream), op_(op) {}; |
| 15 | |
| 16 | bool Compose::next_stream_() const { |
| 17 | auto sample = stream_->next(); |
| 18 | if (sample.empty()) { |
| 19 | return false; |
| 20 | } |
| 21 | composedStream_ = op_(sample); |
| 22 | if (!composedStream_) { |
| 23 | throw std::runtime_error( |
| 24 | "Compose: composer unexpectedly returned a nullptr stream"); |
| 25 | } |
| 26 | return true; |
| 27 | } |
| 28 | |
| 29 | Sample Compose::next() const { |
| 30 | // note: composedStream_ is read by many threads |