Sane C++ Libraries
C++ Platform Abstraction Libraries
SC::AsyncTransformStream Struct Reference
Inheritance diagram for SC::AsyncTransformStream:
SC::AsyncReadableStream SC::AsyncWritableStream SC::SyncZLibTransformStream

Public Member Functions

Result init (AsyncBuffersPool &buffersPool, Span< AsyncReadableStream::Request > readableRequests, Span< AsyncWritableStream::Request > writableRequests)
 
- Public Member Functions inherited from SC::AsyncReadableStream
Result init (AsyncBuffersPool &buffersPool, Span< Request > requests)
 Emitted when the underlying resource has been closed. More...
 
Result start ()
 Starts the readable stream, that will emit eventData. More...
 
void pause ()
 Pauses the readable stream (that can be later resumed) More...
 
void resumeReading ()
 Resumes the readable stream paused by AsyncReadableStream::pause. More...
 
void destroy ()
 Forcefully destroys the readable stream before it's end event releasing all resources. More...
 
bool isEnded () const
 Returns true if the stream is ended (AsyncReadableStream::end has been called) More...
 
AsyncBuffersPoolgetBuffersPool ()
 Obtains the AsyncBuffersPool to request more buffers. More...
 
void push (AsyncBufferView::ID bufferID, size_t newSize)
 Use push from inside AsyncReadableStream::asyncRead function to queue received data. More...
 
void pushEnd ()
 Use pushEnd from inside AsyncReadableStream::asyncRead to signal production end. More...
 
void reactivate (bool doReactivate)
 Use reactivate(true) from inside AsyncReadableStream::asyncRead function to ask the state machine to invoke asyncRead again. More...
 
void emitError (Result error)
 Signals an async error received. More...
 
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. More...
 
- Public Member Functions inherited from SC::AsyncWritableStream
Result init (AsyncBuffersPool &buffersPool, Span< Request > requests)
 Emitted when no more data can be written. More...
 
Result write (AsyncBufferView::ID bufferID, Function< void(AsyncBufferView::ID)> cb={})
 Writes a buffer (that must be allocated by the AsyncBuffersPool passed in AsyncWritableStream) When the buffer it will be actually written, AsyncWritableStream::eventWritten will be raised and its reference count will be decreased. More...
 
Result write (Span< const char > data, Function< void(AsyncBufferView::ID)> cb={})
 Try requesting a buffer big enough and copy data into it. More...
 
template<size_t N>
Result write (const char(&str)[N])
 Write a C-string literal in the stream. More...
 
void end ()
 Ends the writable stream, waiting for all in-flight and queued writes to finish. More...
 
AsyncBuffersPoolgetBuffersPool ()
 Obtains the buffers pool to access its data. More...
 
void finishedWriting (AsyncBufferView::ID bufferID, Function< void(AsyncBufferView::ID)> &&cb, Result res)
 Signals that the given buffer (previously queued by write) has been fully written. More...
 
void resumeWriting ()
 Resumes writing queued requests for this stream. More...
 
Result unshift (AsyncBufferView::ID bufferID, Function< void(AsyncBufferView::ID)> &&cb)
 Puts back a buffer at the top of the write queue. More...
 
void emitError (Result error)
 Signals an async error received. More...
 
void tryAsync (Result potentialError)
 Will emit error if the passed in Result is false. More...
 
void stop ()
 

Additional Inherited Members

- Public Attributes inherited from SC::AsyncReadableStream
Function< Result()> asyncRead
 Function that every stream must define to implement its custom read operation. More...
 
Event< MaxListeners, ResulteventError
 
Event< MaxListeners, AsyncBufferView::IDeventData
 Emitted when an error occurs. More...
 
Event< MaxListeners > eventEnd
 Emitted when a new buffer has been read. More...
 
Event< MaxListeners > eventClose
 Emitted when there is no more data. More...
 
- Public Attributes inherited from SC::AsyncWritableStream
Function< Result(AsyncBufferView::ID, Function< void(AsyncBufferView::ID)>)> asyncWrite
 Function that every stream must define to implement its custom write operation. More...
 
Event< MaxListeners, ResulteventError
 
Event< MaxListeners > eventDrain
 Emitted when an error occurs. More...
 
Event< MaxListeners > eventFinish
 Emitted when write queue is empty. More...
 
Function< bool()> canEndWritable
 Allows keeping a writable in ENDING state until it has finished flushing all pending data. More...
 
- Static Public Attributes inherited from SC::AsyncReadableStream
static constexpr int MaxListeners = 8
 
- Static Public Attributes inherited from SC::AsyncWritableStream
static constexpr int MaxListeners = 8
 

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