Commit 48f0a29a authored by Dominik Charousset's avatar Dominik Charousset

Add stream_scatterer::terminal member function

parent b924e148
...@@ -122,6 +122,12 @@ public: ...@@ -122,6 +122,12 @@ public:
return self_; return self_;
} }
// -- meta information -------------------------------------------------------
/// Returns `true` if thie scatterer belongs to a sink, i.e., terminates the
/// stream and never has outbound paths.
virtual bool terminal() const noexcept;
// -- pure virtual memeber functions ----------------------------------------- // -- pure virtual memeber functions -----------------------------------------
/// Sends batches to sinks. /// Sends batches to sinks.
......
...@@ -34,6 +34,8 @@ public: ...@@ -34,6 +34,8 @@ public:
~terminal_stream_scatterer() override; ~terminal_stream_scatterer() override;
size_t capacity() const noexcept override; size_t capacity() const noexcept override;
bool terminal() const noexcept override;
}; };
} // namespace caf } // namespace caf
......
...@@ -160,6 +160,10 @@ size_t stream_scatterer::total_credit() const noexcept { ...@@ -160,6 +160,10 @@ size_t stream_scatterer::total_credit() const noexcept {
return fold(std::plus<size_t>{}, size_t{0u}, paths_); return fold(std::plus<size_t>{}, size_t{0u}, paths_);
} }
bool stream_scatterer::terminal() const noexcept {
return false;
}
void stream_scatterer::about_to_erase(map_type::iterator i, bool silent, void stream_scatterer::about_to_erase(map_type::iterator i, bool silent,
error* reason) { error* reason) {
if (!silent) { if (!silent) {
......
...@@ -35,4 +35,8 @@ size_t terminal_stream_scatterer::capacity() const noexcept { ...@@ -35,4 +35,8 @@ size_t terminal_stream_scatterer::capacity() const noexcept {
return std::numeric_limits<size_t>::max(); return std::numeric_limits<size_t>::max();
} }
bool terminal_stream_scatterer::terminal() const noexcept {
return true;
}
} // namespace caf } // namespace caf
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 to comment