Stream Class Reference
An abstract stream class capable of reading and writing.
More...
#include <yateclass.h>
List of all members.
Detailed Description
An abstract stream class capable of reading and writing.
Base class for encapsulating system dependent stream capable objects
Constructor & Destructor Documentation
Destructor, terminates the stream
Stream |
( |
|
) |
[inline, protected] |
Member Function Documentation
static bool allocPair |
( |
Stream *& |
str1, |
|
|
Stream *& |
str2 | |
|
) |
| | [static] |
Allocate a new pair of bidirectionally connected streams
- Parameters:
-
| str1 | Reference of a pointer receiving the newly allocated 1st end of the pair |
| str2 | Reference of a pointer receiving the newly allocated 2nd end of the pair |
- Returns:
- True is the stream pair was created successfully
static bool allocPipe |
( |
Stream *& |
reader, |
|
|
Stream *& |
writer | |
|
) |
| | [static] |
Allocate a new pair of unidirectionally pipe connected streams
- Parameters:
-
| reader | Reference of a pointer receiving the newly allocated reading side of the pipe |
| writer | Reference of a pointer receiving the newly allocated writing side of the pipe |
- Returns:
- True is the stream pipe was created successfully
virtual bool canRetry |
( |
|
) |
const [virtual] |
Check if the last error code indicates a retryable condition
- Returns:
- True if error was temporary and operation should be retried
Reimplemented in File, and Socket.
void clearError |
( |
|
) |
[inline, protected] |
Clear the last error code
int error |
( |
|
) |
const [inline] |
Get the error code of the last operation on this stream
- Returns:
- Error code generated by the last operation on this stream
virtual int readData |
( |
void * |
buffer, |
|
|
int |
length | |
|
) |
| | [pure virtual] |
Receive data from a connected stream
- Parameters:
-
| buffer | Buffer for data transfer |
| length | Length of the buffer |
- Returns:
- Number of bytes transferred, negative if an error occurred
Implemented in File, and Socket.
virtual bool setBlocking |
( |
bool |
block = true |
) |
[virtual] |
Set the blocking or non-blocking operation mode of the stream
- Parameters:
-
| block | True if I/O operations should block, false for non-blocking |
- Returns:
- True if operation was successfull, false if an error occured
Reimplemented in File, and Socket.
static bool supportsPairs |
( |
|
) |
[static] |
Check if operating system supports bidirectional stream pairs
- Returns:
- True if bidirectional pairs can be created
static bool supportsPipes |
( |
|
) |
[static] |
Check if operating system supports unidirectional stream pairs
- Returns:
- True if unidirectional pipes can be created
virtual bool terminate |
( |
|
) |
[pure virtual] |
Closes the stream
- Returns:
- True if the stream was (already) closed, false if an error occured
Implemented in File, and Socket.
virtual bool valid |
( |
|
) |
const [pure virtual] |
Check if this stream is valid
- Returns:
- True if the stream is valid, false if it's invalid or closed
Implemented in File, and Socket.
int writeData |
( |
const DataBlock & |
buf |
) |
[inline] |
int writeData |
( |
const String & |
str |
) |
[inline] |
int writeData |
( |
const char * |
str |
) |
|
Write a C string to a connected stream
- Parameters:
-
| str | String to send over the stream |
- Returns:
- Number of bytes transferred, negative if an error occurred
virtual int writeData |
( |
const void * |
buffer, |
|
|
int |
length | |
|
) |
| | [pure virtual] |
Write data to a connected stream
- Parameters:
-
| buffer | Buffer for data transfer |
| length | Length of the buffer |
- Returns:
- Number of bytes transferred, negative if an error occurred
Implemented in File, and Socket.
The documentation for this class was generated from the following file: