PQueueChannel Class Reference
#include <qchannel.h>
List of all members.
Detailed Description
Class for implementing a serial queue channel in memory. This implements a simple memory based First In First Out queue. Data written to an instance of the class may be read from the same instance at some later time.
The queue will block the read for the Read Timeout if the queue is empty. Similarly a write will be clocked for Write Timeout if the queue is full.
If there is any data to be read then it returns immediately with those bytes, so you must check the GetLastReadCount() to determine the actual number of bytes read and not rely on the count being passed into the read function.
Constructor & Destructor Documentation
PQueueChannel::PQueueChannel |
( |
PINDEX |
queueSize = 0 |
) |
|
Create a new queue channel with the specified maximum size.
- Parameters:
-
PQueueChannel::~PQueueChannel |
( |
|
) |
|
Delete queue and release memory used.
Member Function Documentation
virtual PBoolean PQueueChannel::Close |
( |
|
) |
[virtual] |
Close the file channel.
- Returns:
- PTrue if close was OK.
Reimplemented from PChannel.
PINDEX PQueueChannel::GetLength |
( |
|
) |
const [inline] |
PINDEX PQueueChannel::GetSize |
( |
|
) |
const [inline] |
virtual PBoolean PQueueChannel::Open |
( |
PINDEX |
queueSize |
) |
[virtual] |
Open a queue, allocating the queueSize bytes.
- Parameters:
-
virtual PBoolean PQueueChannel::Read |
( |
void * |
buf, |
|
|
PINDEX |
len | |
|
) |
| | [virtual] |
Low level read from the file channel. The read timeout is ignored for file I/O. The GetLastReadCount() function returns the actual number of bytes read.
The GetErrorCode() function should be consulted after Read() returns PFalse to determine what caused the failure.
- Returns:
- PTrue indicates that at least one character was read from the channel. PFalse means no bytes were read due to timeout or some other I/O error.
- Parameters:
-
| buf | Pointer to a block of memory to receive the read bytes. |
| len | Maximum number of bytes to read into the buffer. |
Reimplemented from PChannel.
virtual PBoolean PQueueChannel::Write |
( |
const void * |
buf, |
|
|
PINDEX |
len | |
|
) |
| | [virtual] |
Low level write to the file channel. The write timeout is ignored for file I/O. The GetLastWriteCount() function returns the actual number of bytes written.
The GetErrorCode() function should be consulted after Write() returns PFalse to determine what caused the failure.
- Returns:
- PTrue if at least len bytes were written to the channel.
- Parameters:
-
| buf | Pointer to a block of memory to write. |
| len | Number of bytes to write. |
Reimplemented from PChannel.
Member Data Documentation
The documentation for this class was generated from the following file: