AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
ADynamicPipe Class Reference

An asynchronous buffer that converts an IInputStream to IOutputStream (and otherwise). More...

Detailed Description

An asynchronous buffer that converts an IInputStream to IOutputStream (and otherwise).

ADynamicPipe is similar to the unix pipes. It's slower than APipe but it's capable to store any byte count.

Unlike APipe, ADynamicPipe never blocks the thread which can be useful in an asynchronous system.

Public Member Functions

void write (const char *src, size_t size) override
 Writes exact size bytes to stream. Blocking (waiting for write all data) is allowed. More...
 
size_t read (char *dst, size_t size) override
 Reads up to size bytes from stream. Blocking (waiting for new data) is allowed. More...
 
bool empty () const noexcept
 
- Public Member Functions inherited from IInputStream
size_t read (std::span< std::byte > destination)
 Reads up to destination.size() bytes from stream. Blocking (waiting for new data) is allowed. More...
 
void readExact (char *dst, size_t size)
 Reads exact size bytes from stream. Blocking (waiting for new data) is allowed. More...
 
template<typename T >
deserialize ()
 
template<typename T >
IInputStreamoperator>> (T &dst)
 
template<typename T >
IInputStreamoperator>> (T &&dst)
 
- Public Member Functions inherited from IOutputStream
template<typename T >
void write (const T &t)
 
template<typename T >
IOutputStreamoperator<< (const T &t)
 

Member Function Documentation

◆ read()

size_t ADynamicPipe::read ( char *  dst,
size_t  size 
)
overridevirtual

Reads up to size bytes from stream. Blocking (waiting for new data) is allowed.

Sneaky exceptions
An implementation can throw any exception that subclasses AIOException.
Parameters
dstdestination buffer
sizedestination buffer's size. > 0
Returns
number of read bytes (including 0)

Implements IInputStream.

◆ write()

void ADynamicPipe::write ( const char *  src,
size_t  size 
)
overridevirtual

Writes exact size bytes to stream. Blocking (waiting for write all data) is allowed.

Sneaky exceptions
An implementation can throw any exception that subclasses AIOException.
Parameters
dstsource buffer
sizesource buffer's size. > 0

Implements IOutputStream.

#include <AUI/IO/ADynamicPipe.h>


The documentation for this class was generated from the following files:
Inheritance diagram for ADynamicPipe:
Collaboration diagram for ADynamicPipe: