AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
Pipe Class Referencefinal

Native pipe RAII wrapper. More...

#include <AUI/Platform/Pipe.h>

Public Types#

using pipe_t = HANDLE
 

Public Member Functions#

 Pipe (Pipe &&rhs) noexcept
 
Pipeoperator= (Pipe &&rhs) noexcept
 
pipe_t out () const noexcept
 Out pipe. Also known as pipe[0].
 
pipe_t in () const noexcept
 In pipe. Also known as pipe[1].
 
void closeOut () noexcept
 Close out. Also known as close(pipe[0])
 
void closeIn () noexcept
 Close in. Also known as close(pipe[1])
 
pipe_t stealOut () noexcept
 Steals ownership of the out pipe outside of the Pipe class.
 
pipe_t stealIn () noexcept
 Steals ownership of the in pipe outside of the Pipe class.
 
size_t read (char *dst, size_t size) override
 Reads up to size bytes from stream. Blocking (waiting for new data) is allowed.
 
void write (const char *src, size_t size) override
 Writes exact size bytes to stream. Blocking (waiting for write all data) is allowed.
 
- Public Member Functions inherited from aui::noncopyable
 noncopyable (const noncopyable &)=delete
 
noncopyableoperator= (const noncopyable &)=delete
 
- 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.
 
void readExact (char *dst, size_t size)
 Reads exact size bytes from stream. Blocking (waiting for new data) is allowed.
 
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)
 

Detailed Description#

Windows-specific
On Windows, implemented with CreateNamedPipe.

On *nix, implemented with pipe(2).

Member Function Documentation#

◆ read()#

size_t Pipe::read ( char * dst,
size_t size )
overridevirtual
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.

◆ stealIn()#

pipe_t Pipe::stealIn ( )
inlinenodiscardnoexcept

Resets the pipe value to zero. Caller is responsible for closing the pipe.

◆ stealOut()#

pipe_t Pipe::stealOut ( )
inlinenodiscardnoexcept

Resets the pipe value to zero. Caller is responsible for closing the pipe.

◆ write()#

void Pipe::write ( const char * src,
size_t size )
overridevirtual
Sneaky exceptions
An implementation can throw any exception that subclasses AIOException.
Parameters
srcsource buffer
sizesource buffer's size. > 0

Implements IOutputStream.