AsyncBufferedInputStream
Engine/source/platform/async/asyncBufferedStream.h
Public Types
_Anonymous_ { DEFAULT_STREAM_LOOKAHEAD = 3 }
Parent::ElementType
ElementType
Type of elements read, buffered, and returned by this stream.
Parent
Parent::SourceElementType
SourceElementType
Type of elements being read from the source stream.
Parent::SourceStreamType
SourceStreamType
Type of the source stream being read by this stream.
Protected Types
ElementList
Stream elements are kept on deques that can be concurrently accessed by multiple threads.
Public Friends
Protected Attributes
List of buffered elements.
bool
If true, the stream will restart over from the beginning once it has been read in entirety.
bool
If true, no further requests should be issued on this stream.
Maximum number of elements allowed on buffer list.
Number of elements currently on buffer list.
Number of source elements remaining in the source stream.
The thread context used for prioritizing read items in the pool.
The thread pool to which read items are queued.
Protected Functions
_onArrival(const ElementType & element)
Called when an element read has been completed on the underlying stream.
Request the next element from the underlying stream.
Public Functions
AsyncBufferedInputStream(const Stream & stream, U32 numSourceElementsToRead, U32 numReadAhead, bool isLooping, ThreadPool * pool, ThreadContext * context)
Construct a new buffered stream reading from "source".
bool
read(ElementType * buffer, U32 num)
Read the next "num" elements into "buffer".
Detailed Description
Public Types
@133
Enumerator
- DEFAULT_STREAM_LOOKAHEAD = 3
The number of elements to buffer in advance by default.
typedef Parent::ElementType ElementType
Type of elements read, buffered, and returned by this stream.
typedef IInputStreamFilter< T, Stream > Parent
typedef Parent::SourceElementType SourceElementType
Type of elements being read from the source stream.
note:This does not need to correspond to the type of elements buffered in this stream.
typedef Parent::SourceStreamType SourceStreamType
Type of the source stream being read by this stream.
Protected Types
typedef ThreadSafeDeque< ElementType > ElementList
Stream elements are kept on deques that can be concurrently accessed by multiple threads.
Public Friends
Protected Attributes
ElementList mBufferedElements
List of buffered elements.
bool mIsLooping
If true, the stream will restart over from the beginning once it has been read in entirety.
bool mIsStopped
If true, no further requests should be issued on this stream.
note:This in itself doesn't say anything about pending requests.
U32 mMaxBufferedElements
Maximum number of elements allowed on buffer list.
U32 mNumBufferedElements
Number of elements currently on buffer list.
U32 mNumRemainingSourceElements
Number of source elements remaining in the source stream.
ThreadContext * mThreadContext
The thread context used for prioritizing read items in the pool.
ThreadPool * mThreadPool
The thread pool to which read items are queued.
Protected Functions
_onArrival(const ElementType & element)
Called when an element read has been completed on the underlying stream.
_requestNext()
Request the next element from the underlying stream.
Reimplemented by: AsyncSingleBufferedInputStream, AsyncPacketBufferedInputStream, AsyncPacketBufferedInputStream, SFXInternal::SFXAsyncStream
Public Functions
AsyncBufferedInputStream(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. |
~AsyncBufferedInputStream()
getReadAhead()
the number of elements that will be read and buffered in advance.
isLooping()
true if the stream is looping infinitely.
read(ElementType * buffer, U32 num)
Reimplemented from: IInputStream
start()
Initiate the request chain of the element stream.
stop()
Call for the request chain of the element stream to stop at the next synchronization point.