#include <funneldevice.h>
Inheritance diagram for FunnelDevice:
Public Methods | |
FunnelDevice (UserOfFunnelDevice *rcvr, bool isImmediate=false, size_t size=DEFAULT_FUNNEL_BUFFER_SIZE) | |
A constructor. More... | |
virtual | ~FunnelDevice (void) |
A destructor. More... | |
virtual void | prepare (void) throw (ExaltIOException) |
Prepare the device. More... | |
virtual void | flush (void) throw (ExaltIOException) |
Flush the device. More... | |
virtual void | finish (void) throw (ExaltIOException) |
Finish the work with the device. More... | |
virtual IOState | readData (char *buf, IOSize length) throw (ExaltIOException) |
Read up to the specified number of bytes into the buffer (unused). More... | |
virtual IOState | getChar (int *) throw (ExaltIOException) |
Read a char (unused). More... | |
virtual IOState | writeData (const char *buf, IOSize length) throw (ExaltIOException) |
Write the specified number of bytes from the buffer. More... | |
virtual IOState | putChar (int) throw (ExaltIOException) |
Write a char. More... | |
virtual IOSize | bytesReadTotal (void) |
Return the number of bytes read so far. More... | |
virtual IOSize | bytesRead (void) |
Return the number of bytes read by the last read operation. More... | |
virtual IOSize | bytesWritten (void) |
Return the number of bytes written so far (unused). More... | |
virtual bool | errorOccurred (void) |
Informs about an error. More... | |
virtual bool | eof (void) |
Informs about an end of file (unused). More... | |
Protected Attributes | |
UserOfFunnelDevice * | receiver |
The receiver of the data. | |
size_t | bufferSize |
The size of the inner data buffer. | |
size_t | dataLength |
The length of the data in the buffer. | |
bool | dataPresent |
Indication whether the buffer contains any data. | |
bool | immediate |
Is the data delivery immediate, or buffered? | |
IOSize | bw |
The number of bytes written to the device. | |
XmlChar * | buffer |
The data buffer. |
This device can be used for one-directional XmlChar data exchange between two objects. The object that receives the data has to be derived from the UserOfFunnelDevice class, and has to implement the UserOfFunnelDevice::receiveData() method. The sender can send the data to the receiver using standard IODevice write functions.
The data written to FunnelDevice are buffered until flush() is called, or the size of the inner buffer is exceeded. The buffering can be disabled in constructor to make the data delivery immediate.
Definition at line 58 of file funneldevice.h.
|
A constructor. Initialization is performed. In order to use the device, one has to specify the object that will receive the data (it must inherit UserOfFunnelDevice). The device stores the data in an inner buffer. If the buffer is full, the data is delivered to the receiving object. If isImmediate is set to TRUE, the data is not buffered.
Definition at line 44 of file funneldevice.cpp. References buffer, bufferSize, bw, dataLength, dataPresent, DEFAULT_FUNNEL_BUFFER_SIZE, immediate, and receiver. |
|
A destructor. Deletes the inner buffer. Definition at line 65 of file funneldevice.cpp. References buffer, and DELETE_ARRAY. |
|
Return the number of bytes read by the last read operation. Returns the number of bytes read from the device by the last read operation. Always returns 0, since the device only supports write operations.
Implements IODevice. Definition at line 238 of file funneldevice.cpp. References IOSize. |
|
Return the number of bytes read so far. Returns the total number of bytes read from the device. Always returns 0, since the device only supports write operations.
Implements IODevice. Definition at line 228 of file funneldevice.cpp. References IOSize. |
|
Return the number of bytes written so far (unused). Returns the total number of bytes written to the device.
Implements IODevice. Definition at line 248 of file funneldevice.cpp. |
|
Informs about an end of file (unused). This method can be used for tests of the end of file. Always returns FALSE.
Implements IODevice. Definition at line 268 of file funneldevice.cpp. |
|
Informs about an error. If any of the IO operations was unsuccessful, this method can be used to test it. Always returns FALSE.
Implements IODevice. Definition at line 258 of file funneldevice.cpp. |
|
Finish the work with the device. This method ends the work with the device. An attempt to work with finished device will cause an ExaltIOException to be raised. Implements IODevice. Definition at line 107 of file funneldevice.cpp. |
|
Flush the device. Ensures that all the data is written to the device. This means that all the data is delivered to the receiver. Implements IODevice. Definition at line 84 of file funneldevice.cpp. |
|
Read a char (unused). Reads one character from the device. If an error occurred, ExaltIOException is raised.
Implements IODevice. Definition at line 138 of file funneldevice.cpp. |
|
Prepare the device. This method prepares the device for further work. An attempt to work with unprepared device will cause an ExaltIOException to be raised. Implements IODevice. Definition at line 74 of file funneldevice.cpp. Referenced by XmlCodec::decode. |
|
Write a char. Writes one character to the device. If an error occurred, ExaltIOException is raised.
Implements IODevice. Definition at line 194 of file funneldevice.cpp. References IOState, ReadOk, and WriteError. |
|
Read up to the specified number of bytes into the buffer (unused). Reads up to length bytes from the device and stores them in buffer. If an error occurred, ExaltIOException is raised.
Implements IODevice. Definition at line 126 of file funneldevice.cpp. |
|
Write the specified number of bytes from the buffer. Writes length bytes from the buffer buf to the device. If an error occurred, ExaltIOException is raised.
Implements IODevice. Definition at line 152 of file funneldevice.cpp. References IOSize, IOState, WriteError, WriteOk, and XmlChar. |