Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
SC::AsyncRequestReadableStream< AsyncRequestType > Struct Template Reference
Inheritance diagram for SC::AsyncRequestReadableStream< AsyncRequestType >:
SC::AsyncReadableStream

Public Member Functions

void setAutoCloseDescriptor (bool value)
 Automatically closes descriptor during read stream close event.
 
- Public Member Functions inherited from SC::AsyncReadableStream
Result init (AsyncBuffersPool &buffersPool)
 Emitted when the underlying resource has been closed.
 
Result start ()
 Starts the readable stream, that will emit eventData.
 
void pause ()
 Pauses the readable stream (that can be later resumed)
 
void resumeReading ()
 Resumes the readable stream paused by AsyncReadableStream::pause.
 
void destroy ()
 Forcefully destroys the readable stream before calling end event releasing all resources.
 
bool isEnded () const
 Returns true if the stream is ended (AsyncReadableStream::end has been called)
 
bool hasBeenDestroyed () const
 Returns true if the stream has been already destroyed (asynchronously through destroy())
 
AsyncBuffersPoolgetBuffersPool ()
 Obtains the AsyncBuffersPool to request more buffers.
 
constexpr void setReadQueue (Span< Request > requests)
 Sets the read queue for this readable stream.
 
size_t getReadQueueSize () const
 Returns the size of read queue.
 
bool push (AsyncBufferView::ID bufferID, size_t newSize)
 Use push from inside AsyncReadableStream::asyncRead function to queue received data.
 
Result unshift (AsyncBufferView::ID bufferID)
 Push back a buffer to the front of the read queue (e.g. for un-consumed data)
 
void pushEnd ()
 Use pushEnd from inside AsyncReadableStream::asyncRead to signal production end.
 
void reactivate (bool doReactivate)
 Use reactivate(true) from inside AsyncReadableStream::asyncRead function to ask the state machine to invoke asyncRead again.
 
void emitError (Result error)
 Signals an async error received.
 
bool getBufferOrPause (size_t minumumSizeInBytes, AsyncBufferView::ID &bufferID, Span< char > &data)
 Returns an unused buffer from pool or pauses the stream if none is available.
 
void setAutoDestroy (bool value)
 If set to true will automatically call .destroy() when Ended state is reached.
 
bool getAutoDestroy () const
 Returns true if stream will automatically call .destroy() when Ended state is reached.
 

Public Attributes

AsyncRequestType request
 
- Public Attributes inherited from SC::AsyncReadableStream
Event< MaxListeners, ResulteventError
 
Event< MaxListeners, AsyncBufferView::IDeventData
 Emitted when an error occurs.
 
Event< MaxListeners > eventEnd
 Emitted when a new buffer has been read.
 
Event< MaxListeners > eventClose
 Emitted when there is no more data.
 

Protected Member Functions

virtual Result asyncRead () override
 Function that every stream must define to implement its custom read operation.
 
virtual Result asyncDestroyReadable () override
 Function that a readable stream can re-implement to release its internal resources.
 
void afterRead (typename AsyncRequestType::Result &result)
 
void finalizeReadableDestruction ()
 
- Protected Member Functions inherited from SC::AsyncReadableStream
Result finishedDestroyingReadable ()
 Called from inside asyncDestroy to transition from Destroying to Destroyed state (emitting eventClose)
 

Static Protected Member Functions

static void stopRedableCallback (AsyncResult &)
 

Protected Attributes

AsyncEventLoopeventLoop = nullptr
 
AsyncBufferView::ID bufferID
 
bool autoCloseDescriptor = false
 

Static Protected Attributes

static Function< void(AsyncResult &)> onStopCallback
 

Additional Inherited Members

- Static Public Attributes inherited from SC::AsyncReadableStream
static constexpr int MaxListeners = 8
 

Member Function Documentation

◆ asyncDestroyReadable()

template<typename AsyncRequestType >
virtual Result SC::AsyncRequestReadableStream< AsyncRequestType >::asyncDestroyReadable ( )
overrideprotectedvirtual

Function that a readable stream can re-implement to release its internal resources.

Note
The re-implementation MUST call finishedDestroyingReadable once it has finished stopping.

Reimplemented from SC::AsyncReadableStream.

◆ asyncRead()

template<typename AsyncRequestType >
virtual Result SC::AsyncRequestReadableStream< AsyncRequestType >::asyncRead ( )
overrideprotectedvirtual

Function that every stream must define to implement its custom read operation.

Implements SC::AsyncReadableStream.

◆ setAutoCloseDescriptor()

template<typename AsyncRequestType >
void SC::AsyncRequestReadableStream< AsyncRequestType >::setAutoCloseDescriptor ( bool value)
inline

Automatically closes descriptor during read stream close event.


The documentation for this struct was generated from the following file: