Pipe Class Reference

#include <Pt/System/Pipe.h>

Pair of IODevice endpoints that form a half-duplex pipe. More...

Inherits NonCopyable.

Public Member Functions

 Pipe ()
 Creates the pipe with two IODevices.
 ~Pipe ()
 Destructor.
IODeviceout ()
 Endpoint of the pipe to read from.
const IODeviceout () const
 Endpoint of the pipe to read from.
IODevicein ()
 Endpoint of the pipe to write to.
const IODevicein () const
 Endpoint of the pipe to write to.

Detailed Description

A pipe is two IODevice objects created together. Bytes written to in() are read from out() in the same order. The constructor opens both ends. The destructor closes them.

Whether a write blocks until a read consumes data is system-dependent. Some platforms buffer a limited number of bytes between the ends. That buffer must not be assumed. Treat a write as complete only when write() or endWrite() returns.

Each end is a Selectable. Attach out() to an EventLoop to read without blocking the thread. Attach in() to write the same way.

Constructor & Destructor Documentation

◆ Pipe()

Pipe ( )
explicit

The default constructor will create the pipe and the appropriate IODevices to read and write to the pipe.

◆ ~Pipe()

~Pipe ( )

Destroys the pipe and closes the internal IODevices.