#include <Win32FileHandleDataIO.h>
Inheritance diagram for Win32FileHandleDataIO:

Public Types | |
| enum | { IO_SEEK_SET = 0, IO_SEEK_CUR, IO_SEEK_END, NUM_IO_SEEKS } |
| Values to pass in to DataIO::Seek()'s second parameter. More... | |
Public Member Functions | |
| Win32FileHandleDataIO (::HANDLE handle) | |
| Constructor. | |
| virtual | ~Win32FileHandleDataIO () |
| Destructor. | |
| virtual int32 | Read (void *buffer, uint32 size) |
| Reads bytes from the file descriptor and places them into (buffer). | |
| virtual int32 | Write (const void *buffer, uint32 size) |
| Reads bytes from (buffer) and sends them out to the file descriptor. | |
| virtual void | FlushOutput () |
| Implemented as a no-op (I don't believe file descriptors need flushing?). | |
| status_t | SetBlockingIOEnabled (bool blocking) |
| Enables or diables blocking I/O on this file descriptor. | |
| virtual void | Shutdown () |
| Closes the connection. | |
| virtual status_t | Seek (int64 offset, int whence) |
| Seeks to the specified point in the file stream. | |
| virtual int64 | GetPosition () const |
| Returns our current position in the file. | |
| virtual const SocketRef & | GetSelectSocket () const |
| Returns our file descriptor for select(). | |
| void | ReleaseFileHandle () |
| Releases control of the contained file descriptor to the calling code. | |
| ::HANDLE | GetFileHandle () const |
| Returns the file descriptor held by this object, or INVALID_HANDLE_VALUE if there is none. | |
| virtual uint64 | GetOutputStallLimit () const |
| Returns the max number of microseconds to allow for an output stall, before presuming that the I/O is hosed. | |
| virtual status_t | GetReadByteTimeStamp (int32 whichByte, uint64 &retStamp) const |
| Optional interface for returning information on when a given byte returned by the previous Read() call was received. | |
| virtual bool | HasBufferedOutput () const |
| Optional: If your DataIO subclass is holding buffered data that it wants to output as soon as possible but hasn't been able to yet, then override this method to return true, and that will cause FlushBufferedOutput() to be called ASAP. | |
| virtual void | WriteBufferedOutput () |
| Optional: If this DataIO is holding any buffered output data, this method should be implemented to Write() as much of that data as possible. | |
| uint32 | WriteFully (const void *buffer, uint32 size) |
| Convenience method: Calls Write() in a loop until the entire buffer is written, or until an error occurs. | |
| uint32 | ReadFully (void *buffer, uint32 size) |
| Convenience method: Calls Read() in a loop until the entire buffer is written, or until an error occurs. | |
| virtual int64 | GetLength () |
| Convenience method: Determines the length of this DataIO stream by Seek()'ing to the end of the stream, recording the current seek position, and then Seek()'ing back to the previous position in the stream. | |
| void | IncrementRefCount () const |
| Increments the counter and returns true iff the new value is zero. | |
| bool | DecrementRefCount () const |
| Decrements the counter and returns true iff the new value is zero. | |
| void | SetManager (AbstractObjectManager *manager) |
| Sets the recycle-pointer for this object. | |
| AbstractObjectManager * | GetManager () const |
| Returns this object's current recyler pointer. | |
| uint32 | GetRefCount () const |
| Returns this object's current reference count. | |
Definition at line 16 of file Win32FileHandleDataIO.h.
anonymous enum [inherited] |
Values to pass in to DataIO::Seek()'s second parameter.
| Win32FileHandleDataIO::Win32FileHandleDataIO | ( | ::HANDLE | handle | ) |
Constructor.
| handle | The file descriptor to use. Becomes property of this FileHandleDataIO object. |
| virtual Win32FileHandleDataIO::~Win32FileHandleDataIO | ( | ) | [virtual] |
Destructor.
close()'s the held file descriptor.
| virtual int32 Win32FileHandleDataIO::Read | ( | void * | buffer, | |
| uint32 | size | |||
| ) | [virtual] |
Reads bytes from the file descriptor and places them into (buffer).
| buffer | Buffer to write the bytes into | |
| size | Number of bytes in the buffer. |
Implements DataIO.
| virtual int32 Win32FileHandleDataIO::Write | ( | const void * | buffer, | |
| uint32 | size | |||
| ) | [virtual] |
Reads bytes from (buffer) and sends them out to the file descriptor.
| buffer | Buffer to read the bytes from. | |
| size | Number of bytes in the buffer. |
Implements DataIO.
| status_t Win32FileHandleDataIO::SetBlockingIOEnabled | ( | bool | blocking | ) |
Enables or diables blocking I/O on this file descriptor.
If this object is to be used by an AbstractMessageIOGateway, then non-blocking I/O is usually better to use. NOTE: Win32 File handles currently do not use this flag.
| blocking | If true, file descriptor is set to blocking I/O mode. Otherwise, non-blocking I/O. |
| virtual void Win32FileHandleDataIO::Shutdown | ( | ) | [virtual] |
| virtual status_t Win32FileHandleDataIO::Seek | ( | int64 | offset, | |
| int | whence | |||
| ) | [virtual] |
Seeks to the specified point in the file stream.
| offset | Where to seek to. | |
| whence | IO_SEEK_SET, IO_SEEK_CUR, or IO_SEEK_END. |
Implements DataIO.
| virtual const SocketRef& Win32FileHandleDataIO::GetSelectSocket | ( | ) | const [inline, virtual] |
Returns our file descriptor for select().
Win32 HANDLES are not compatible with unix-style select, so this method always returns -1
Implements DataIO.
Definition at line 77 of file Win32FileHandleDataIO.h.
| void Win32FileHandleDataIO::ReleaseFileHandle | ( | ) | [inline] |
Releases control of the contained file descriptor to the calling code.
After this method returns, this object no longer owns or can use or close the file descriptor descriptor it once held.
Definition at line 84 of file Win32FileHandleDataIO.h.
| virtual uint64 DataIO::GetOutputStallLimit | ( | ) | const [inline, virtual, inherited] |
Returns the max number of microseconds to allow for an output stall, before presuming that the I/O is hosed.
Default implementation returns MUSCLE_TIME_NEVER, aka no limit.
Reimplemented in FailoverDataIO, MultiDataIO, PacketizedDataIO, TCPSocketDataIO, and XorDataIO.
Definition at line 72 of file DataIO.h.
Referenced by MultiDataIO::GetOutputStallLimit(), and FailoverDataIO::GetOutputStallLimit().
| virtual status_t DataIO::GetReadByteTimeStamp | ( | int32 | whichByte, | |
| uint64 & | retStamp | |||
| ) | const [inline, virtual, inherited] |
Optional interface for returning information on when a given byte returned by the previous Read() call was received.
Not implemented by default, and not implemented by any of the standard MUSCLE DataIO subclasses. (Used by an LCS dataIO class that needs precision timing)
| whichByte | Index of the byte in the previously returned read-buffer that you are interested in. | |
| retStamp | On success, this value is set to the timestamp of the byte. |
Reimplemented in FailoverDataIO, MultiDataIO, and XorDataIO.
Definition at line 114 of file DataIO.h.
Referenced by MultiDataIO::GetReadByteTimeStamp(), and FailoverDataIO::GetReadByteTimeStamp().
| virtual bool DataIO::HasBufferedOutput | ( | ) | const [inline, virtual, inherited] |
Optional: If your DataIO subclass is holding buffered data that it wants to output as soon as possible but hasn't been able to yet, then override this method to return true, and that will cause FlushBufferedOutput() to be called ASAP.
Default implementation always returns false.
Reimplemented in FailoverDataIO, MultiDataIO, PacketizedDataIO, and XorDataIO.
Definition at line 123 of file DataIO.h.
Referenced by FailoverDataIO::HasBufferedOutput().
| virtual void DataIO::WriteBufferedOutput | ( | ) | [inline, virtual, inherited] |
Optional: If this DataIO is holding any buffered output data, this method should be implemented to Write() as much of that data as possible.
Default implementation is a no-op.
Reimplemented in FailoverDataIO, MultiDataIO, PacketizedDataIO, and XorDataIO.
Definition at line 130 of file DataIO.h.
Referenced by FailoverDataIO::WriteBufferedOutput().
| uint32 DataIO::WriteFully | ( | const void * | buffer, | |
| uint32 | size | |||
| ) | [inherited] |
Convenience method: Calls Write() in a loop until the entire buffer is written, or until an error occurs.
This method should only be used in conjunction with blocking I/O; it will not work reliably with non-blocking I/O.
| buffer | Pointer to the first byte of the buffer to write data from. | |
| size | Number of bytes to write |
| uint32 DataIO::ReadFully | ( | void * | buffer, | |
| uint32 | size | |||
| ) | [inherited] |
Convenience method: Calls Read() in a loop until the entire buffer is written, or until an error occurs.
This method should only be used in conjunction with blocking I/O; it will not work reliably with non-blocking I/O.
| buffer | Pointer to the first byte of the buffer to place the read data into. | |
| size | Number of bytes to read |
| virtual int64 DataIO::GetLength | ( | ) | [virtual, inherited] |
Convenience method: Determines the length of this DataIO stream by Seek()'ing to the end of the stream, recording the current seek position, and then Seek()'ing back to the previous position in the stream.
Of course this only works with DataIOs that support seeking and have a fixed length.
Reimplemented in PacketizedDataIO.
| void RefCountable::IncrementRefCount | ( | ) | const [inline, inherited] |
Increments the counter and returns true iff the new value is zero.
Thread safe.
Definition at line 32 of file RefCount.h.
References AtomicCounter::AtomicIncrement().
| bool RefCountable::DecrementRefCount | ( | ) | const [inline, inherited] |
Decrements the counter and returns true iff the new value is zero.
Thread safe.
Definition at line 35 of file RefCount.h.
References AtomicCounter::AtomicDecrement().
| void RefCountable::SetManager | ( | AbstractObjectManager * | manager | ) | [inline, inherited] |
Sets the recycle-pointer for this object.
If set to non-NULL, this pointer is used by the ObjectPool class to recycle this object when it is no longer in use, so as to avoid the overhead of having to delete it and re-create it later on. The RefCountable class itself does nothing with this pointer. Default value is NULL.
| manager | Pointer to the new manager object to use, or NULL to use no manager. |
Definition at line 44 of file RefCount.h.
| uint32 RefCountable::GetRefCount | ( | ) | const [inline, inherited] |
Returns this object's current reference count.
Note that the value returned by this method is volatile in multithreaded environments, so it may already be wrong by the time it is returned. Be careful!
Definition at line 54 of file RefCount.h.
References AtomicCounter::GetCount().
1.5.1