PUMA Library Reference Manual
Puma::Pipe Class Reference

#include <Puma/Pipe.h>

+ Inheritance diagram for Puma::Pipe:

Description

Pipe between an input source and an output sink.

Warning
This class is not used and may disappear without notice.

Public Member Functions

 Pipe (int buffer_size)
 Constructor. More...
 
 ~Pipe ()
 Destructor. More...
 
int read (char *buffer, int n)
 Read n bytes from the internal buffer into the given string buffer. More...
 
int write (const char *buffer, int n)
 Write n bytes from the given buffer into the internal source buffer. More...
 
int free ()
 Get the number of bytes left in the internal buffer. More...
 
bool full ()
 Check if the internal buffer is full. More...
 
- Public Member Functions inherited from Puma::Source
 Source ()
 Constructs an empty source object. More...
 
virtual ~Source ()
 Destroys the source object. More...
 
virtual int size ()
 Get the size of the source. More...
 
- Public Member Functions inherited from Puma::Sink
virtual ~Sink ()
 Destructor. More...
 

Constructor & Destructor Documentation

◆ Pipe()

Puma::Pipe::Pipe ( int  buffer_size)

Constructor.

Parameters
buffer_sizeSource buffer size.

◆ ~Pipe()

Puma::Pipe::~Pipe ( )

Destructor.

Member Function Documentation

◆ free()

int Puma::Pipe::free ( )

Get the number of bytes left in the internal buffer.

Returns
The free space in the internal buffer.

◆ full()

bool Puma::Pipe::full ( )
inlinevirtual

Check if the internal buffer is full.

Returns
True if no space left in the internal buffer.

Reimplemented from Puma::Sink.

◆ read()

int Puma::Pipe::read ( char *  buffer,
int  n 
)
virtual

Read n bytes from the internal buffer into the given string buffer.

Parameters
bufferThe string used as buffer for the bytes read.
nThe number of bytes to read.
Returns
The number of bytes read, or -1 in case of errors.

Implements Puma::Source.

◆ write()

int Puma::Pipe::write ( const char *  buffer,
int  n 
)
virtual

Write n bytes from the given buffer into the internal source buffer.

Parameters
bufferThe bytes to write.
nThe number of bytes to write.
Returns
The number of bytes written.

Implements Puma::Sink.