StormByte-Buffer 4.0.0
C++26 buffer module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Buffer::Pipeline Class Referencefinal

Multi-pipe byte transformation over stream buffers. More...

#include <StormByte/buffer/pipeline.hxx>

Public Member Functions

Lifecycle
 Pipeline () noexcept
 Construct an empty pipeline.
 Pipeline (const Pipeline &other)
 Copy pipes only.
 Pipeline (Pipeline &&other) noexcept
 Move constructor.
 ~Pipeline () noexcept
 Join any background run, then destroy.
Pipeline & operator= (const Pipeline &other)
 Copy pipes only.
Pipeline & operator= (Pipeline &&other) noexcept
 Move assignment.
Pipes
void Add (const Pipe &pipe)
 Copy pipe and independently clone its callable state.
void Add (Pipe &&pipe)
 Take pipe by move into this Pipeline.
Execution
void SetError () const noexcept
 SetError on every intermediate ring and the final Producer.
Consumer Process (Consumer buffer, const StormByte::Safe::Shared< StormByte::Logger::Log > &log, const ExecutionMode &mode) const noexcept
 Run the pipes.

Detailed Description

Multi-pipe byte transformation over stream buffers.

This type is for ReadOnly / WriteOnly ends (Consumer, Producer, FIFO, Ring, and the like). It does not take IO leaves. File or device origins join the tube through Bridge / Pumper: run Process on a Consumer and pass that Consumer to a Bridge, or the other way around.

Each Pipe receives the previous end and writes the next. Intermediate pipes use a private SPSC ring; the last writes a public Producer. Add copies or moves a value-owned pipe. Copies deep-clone creator-owned callable state; a const add leaves the caller's pipe and captures untouched. Copying a running pipeline must be externally serialized with its callbacks; copying does not share buffers, workers or value captures.

Execution modes
Flags combine with operator|:
  • Sync (0): pipes on the caller thread; Process blocks.
  • Async: work in background; Process returns immediately.
  • Parallel: one thread per pipe; without Async, Process joins.
  • Async | Parallel: concurrent pipes and non-blocking Process.
See also
Pipe, Producer, Consumer, Bridge, Pumper, ExecutionMode

Constructor & Destructor Documentation

◆ Pipeline() [1/3]

StormByte::Buffer::Pipeline::Pipeline ( )
noexcept

Construct an empty pipeline.

◆ Pipeline() [2/3]

StormByte::Buffer::Pipeline::Pipeline ( const Pipeline & other)

Copy pipes only.

No running work is shared.

Parameters
otherSource pipeline.

◆ Pipeline() [3/3]

StormByte::Buffer::Pipeline::Pipeline ( Pipeline && other)
noexcept

Move constructor.

Parameters
otherSource pipeline.

◆ ~Pipeline()

StormByte::Buffer::Pipeline::~Pipeline ( )
noexcept

Join any background run, then destroy.

Member Function Documentation

◆ Add() [1/2]

void StormByte::Buffer::Pipeline::Add ( const Pipe & pipe)

Copy pipe and independently clone its callable state.

Parameters
pipeCaller pipe; left untouched.
Exceptions
StormByte::ExceptionCallback context cloning failed.

◆ Add() [2/2]

void StormByte::Buffer::Pipeline::Add ( Pipe && pipe)

Take pipe by move into this Pipeline.

Parameters
pipeCaller pipe; its moved-from callback reports Missing.

◆ operator=() [1/2]

Pipeline & StormByte::Buffer::Pipeline::operator= ( const Pipeline & other)

Copy pipes only.

Parameters
otherSource pipeline.
Returns
*this.

◆ operator=() [2/2]

Pipeline & StormByte::Buffer::Pipeline::operator= ( Pipeline && other)
noexcept

Move assignment.

Parameters
otherSource pipeline.
Returns
*this.

◆ Process()

Consumer StormByte::Buffer::Pipeline::Process ( Consumer buffer,
const StormByte::Safe::Shared< StormByte::Logger::Log > & log,
const ExecutionMode & mode ) const
noexcept

Run the pipes.

Parameters
bufferFirst-pipe input. A stream Consumer.
logOptional. Pipes receive a scoped shared handle.
modeExecutionMode flags.
Returns
Consumer of the last pipe.
Note
Failure, Missing or exceptions from a pipe mark all outputs errored and wake waiters. Exceptions from pipeline setup also mark outputs errored; none escape this noexcept boundary.

◆ SetError()

void StormByte::Buffer::Pipeline::SetError ( ) const
noexcept

SetError on every intermediate ring and the final Producer.


The documentation for this class was generated from the following file: