Pipes read data from SC::AsyncReadableStream, forwarding them to SC::AsyncWritableStream. More...
#include <AsyncStreams.h>
Public Member Functions | |
| AsyncPipeline (const AsyncPipeline &)=delete | |
| AsyncPipeline (AsyncPipeline &&)=delete | |
| AsyncPipeline & | operator= (const AsyncPipeline &)=delete |
| AsyncPipeline & | operator= (AsyncPipeline &&)=delete |
| Result | pipe () |
| Reports errors by source, transforms or sinks. | |
| bool | unpipe () |
| Unregisters all events from source, transforms and sinks. | |
| Result | start () |
| Starts the pipeline. | |
Public Attributes | |
| AsyncReadableStream * | source = nullptr |
| AsyncDuplexStream * | transforms [MaxTransforms] = {nullptr} |
| Provided source (must be != nullptr) | |
| AsyncWritableStream * | sinks [MaxSinks] = {nullptr} |
| Provided transforms (optional, can be all nullptrs) | |
| Event< MaxListeners, Result > | eventError = {} |
| Provided sinks (at least one must be != nullptr) | |
Static Public Attributes | |
| static constexpr int | MaxListeners = 8 |
| static constexpr int | MaxTransforms = 8 |
| static constexpr int | MaxSinks = 8 |
Pipes read data from SC::AsyncReadableStream, forwarding them to SC::AsyncWritableStream.
When the source provides data at a faster rate than what the sink (writable) is able to process, or when running out of buffers to read data into, AsyncPipeline will AsyncReadableStream::pause the source. This is called "back-pressure" handling in the Async Streams terminology. When a writable has finished writing, AsyncReadableStream::resume will be called to try un-pausing. Caller needs to set AsyncPipeline::source field and AsyncPipeline::sinks with valid streams.
| Result SC::AsyncPipeline::pipe | ( | ) |
Reports errors by source, transforms or sinks.
Pipes source, transforms and sinks together
| Result SC::AsyncPipeline::start | ( | ) |
Starts the pipeline.
|
nodiscard |
Unregisters all events from source, transforms and sinks.
| Event<MaxListeners, Result> SC::AsyncPipeline::eventError = {} |
Provided sinks (at least one must be != nullptr)
| AsyncWritableStream* SC::AsyncPipeline::sinks[MaxSinks] = {nullptr} |
Provided transforms (optional, can be all nullptrs)
| AsyncDuplexStream* SC::AsyncPipeline::transforms[MaxTransforms] = {nullptr} |
Provided source (must be != nullptr)