AsyncSingleBufferedInputStream
Engine/source/platform/async/asyncBufferedStream.h
A stream filter that performs background read-aheads on its source stream and buffers the results.
Public Types
Parent::ElementType
ElementType
Parent
Parent::SourceElementType
SourceElementType
Parent::SourceStreamType
SourceStreamType
Protected Functions
_newReadItem(ThreadSafeRef< ThreadWorkItem > & outRef)
Create a new work item that reads the next element.
Request the next element from the underlying stream.
Public Functions
AsyncSingleBufferedInputStream(const Stream & stream, U32 numSourceElementsToRead, U32 numReadAhead, bool isLooping, ThreadPool * pool, ThreadContext * context)
Construct a new buffered stream reading from "source".
Detailed Description
A stream filter that performs background read-aheads on its source stream and buffers the results.
As each element is read in an independent threaded operation, reading an element should invole a certain amount of work for using this class to make sense.
note:For looping streams, the stream must implement the IResettable interface.
Public Types
typedef Parent::ElementType ElementType
typedef AsyncBufferedInputStream< T, Stream > Parent
typedef Parent::SourceElementType SourceElementType
typedef Parent::SourceStreamType SourceStreamType
Protected Functions
_newReadItem(ThreadSafeRef< ThreadWorkItem > & outRef)
Create a new work item that reads the next element.
_requestNext()
Reimplemented from: AsyncBufferedInputStream
Public Functions
AsyncSingleBufferedInputStream(const Stream & stream, U32 numSourceElementsToRead, U32 numReadAhead, bool isLooping, ThreadPool * pool, ThreadContext * context)
Construct a new buffered stream reading from "source".
Parameters:
stream | The source stream from which to read the actual data elements. |
numSourceElementsToRead | Total number of elements to read from "stream". |
numReadAhead | Number of packets to read and buffer in advance. |
isLooping | If true, the packet stream will loop infinitely over the source stream. |
pool | The ThreadPool to use for asynchronous packet reads. |
context | The ThreadContext to place asynchronous packet reads in. |