#include <IOChannel.h>
Public Member Functions | |
virtual void | close (void) |
virtual IOFD | fd (void) const |
virtual void | fd (IOFD value) |
IOChannel (IOFD fd=-1) | |
virtual bool | isBlocking (void) const |
virtual IOSize | read (void *into, IOSize n) |
virtual IOSize | readv (IOBuffer *into, IOSize buffers) |
virtual void | setBlocking (bool value) |
virtual IOSize | write (const void *from, IOSize n) |
virtual IOSize | writev (const IOBuffer *from, IOSize buffers) |
virtual | ~IOChannel (void) |
Public Member Functions inherited from IOInput | |
int | read (void) |
IOSize | read (IOBuffer into) |
IOSize | xread (IOBuffer into) |
IOSize | xread (void *into, IOSize n) |
IOSize | xreadv (IOBuffer *into, IOSize buffers) |
virtual | ~IOInput (void) |
Destruct the stream. A no-op. More... | |
Public Member Functions inherited from IOOutput | |
IOSize | write (unsigned char byte) |
IOSize | write (IOBuffer from) |
IOSize | xwrite (const void *from, IOSize n) |
IOSize | xwrite (IOBuffer from) |
IOSize | xwritev (const IOBuffer *from, IOSize buffers) |
virtual | ~IOOutput (void) |
Destruct the stream. A no-op. More... | |
Protected Member Functions | |
bool | sysclose (IOFD fd, int *error=0) |
Private Attributes | |
IOFD | m_fd |
Base class for stream-oriented I/O sources and targets, based on the operating system file descriptor.
Definition at line 9 of file IOChannel.h.
IOChannel::IOChannel | ( | IOFD | fd = -1 | ) |
Definition at line 61 of file IOChannel.cc.
|
virtual |
Definition at line 65 of file IOChannel.cc.
|
virtual |
Close the channel. By default closes the underlying operating system file descriptor.
Reimplemented in File, and RemoteFile.
Definition at line 92 of file IOChannel.cc.
References EDM_IOFD_INVALID, relativeConstraints::error, fd(), sysclose(), and throwStorageError().
Referenced by lumiQTWidget.ApplicationWindow::fileQuit(), esMonitoring.AsyncLineReaderMixin::handle_close(), esMonitoring.FDJsonServer::handle_close(), Vispa.Gui.BoxContentDialog.BoxContentDialog::keyPressEvent(), Vispa.Gui.FindDialog.FindDialog::keyPressEvent(), and sysclose().
|
virtual |
Get the system file descriptor of the channel.
Definition at line 73 of file IOChannel.cc.
References m_fd.
Referenced by close(), File::duplicate(), isBlocking(), RemoteFile::local(), read(), readv(), setBlocking(), write(), and writev().
|
virtual |
Set the system file descriptor of the channel. (FIXME: This is dangerous. How to deal with WIN32 flags and state object?)
Definition at line 79 of file IOChannel.cc.
References m_fd, and relativeConstraints::value.
|
virtual |
Definition at line 126 of file UnixIOChannel.cc.
References fd(), alignBH_cfg::mode, O_NONBLOCK, and throwStorageError().
Read at most n bytes from the channel into the buffer into.
Implements IOInput.
Reimplemented in File.
Definition at line 10 of file UnixIOChannel.cc.
References fd(), edm::errors::FileReadError, IOInput::read(), alignCSCRings::s, and throwStorageError().
Read into scattered buffers.
This operation may ignore errors. If some data are already read and an error occurs, the call returns the number of bytes read up to that point, hiding the error. It is assumed that a subsequent read will discover persistent errors and that sporadic errors such as indication that the read would block can be ignored.
The operation always fills a buffer completely before proceeding to the next one. The call is handled by the operating system if possible; the fall back is to use the single read() repeatedly.
Reimplemented from IOInput.
Reimplemented in File.
Definition at line 24 of file UnixIOChannel.cc.
References assert(), data, fd(), edm::errors::FileReadError, i, gen::n, IOBuffer::size(), and throwStorageError().
Referenced by File::readv().
|
virtual |
Definition at line 108 of file UnixIOChannel.cc.
References fd(), alignBH_cfg::mode, O_NONBLOCK, throwStorageError(), and relativeConstraints::value.
|
protected |
Definition at line 143 of file UnixIOChannel.cc.
References close(), and runTheMatrix::ret.
Referenced by close().
Write n bytes from the buffer at from.
Implements IOOutput.
Reimplemented in File.
Definition at line 59 of file UnixIOChannel.cc.
References fd(), alignCSCRings::s, and throwStorageError().
Referenced by File::write().
Write from a scattered buffer.
This operation may ignore errors. If some data is already written and an error occurs, the call returns the number of bytes written up to that point, hiding the error. It is assumed that a subsequent write will discover persistent errors.
Always writes a complete buffer before proceeding to the next one. The call is delegated to the operating system if possible. If the system does not support this, falls back on multiple calls to single-buffer write().
Reimplemented from IOOutput.
Reimplemented in File.
Definition at line 73 of file UnixIOChannel.cc.
References assert(), data, fd(), i, gen::n, IOBuffer::size(), and throwStorageError().
Referenced by File::writev().
|
private |
Definition at line 39 of file IOChannel.h.
Referenced by fd().