GATE
Loading...
Searching...
No Matches
Pipe Class Reference

Anonymous and named pipe control class. More...

#include <pipes.hpp>

Public Types

enum  OpenModeEnum { }
 Access mode flags for creating or opening pipes. More...
 

Public Member Functions

 Pipe ()
 Creates an anonymous pipe (read + write side)
 
 Pipe (String &name, OpenModeEnum mode)
 Create or open a named pipe.
 
 Pipe (Pipe const &pipe)
 Create a copy by duplicating pipe handles.
 
 Pipe (gate_pipe_t import_read_pipe, gate_pipe_t import_write_pipe)
 Create a pipe object by importing native pipe handles.
 
bool_t canRead () const
 Get readability state.
 
bool_t canWrite () const
 Get writability state.
 
size_t read (char *buffer, size_t bufferlen)
 Reads data from pipe into buffer and returns retrieved bytes.
 
size_t write (char const *buffer, size_t bufferlen)
 Writes bytes from buffer into pipe and returns actual transmitted bytes.
 
String exportRead () const
 Exports ID of read-pipe handle.
 
String exportWrite () const
 Exports ID of write-pipe handle.
 

Static Public Member Functions

static Stream openStream (String &name, OpenModeEnum mode=OpenMode_Create)
 Creates or opens a named pipe as a stream object.
 

Static Public Attributes

static gate_pipe_t const Invalid = gate_pipe_invalid
 Special invalid (not-existent) pipe-handle.
 

Detailed Description

Anonymous and named pipe control class.

Member Enumeration Documentation

◆ OpenModeEnum

Access mode flags for creating or opening pipes.

Enumerator
OpenMode_Read 

Create a new named pipe (with read and write acccess)

OpenMode_Write 

Open an existing named pipe for read access.

OpenMode_ReadWrite 

Open an existing named pipe for write access.

Constructor & Destructor Documentation

◆ Pipe() [1/3]

Pipe ( String & name,
OpenModeEnum mode )

Create or open a named pipe.

Parameters
[in,out]nameReference to empty string to be filled with generated pipe name OR name of pipe to be opened
[in]modesee Pipe::OpenModeEnum

◆ Pipe() [2/3]

Pipe ( Pipe const & pipe)

Create a copy by duplicating pipe handles.

Parameters
[in]pipePipe object to be copied from

◆ Pipe() [3/3]

Pipe ( gate_pipe_t import_read_pipe,
gate_pipe_t import_write_pipe )

Create a pipe object by importing native pipe handles.

Parameters
[in]import_read_pipeHandle of read-side of pipe
[in]import_write_pipeHandle of write-side of pipe

Member Function Documentation

◆ canRead()

bool_t canRead ( ) const

Get readability state.

Returns
true if a read pipe handle is available

◆ canWrite()

bool_t canWrite ( ) const

Get writability state.

Returns
true if a write pipe handle is available

◆ read()

size_t read ( char * buffer,
size_t bufferlen )

Reads data from pipe into buffer and returns retrieved bytes.

Parameters
[out]bufferPointer to buffer to be filled with retrieved bytes
[in]bufferlenMaximum capacity of buffer
Returns
Actual amount of bytes retrieved from pipe

◆ write()

size_t write ( char const * buffer,
size_t bufferlen )

Writes bytes from buffer into pipe and returns actual transmitted bytes.

Parameters
[in]bufferPointer to buffer with data to be written to pipe
[in]bufferlenLength of buffer to be written to pipe
Returns
Actual amount of bytes written to pipe

◆ exportRead()

String exportRead ( ) const

Exports ID of read-pipe handle.

Returns
String representing the read-pipe handle

◆ exportWrite()

String exportWrite ( ) const

Exports ID of write-pipe handle.

Returns
String representing the write-pipe handle

◆ openStream()

Stream openStream ( String & name,
OpenModeEnum mode = OpenMode_Create )
static

Creates or opens a named pipe as a stream object.

Parameters
[in,out]nameReference to string receiving new generated pipe-name OR name of pipe to be opened
[in]modeCreate- or open mode of new pipe, see Pipe::OpenModeEnum
Returns


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