StormByte C++ Library: Buffer module 1.2.0
StormByte-Buffer is the buffer module of the StormByte C++ suite.
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
StormByte::Buffer Namespace Reference

Buffer module of the StormByte suite. More...

Classes

class  Bridge
 Pass-through adapter that forwards bytes from an ExternalReader to an ExternalWriter in fixed-size chunks. More...
 
class  Consumer
 Read-oriented handle over a shared Ring. More...
 
class  Error
 General exception class for buffer errors. More...
 
class  Exception
 Base exception type for the Buffer module. More...
 
class  ExternalBufferReader
 Adapter that turns any ReadOnly buffer into an ExternalReader. More...
 
class  ExternalBufferWriter
 Adapter that turns any WriteOnly buffer into an ExternalWriter. More...
 
class  ExternalReader
 Abstract interface for reading data from an external or internal source. More...
 
class  ExternalWriter
 Abstract interface for writing data to an external or internal sink. More...
 
class  FIFO
 Byte-oriented FIFO buffer with grow-on-demand and close/error support. More...
 
class  Generic
 Pure abstract root of the buffer interface hierarchy. More...
 
class  Hopper
 Single-producer single-consumer (SPSC) typed item queue. More...
 
class  Pipeline
 High-performance multi-stage data-processing pipeline. More...
 
class  Producer
 Write-only handle over a shared Ring. More...
 
class  ReadError
 Exception thrown when a buffer read / extract / peek operation fails. More...
 
class  ReadOnly
 Pure interface for a buffer that can be read but not written. More...
 
class  ReadWrite
 Pure interface combining ReadOnly and WriteOnly. More...
 
class  Ring
 High-performance, highly-concurrent thread-safe ring buffer. More...
 
class  SharedFIFO
 Thread-safe FIFO built on top of FIFO. More...
 
class  Sink
 Set of Hopper buckets keyed by an integer. More...
 
class  WriteError
 Exception thrown when a buffer write operation fails. More...
 
class  WriteOnly
 Pure interface for a buffer that can be written but not read. More...
 

Typedefs

using DataType = std::vector< std::byte >
 Primary byte storage type used throughout the buffer API.
 

Enumerations

enum class  Position { Absolute , Relative }
 Forward declaration of the WriteOnly interface. More...
 
enum class  ExecutionMode : unsigned { Sync = 0 , Async = 1u << 0 , Parallel = 1u << 1 }
 Bitmask controlling how Pipeline::Process schedules work. More...
 

Functions

constexpr ExecutionMode operator| (ExecutionMode a, ExecutionMode b) noexcept
 Bitwise OR of execution flags.
 
constexpr ExecutionMode operator& (ExecutionMode a, ExecutionMode b) noexcept
 Bitwise AND of execution flags.
 
constexpr ExecutionModeoperator|= (ExecutionMode &a, ExecutionMode b) noexcept
 Bitwise OR-assignment of execution flags.
 
constexpr bool HasExecutionFlag (ExecutionMode mode, ExecutionMode flag) noexcept
 Whether mode includes all bits of flag.
 

Detailed Description

Buffer module of the StormByte suite.

Typedef Documentation

◆ DataType

using StormByte::Buffer::DataType = typedef std::vector<std::byte>

Primary byte storage type used throughout the buffer API.

Alias for std::vector<std::byte>. Serves as the fundamental container for byte-oriented buffer implementations (FIFO, adapters, extract/read destinations, etc.).

Enumeration Type Documentation

◆ ExecutionMode

enum class StormByte::Buffer::ExecutionMode : unsigned
strong

Bitmask controlling how Pipeline::Process schedules work.

Flags are orthogonal and may be combined with operator|.

  • Sync (0) — no flags: stages run sequentially on the caller’s thread; Pipeline::Process blocks until completion.
  • Async — run work on background thread(s); Pipeline::Process returns immediately with the final Consumer.
  • Parallel — one thread per stage (pipeline parallelism via SPSC intermediate rings). Without Async, Process still waits for all stages to finish before returning.

Typical combinations:

Expression Stages Process()
Sync (or 0) sequential, caller blocks
Async sequential, 1 worker returns now
Parallel 1 thread per stage blocks
Async | Parallel 1 thread per stage returns now
Note
Prefer Async | Parallel for multi-stage streaming production. Use Sync for deterministic debugging.
See also
Pipeline::Process(), HasExecutionFlag()
Enumerator
Sync 

Sequential on caller thread; Process blocks.

Async 

Background execution; Process returns immediately.

Parallel 

One thread per stage (pipeline parallelism).

◆ Position

enum class StormByte::Buffer::Position
strong

Forward declaration of the WriteOnly interface.

Positioning mode for buffer seek / non-destructive read operations.

Defines how offset values are interpreted by Seek() and related APIs.

See also
ReadOnly::Seek()
Enumerator
Absolute 

Offset from the beginning of the buffer (position 0).

Relative 

Offset from the current logical read position.

Function Documentation

◆ HasExecutionFlag()

constexpr bool StormByte::Buffer::HasExecutionFlag ( ExecutionMode  mode,
ExecutionMode  flag 
)
inlineconstexprnoexcept

Whether mode includes all bits of flag.

Parameters
modeCombined mode value.
flagFlag (or flag set) to test.
Returns
true if every bit in flag is set in mode.

◆ operator&()

constexpr ExecutionMode StormByte::Buffer::operator& ( ExecutionMode  a,
ExecutionMode  b 
)
inlineconstexprnoexcept

Bitwise AND of execution flags.

Parameters
aLeft-hand flags.
bRight-hand flags.
Returns
Intersection of flag sets.

◆ operator|()

constexpr ExecutionMode StormByte::Buffer::operator| ( ExecutionMode  a,
ExecutionMode  b 
)
inlineconstexprnoexcept

Bitwise OR of execution flags.

Parameters
aLeft-hand flags.
bRight-hand flags.
Returns
Combined flag set.

◆ operator|=()

constexpr ExecutionMode & StormByte::Buffer::operator|= ( ExecutionMode a,
ExecutionMode  b 
)
inlineconstexprnoexcept

Bitwise OR-assignment of execution flags.

Parameters
aFlags to update.
bFlags to add.
Returns
Reference to a.